Mordecki Posted November 1, 2018 Share Posted November 1, 2018 Hello, I am working on a bus mod lately but there's a problem with random police chases, After shootout passengers get to panic mode and don't respond anymore. Is there any native function to disable police chases and patrol cars ? Thanks, Mordecki. Link to comment Share on other sites More sharing options...
Guest Posted November 1, 2018 Share Posted November 1, 2018 (edited) On one of my many excursions through the scripts, I found a function that they use to clear the map of activity for when you go into Director mode. One of the natives used in there was ENABLE_DISPATCH_SERVICE and in this function, they set 3 and 5 to false. Those (according to nativedb) are Ambulance and Fire Department. Here's the full list of enums. enum eDispatchType : UINT16 { DT_PoliceAutomobile = 1, DT_PoliceHelicopter = 2, DT_FireDepartment = 3, DT_SwatAutomobile = 4, DT_AmbulanceDepartment = 5, DT_PoliceRiders = 6, DT_PoliceVehicleRequest = 7, DT_PoliceRoadBlock = 8, DT_PoliceAutomobileWaitPulledOver = 9, DT_PoliceAutomobileWaitCruising = 10, DT_Gangs = 11, DT_SwatHelicopter = 12, DT_PoliceBoat = 13, DT_ArmyVehicle = 14, DT_BikerBackup = 15 }; It might be worth disabling the dispatch services 1 & 2, just to see if that has any effect. It might just be for things the player does but then again, you might get lucky and it does what you need. There's also the brute-force option. Using this native IS_VEHICLE_SIREN_ON, you could collect the local vehicles and if you found any police vehicles with that native returning a true, delete the vehcle. The final option would be to check through the scripts to see if any of the "controller" scrpts have anything to do with it. If so, you could add some code that disables that script from running. Digging through the scrips can be time consuming though, so it's worth trying the dispatch service option first. Nice script btw, I gave it a go yesterday and it works really well... if I might make a small request, a "voice off" option in the ini would be great. I tried it with Trevor and after 5 stops, I wanted to drag him out of the bus and kill him myself, for being nice and welcoming to everyne at every stop. Edit: Have a look at traffick_ground.c in the decompiled scripts. I am seeing things like: func_361("DELETING PEDS IN POLICE CAR CHASE"); and func_361("DELETING CARS IN POLICE CAR CHASE"); So there might be something in there. It's an almost 24,000 line script though but it might be worth a closer look. Double-Edit: Just had my script watcher monitoring that traffick_ground script and when a police chase started, it remained inactive, so that doesn't seem to be connected. Edited November 1, 2018 by Guest Link to comment Share on other sites More sharing options...
Guest Posted November 1, 2018 Share Posted November 1, 2018 (edited) I have just been looking through the natives and there are two natives for blocking events, are you using any of them, or even both of trhem? They're TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS and SET_BLOCKING_OF_NON_TEMPORARY_EVENTS. The comment under the 2nd one on NativeDB says " works with AI::TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS to make a ped completely oblivious to all events going on around him " Edited November 1, 2018 by Guest Link to comment Share on other sites More sharing options...
Mordecki Posted November 1, 2018 Author Share Posted November 1, 2018 (edited) Thanks for research ! I tried: ped.BlockPermanentEvents = true; but will also add: Quote TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS maybe it's gonna work better, also added a timer as one of the solutions, when someone won't leave the bus within 15 seconds he will be force removed from the bus. ps: yeah i will remove that voice in the next update, it's too iritating Edited November 1, 2018 by Mordecki Link to comment Share on other sites More sharing options...
Guest Posted November 1, 2018 Share Posted November 1, 2018 Yeah, forcing them off the bus is a good option. The other way, which is a bit of an overkill way, would be to store the configurations of any peds on the bus and then respawn them with that configuration. But if the extra blocking works, then that's even better. Link to comment Share on other sites More sharing options...
Guest Posted November 2, 2018 Share Posted November 2, 2018 (edited) After noticing a comment on your mod about Native Trainer being able to disable police, I looked in the source of that trainer. That led me to a section in the NativeDB that had these natives. void SET_CREATE_RANDOM_COPS(BOOL toggle) // 102E68B2024D536D 23441648 void SET_CREATE_RANDOM_COPS_NOT_ON_SCENARIOS(BOOL toggle) // 8A4986851C4EF6E7 82E548CC void SET_CREATE_RANDOM_COPS_ON_SCENARIOS(BOOL toggle) // 444CB7D7DBE6973D EDC31475 BOOL CAN_CREATE_RANDOM_COPS() // 5EE2CAFF7F17770D AA73DAD9 Some of them look like they might be promising. The ones used in Native Trainer are the bottom one to check the state of random cops, and the top one being used to set the state. Edited November 2, 2018 by Guest Link to comment Share on other sites More sharing options...
Guest Posted November 7, 2018 Share Posted November 7, 2018 @MordeckiI tried the new version tonight and noticed something that requires a bit of attention. I always start my games as Trevor and you have a route start point right near his trailer in Sandy Shores. If I hit insert, it spawns another bus at the same location. If I hit insert again, it adds another bus etc...because I write script mods, hitting insert is something I do a lot, so buses were coming over the fence into the street. It just needs a check in the spawning process to see if a bus already exists at the spawn location and to then either use that existing bus, or to delete it and spawn a new one. Even if your script is 100% stable, another mod could cause the user to hit Insert, so it's something to be aware of. You have the same problem with Blips, they are something else that need to be cleaned up when scripts are reset. If you add a handler for the Script.Aborted event, you can use that to handle things like that. If you don't, Blips will keep stacking up in the map and it won't take long before the game starts to suffer from them. Blips seem capable of doing surprising damage to the game's stability... as I discovered when I dumped 1200 of them into the map by mistake. If you hit insert and go to one of your bus blips, it will say 2/2 or 1/2, if you hit insert again, it will say 3/3. Link to comment Share on other sites More sharing options...