gtaragemachine Posted September 22, 2009 Share Posted September 22, 2009 As far as I know this mod hasn't been done, and I like adding bits of reality to the game. What it does: Each time CJ gets into a vehicle his wanted level drops by one. I made it so it won't drop from 1 to zero though. Purpose for mod: I thought it'd be a little more realistic to shake the trail of the cops by switching cars. So, each time CJ switches cars, the cop trail goes that much colder. The reason I posted this in this coding section is because I have no idea if this is terribly inefficient code or not. I thought I'd ask you experts if it can be cleaned up a bit or if it is good to go. It seems to work ok, though. The code: {$CLEO .cs}:DriveEvade03A4: name_thread 'DrvEvd':DriveEvade_1wait 0 if0256: player $PLAYER_CHAR defined004D: jump_if_false @DriveEvade_1if0038: $ONMISSION == 0004D: jump_if_false @DriveEvade_1:DriveEvade_2wait 0if00DF: actor $PLAYER_ACTOR driving004D: jump_if_false @DriveEvade_1:DriveEvade_3wait 0if010F: player $PLAYER_CHAR wanted_level > 1004D: jump_if_false @DriveEvade_9:DriveEvade_4wait 0if010F: player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @DriveEvade_5010D: set_player $PLAYER_CHAR wanted_level_to 50002: jump @DriveEvade_9:DriveEvade_5wait 0if010F: player $PLAYER_CHAR wanted_level > 4004D: jump_if_false @DriveEvade_6010D: set_player $PLAYER_CHAR wanted_level_to 40002: jump @DriveEvade_9:DriveEvade_6wait 0if010F: player $PLAYER_CHAR wanted_level > 3004D: jump_if_false @DriveEvade_7010D: set_player $PLAYER_CHAR wanted_level_to 30002: jump @DriveEvade_9:DriveEvade_7wait 0if010F: player $PLAYER_CHAR wanted_level > 2004D: jump_if_false @DriveEvade_8010D: set_player $PLAYER_CHAR wanted_level_to 20002: jump @DriveEvade_9:DriveEvade_8wait 0if010F: player $PLAYER_CHAR wanted_level > 1004D: jump_if_false @DriveEvade_9010D: set_player $PLAYER_CHAR wanted_level_to 10002: jump @DriveEvade_9:DriveEvade_9wait 0if 80DF: NOT actor $PLAYER_ACTOR driving004D: jump_if_false @DriveEvade_90002: jump @DriveEvade_1 Link to comment Share on other sites More sharing options...
james227uk Posted September 22, 2009 Share Posted September 22, 2009 To me, I see it as "If it ain't broke don't fix it". Just release it and get credit is my advice. Link to comment Share on other sites More sharing options...
Adler Posted September 23, 2009 Share Posted September 23, 2009 ^ Nothing bad about tuning it up a just a little... {$CLEO .cs}03A4: name_thread 'DRVEVD':STARTwait 0if andPlayer.Defined($PLAYER_CHAR)Actor.Driving($PLAYER_ACTOR)// $ONMISSION == 0 // Why not on mission too?jf @STARTif010F: player $PLAYER_CHAR wanted_level > 1jf @START03C0: [email protected] = actor $PLAYER_ACTOR car// PLAYER not driving:DRIVE_CHECKwait 0ifnot Actor.Driving($PLAYER_ACTOR)jf @DRIVE_CHECK// COP not near PLAYER; PLAYER in CAR (not [email protected]):CHECKwait 0Actor.RemoveReferences([email protected])00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]: get_actor_in_sphere [email protected] [email protected] [email protected] radius 20.0 with_pedtype_civilian 1 gang 0 criminal/prostitute 0 handle_as [email protected]: get_actor [email protected] pedtype_to [email protected] [email protected] == 6jf @CHECKActor.RemoveReferences([email protected])if and0449: actor $PLAYER_ACTOR in_a_car80DB: not actor $PLAYER_ACTOR in_car [email protected] jf @CHECKCar.RemoveReferences([email protected])01C0: [email protected] = player $PLAYER_CHAR [email protected] -= [email protected] == 0jf @START010D: set_player $PLAYER_CHAR wanted_level_to [email protected] @START ADDED Loop: Checking for nearby COPS Loop: Checking if $PLAYER_ACTOR is in his old car Shortened down with some math I commented out the $ONMISSION check. I think it's more realistic to keep this in missions too but if you don't want it that way then just un-comment it. Link to comment Share on other sites More sharing options...
Wesser Posted September 23, 2009 Share Posted September 23, 2009 I can't try to find the correct opcode now because I'm at school. By the way, search for get_actor_ped_event_to and check if the returned value is 72 (PED_EVENT_SEEN_COP), like this: 0000: get_actor $PLAYER_ACTOR ped_event_to [email protected] if not [email protected] == 72 then // cop didn't see youend 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
gtaragemachine Posted September 23, 2009 Author Share Posted September 23, 2009 ^ Nothing bad about tuning it up a just a little... {$CLEO .cs}03A4: name_thread 'DRVEVD':STARTwait 0if andPlayer.Defined($PLAYER_CHAR)Actor.Driving($PLAYER_ACTOR)// $ONMISSION == 0 // Why not on mission too?jf @STARTif010F: player $PLAYER_CHAR wanted_level > 1jf @START03C0: [email protected] = actor $PLAYER_ACTOR car// PLAYER not driving:DRIVE_CHECKwait 0ifnot Actor.Driving($PLAYER_ACTOR)jf @DRIVE_CHECK// COP not near PLAYER; PLAYER in CAR (not [email protected]):CHECKwait 0Actor.RemoveReferences([email protected])00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]: get_actor_in_sphere [email protected] [email protected] [email protected] radius 20.0 with_pedtype_civilian 1 gang 0 criminal/prostitute 0 handle_as [email protected]: get_actor [email protected] pedtype_to [email protected] [email protected] == 6jf @CHECKActor.RemoveReferences([email protected])if and0449: actor $PLAYER_ACTOR in_a_car80DB: not actor $PLAYER_ACTOR in_car [email protected] jf @CHECKCar.RemoveReferences([email protected])01C0: [email protected] = player $PLAYER_CHAR [email protected] -= [email protected] == 0jf @START010D: set_player $PLAYER_CHAR wanted_level_to [email protected] @START ADDED Loop: Checking for nearby COPS Loop: Checking if $PLAYER_ACTOR is in his old car Shortened down with some math I commented out the $ONMISSION check. I think it's more realistic to keep this in missions too but if you don't want it that way then just un-comment it. Thanks for the help. I tried it though and it crashes after CJ gets out of the first car. I tried figuring it out but I'm stumped. Link to comment Share on other sites More sharing options...
Adler Posted September 24, 2009 Share Posted September 24, 2009 (edited) Damn sorry. I've always had bad luck when the script is tested for some reason. EDITED POST when I can fix it! I can't try to find the correct opcode now because I'm at school. lol Do you check GTAF at school too? By the way, search for get_actor_ped_event_to and check if the returned value is 72 (PED_EVENT_SEEN_COP), like this: You know what you wrote... Wow I didn't know that before Wesser. UPDATED CODE {$CLEO .cs}03A4: name_thread 'DRVEVD'// Driving; Wanted Level check every second:STARTwait 1000if andPlayer.Defined($PLAYER_CHAR)Actor.Driving($PLAYER_ACTOR)// $ONMISSION == 0 // Commented outjf @STARTif010F: player $PLAYER_CHAR wanted_level > 1jf @START03C0: [email protected] = actor $PLAYER_ACTOR car// Car.Wrecked; Out of car check every second:DRIVING_CHECKwait 1000ifnot Car.Wrecked([email protected])jf @SCRIPT_ENDifnot Actor.Driving($PLAYER_ACTOR)jf @DRIVING_CHECK// Cop near Player; Player in car (not own car) check every half second:COPCAR_CHECKwait 500{if874F: not actor $PLAYER_ACTOR ped_event == 72 // GTAModding: "doesnt work?!"jf @COPCAR_CHECK}080E: get_actor $PLAYER_ACTOR ped_event_to [email protected] [email protected] == 72 // EVENT_SEEN(BY)_COPjf @COPCAR_CHECKif80DB: not actor $PLAYER_ACTOR in_car [email protected] jf @DRIVING_CHECKif0449: actor $PLAYER_ACTOR in_a_carjf @COPCAR_CHECK01C0: [email protected] = player $PLAYER_CHAR [email protected] += -1ifnot [email protected] == 0jf @SCRIPT_END010D: set_player $PLAYER_CHAR wanted_level_to [email protected]:SCRIPT_ENDCar.RemoveReferences([email protected])jump @START CHANGES Loop (COPS): Ped_Event 72 Some minor changes (Probably not important):SCRIPT_END :LABEL Separated in_car checks Car.Wrecked check I also changed -= 1 into += -1. Do these work differently? Sorry I can't test it because my computer sucks too bad to run SA (I've been playing on my cousin's computer but I can't anymore). Edited September 24, 2009 by Adler Link to comment Share on other sites More sharing options...
gtaragemachine Posted September 24, 2009 Author Share Posted September 24, 2009 CHANGES Loop (COPS): Ped_Event 72 Some minor changes (Probably not important):SCRIPT_END :LABEL Separated in_car checks Car.Wrecked check I also changed -= 1 into += -1. Do these work differently? Sorry I can't test it because my computer sucks too bad to run SA (I've been playing on my cousin's computer but I can't anymore). I tried out your revised code and everything works except for the cop check. The "same car" check works though. I'll play around with it later today when I have time. Thanks much for your help so far. If we can get the cop check working, I think this will be a great addition to the game. Link to comment Share on other sites More sharing options...
Adler Posted September 25, 2009 Share Posted September 25, 2009 (edited) The "same car" check works though. That's good to hear. I think looking for random cop peds near the player constantly in the previous script caused the game to crash. everything works except for the cop check. Something to do with the Ped Event opcodes I guess. These are the only opcodes that have to do with Ped Events that don't have unknown uses: 074F: actor <handle> ped_event == <value>080E: get_actor <handle> ped_event_to <handle> You can use the following opcodes to do stuff to events. * 074F – Checks if an event is happening on the actor (doesnt work?!) * 080E – Gets the actor's current event I went with GTAModding's word and used 080E. Try 074F to see if it works for you. EDIT - I looked through the list of EXE Functions (1.0) and couldn't figure out how to store a Ped Event to a var. 00A7 should work for this right? I saw a few sections when I searched for "pedevent" but I couldn't decipher the meaning of them. Cookie for anyone who can figure out how to do this! Edited September 25, 2009 by Adler Link to comment Share on other sites More sharing options...
gtaragemachine Posted September 26, 2009 Author Share Posted September 26, 2009 ...EDIT - I looked through the list of EXE Functions (1.0) and couldn't figure out how to store a Ped Event to a var. 00A7 should work for this right? I saw a few sections when I searched for "pedevent" but I couldn't decipher the meaning of them. Cookie for anyone who can figure out how to do this! I'll also give a cookie to anyone who can figure out the cop check... Also, does anyone know if there's a way to check if the player has changed clothes or hairstyles? That'd be a great addition to this mod. If CJ changed clothes or hairstyles, his wanted level would go down. Link to comment Share on other sites More sharing options...
ZAZ Posted September 26, 2009 Share Posted September 26, 2009 Cookie for anyone who can figure out how to do this! I'll also give a cookie to anyone who can figure out the cop check... what do you mean? If cops are in range of player_actor? look into the CopWeapons script wait 25004C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.008E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 71.5 handle_as [email protected]([email protected],16i)wait 50if not [email protected]([email protected],16i) == -1jf @COPWEAP_893089F: get_actor [email protected]([email protected],16i) pedtype_to [email protected] @COPWEAP_845:[email protected] == 6jf @COPWEAP_893 Also, does anyone know if there's a way to check if the player has changed clothes or hairstyles? That'd be a great addition to this mod. If CJ changed clothes or hairstyles, his wanted level would go down. :INTRO2_482500D6: if or0500: player $PLAYER_CHAR skin == "TASH" on_bodypart 1 0500: player $PLAYER_CHAR skin == "GOATEE" on_bodypart 1 0500: player $PLAYER_CHAR skin == "BEARD" on_bodypart 1 0500: player $PLAYER_CHAR skin == "PLAYER_FACE" on_bodypart 1 0500: player $PLAYER_CHAR skin == "HIGHFADE" on_bodypart 1 0500: player $PLAYER_CHAR skin == "FLATTOP" on_bodypart 1 004D: jump_if_false @INTRO2_5442 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Adler Posted September 26, 2009 Share Posted September 26, 2009 UPDATED SCRIPT {$CLEO .cs}thread 'DRVEVD'// Driving, Wanted Level, Interior check every second:STARTwhile truewait 1000 if and Player.Defined($PLAYER_CHAR) Actor.Driving($PLAYER_ACTOR) then 077E: get_active_interior_to [email protected] 01C0: [email protected] = Player.WantedLevel($PLAYER_CHAR) if and [email protected] == 0 [email protected] > 1 then break end endend03C0: [email protected] = Actor.Car($PLAYER_ACTOR)// Car.Wrecked, Out-of-car check every second:DRIVING_CHECKrepeatwait 1000 if not Car.Wrecked([email protected]) jf @SCRIPT_ENDuntil not Actor.Driving($PLAYER_ACTOR)// Cop-near-Player; In-own-car check every half second:COP_CHECKrepeatwait 500 Actor.RemoveReferences([email protected]) Actor.StorePos($PLAYER_ACTOR [email protected] [email protected] [email protected]) 08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 20.0 handle_as [email protected] if [email protected] == -1 then jump @CAR_CHECK // Skip Cop Check else break end 089F: get_actor [email protected] pedtype_to [email protected] not [email protected] == 6:CAR_CHECKwait 500if not Actor.InCar($PLAYER_ACTOR [email protected])jf @DRIVING_CHECKif Actor.InCar($PLAYER_ACTOR)jf @[email protected] = Player.WantedLevel($PLAYER_CHAR)[email protected] += -1if not [email protected] == 0jf @SCRIPT_ENDPlayer.WantedLevel($PLAYER_CHAR) = [email protected]:SCRIPT_ENDCar.RemoveReferences([email protected])jump @START In theory this should work (Going by ZAZ's ped check ). And aren't the haircuts and changing clothes already suspending wanted level? Link to comment Share on other sites More sharing options...
gtaragemachine Posted September 27, 2009 Author Share Posted September 27, 2009 UPDATED SCRIPT... In theory this should work (Going by ZAZ's ped check ). And aren't the haircuts and changing clothes already suspending wanted level? This is exciting. I can't wait to try that script out. I'm not a programmer so it may take me some time to figure out how to complete your coding. I have some extra time tomorrow that I can work on it. Thanks so much for your help (you too ZAZ). Link to comment Share on other sites More sharing options...
Adler Posted September 27, 2009 Share Posted September 27, 2009 (edited) ^ lol It's not really programming, just SA Coding (though I'm also trying to learn C++ atm ). Also the script isn't tested yet so don't get your hopes up too high. And if you want to add a feature where wanted level goes down then I think it'd be better to make a separate script. You can share that script in this topic too if you need any help. Edited September 27, 2009 by Adler Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now