SR3 Play as a Cop mod

Hey, been working on just a little lua script that lets you play like a cop. It lets you call backup and you can arrest mission NPCs too.

GIfR7gq.png


m8KwCEN.png


wYpQumq.png


Here's everything it does so far:
  • Toggle your status as a cop or go back to being a saint
  • Become a cop and police and saints will be allies (so cops won't shoot you or your homies)
  • You can call for backup (note this sets your notoriety but the cops that come will help you)
  • Arrest some NPCs (only works with mission NPCs because of how the game is coded)
  • You can go rogue and get kicked out if you kill too many civilians or whatever
There are some settings you can edit in the mod to change things like:
  • Get cop outfit automatically when you become a cop
  • Whether or not you can go rogue by committing crimes as a cop
  • Change keybinds and messages

Controls:

The main controls are the horn key and the up and down arrow keys. I recommend changing your horn key to something like H so it isn't the same as the melee key.

Press and hold H (or whatever your horn key is) when ingame for the option to become a cop (or to stop being a cop).
Press and hold H (or whatever your horn key is), then press up arrow or down arrow to request/remove backup.

In missions, take someone as a hostage then press H (or whatever your horn key is) to start interrogating them. Press E while interrogating to arrest, or H again to go back to normal.

You can release arrested NPCs by pressing E beside them (they will not be able to be interacted with again after)

Since the player's team is never changed, this seems to work really well in all missions (ones where the police aren't the enemy at least) without causing bugs :cool:


Install:

If you don't use any sr3_city.lua mod like Sandbox, just place all files (except readme.txt) in your SR3 install folder.

If you already have a sr3_city.lua already in your install folder, don't replace it. Follow these instructions:

  1. Copy all files except sr3_city.lua and readme.txt to your SR3 install folder.
  2. Open the sr3_city.lua that you already have
  3. Edit the following:
Add this code to the top of the file:
Code:
include("policemod.lua")

Find the bit where it says "function sr3_city_main()" and insert this directly on the next line down
Code:
policemod_main()

It should look like this now:
Code:
function sr3_city_main()
       policemod_main()

Then save your sr3_city.lua file with the edits.


Thanks to antonin for his SR2 mod which gave some ideas for making this:
https://www.saintsrowmods.com/forum/threads/play-as-a-cop.2943/
 

Attachments

  • SR3_Policemod.zip
    21.6 KB · Views: 1,027
Last edited:
Hey, been working on just a little lua script that lets you play like a cop. It lets you call backup and you can arrest mission NPCs too.

GIfR7gq.png


m8KwCEN.png


wYpQumq.png


Here's everything it does so far:
  • Toggle your status as a cop or go back to being a saint
  • Become a cop and police and saints will be allies (so cops won't shoot you or your homies)
  • You can call for backup (note this sets your notoriety but the cops that come will help you)
  • Arrest some NPCs (only works with mission NPCs because of how the game is coded)
  • You can go rogue and get kicked out if you kill too many civilians or whatever
There are some settings you can edit in the mod to change things like:
  • Get cop outfit automatically when you become a cop
  • Whether or not you can go rogue by committing crimes as a cop
  • Change keybinds and messages

Controls:

The main controls are the horn key and the up and down arrow keys. I recommend changing your horn key to something like H so it isn't the same as the melee key.

Press and hold H (or whatever your horn key is) when ingame for the option to become a cop (or to stop being a cop).
Press and hold H (or whatever your horn key is), then press up arrow or down arrow to request/remove backup.

In missions, take someone as a hostage then press H (or whatever your horn key is) to start interrogating them. Press E while interrogating to arrest, or H again to go back to normal.

You can release arrested NPCs by pressing E beside them (they will not be able to be interacted with again after)

Since the player's team is never changed, this seems to work really well in all missions (ones where the police aren't the enemy at least) without causing bugs :cool:


Install:

If you don't use any sr3_city.lua mod like Sandbox, just place all files (except readme.txt) in your SR3 install folder.

If you already have a sr3_city.lua already in your install folder, don't replace it. Follow these instructions:

  1. Copy all files except sr3_city.lua and readme.txt to your SR3 install folder.
  2. Open the sr3_city.lua that you already have
  3. Edit the following:
Add this code to the top of the file:
Code:
include("policemod.lua")

Find the bit where it says "function sr3_city_main()" and insert this directly on the next line down
Code:
policemod_main()

It should look like this now:
Code:
function sr3_city_main()
[INDENT]policemod_main()[/INDENT]

Then save your sr3_city.lua file with the edits.


Thanks to antonin for his SR2 mod which gave some ideas for making this:
https://www.saintsrowmods.com/forum/threads/play-as-a-cop.2943/
Oh nice, I almost thought u can arrest any npcs outside missions. We'll it's alot different then saints row 2 however. But doing this missions will sounds fun! Arresting bunches of strippers in trojan whores. i'll try this in remastered version but not sure text string may work.
 
Oh nice, I almost thought u can arrest any npcs outside missions. We'll it's alot different then saints row 2 however. But doing this missions will sounds fun! Arresting bunches of strippers in trojan whores. i'll try this in remastered version but not sure text string may work.

I wish but this isn't possible because open world NPCs can't be scripted.
https://www.saintsrowmods.com/forum/threads/referencing-open-world-objects-with-lua.2639/

It should work on the remaster. I don't have it but try it and let me know.

Edit: It is probably possible to arrest homies, if you can take them hostage.
 
Last edited:
Okay i tried my method from scratch to grab any mission npcs and that worked in remastered.
Instead of:
local dist_to_npc, npc = get_closest_npc_to_object(LOCAL_PLAYER, 1.5)
npc = ADD_NEW_TEAM_NPC --that type stops workings, or word "npc" names may be reverse in some missions scripts
party_add_ignore_limits(ADD_NEW_TEAM_NPC)
Use: no "npc"
local dist_to_npc, ADD_NEW_TEAM_NPC = get_closest_npc_to_object(LOCAL_PLAYER, 1.5)
party_add_ignore_limits(ADD_NEW_TEAM_NPC) --it works this way

Like this:
Code:
function  ADD_NEW_HOMIES()
        while true do
        thread_yield()
            if character_has_human_shield(LOCAL_PLAYER) then
                local dist_to_npc, ADD_NEW_TEAM_NPC = get_closest_npc_to_object(LOCAL_PLAYER, 1.5)
               
                if character_has_specific_human_shield(LOCAL_PLAYER, ADD_NEW_TEAM_NPC) then
                        if player_action_is_pressed(B_DELETE) and  player_action_is_pressed(B_PGDWN)   then 
                           
                             local PLAYERS_TEAM = get_team(LOCAL_PLAYER)
                             set_team(  ADD_NEW_TEAM_NPC ,PLAYERS_TEAM)      

                         set_attack_player_flag( ADD_NEW_TEAM_NPC, false)
                         set_always_sees_player_flag( ADD_NEW_TEAM_NPC, false)                               
                             player_release_human_shield(LOCAL_PLAYER,true,false)
                             set_max_hit_points(ADD_NEW_TEAM_NPC, 5000, true)
                             party_add_ignore_limits(ADD_NEW_TEAM_NPC)
                             ai_set_personality( ADD_NEW_TEAM_NPC, "Gang defensive")
                              mission_help_table("Hostage added to your team")
                        end
                        if   player_action_is_pressed(B_HYDRAULICS) then --this only works on controller
                           
                             local PLAYERS_TEAM = get_team(LOCAL_PLAYER)
                             set_team(  ADD_NEW_TEAM_NPC ,PLAYERS_TEAM)      

                         set_attack_player_flag( ADD_NEW_TEAM_NPC, false)
                         set_always_sees_player_flag( ADD_NEW_TEAM_NPC, false)                               
                             player_release_human_shield(LOCAL_PLAYER,   true,false)
                             set_max_hit_points(ADD_NEW_TEAM_NPC, 5000, true)
                             party_add_ignore_limits(ADD_NEW_TEAM_NPC)
                             ai_set_personality( ADD_NEW_TEAM_NPC, "Gang defensive")
                   mission_help_table("Hostage added to your team")
                        end
                      
                end
            end          
        end
end
 
Good to know you got it working on the remaster!

I had a think about other ideas for this mod but couldn't really come up with anything. Being unable to script anything in the open world makes a lot of interesting and fun stuff like arresting random people impossible.

I also thought about SR4 but I don't think the mod would work in that game because there's no gangs or anything.
 
for SRIV i see but only in missions , i can have replaying mission with this mod, but zins and police teams ups by default, unless u can put team_make_hostile to police and luchoderes (zin are "luchadores" team) so u can team with cops and arrest aliens , but aliens will always kill police , but they spawn in notoriety level 2 or Flashpoint however team_make_unfriendly didn't work in IV for odd reason which i tried.

Sometimes when completing or exiting mission might restore police and zins as allies again.
 
This is really nice work! I'm excited to try it out. Just wondering, since you've had experience tinkering with the lua files, how feasible do you imagine it would be to script a mod that does the reverse of this, as in have the cops try to arrest the player?
 
So, some Deckers just hit another car.
I use the sirens to make them stop, and then they try to escape...
(Video attached)

And that mission, just by wearing that clothes, it's so much cooler.
(Video attached)
 

Attachments

  • Saints Row_ The Third 2022-06-30 00-27-18.rar
    34.8 MB · Views: 245
  • FBI.rar
    20.5 MB · Views: 233
Last edited:
Back
Top