Rocker453 Posted May 21, 2011 Share Posted May 21, 2011 (edited) I was impressed with a "Cautious Drivers" mod for GTAIV so I decided to make a similar one for GTA:SA. There is only one feature of the original mod that I haven't been able to copy (and it the most important one ) In the original mod, there was a mechanism to jack a locked car. A driver would get out of his car and run away when you point a gun at him while he's driving. Now, I don't know how to do this in SA. Is there any opcode that can help me? This is an important feature cuz otherwise, all cars would be locked so there will not be ANY drivable cars in San Andreas (which is insane)! If you have another realistic idea for jacking locked cars, please tell me. Any help would be appreciated! Here is my script: {$E}thread 'CautiousDrivers':Variableswait 0 if and 0004: $ONMISSION = 0 Player.Defined($PLAYER_ACTOR) 80DF: not actor $PLAYER_ACTOR drivingthen jump @OnFootendjump @Variables:OnFootwait 0 03C0: [email protected] = actor $PLAYER_ACTOR car 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] or not Car.Defined([email protected]) 0965: actor $PLAYER_ACTOR swimming 0045: [email protected] == [email protected] // (float) then jump @Variablesend020A: set_car [email protected] door_status_to 7Car.RemoveReferences([email protected])jump @Variables P.S I am planning to combine this mod with a "Driving Felony" (which is also originally a GTA4 mod by the same author) if its completed. Edited May 22, 2011 by Rocker453 Link to comment Share on other sites More sharing options...
ZAZ Posted May 22, 2011 Share Posted May 22, 2011 wrong directive {$E} read CLEO Script Tutorial max 7 charackter as threadname is really valid thread 'CautiousDrivers' you check that $PLAYER_ACTOR isn't driving if and 0004: $ONMISSION = 0 Player.Defined($PLAYER_ACTOR) 80DF: not actor $PLAYER_ACTOR drivingthen jump @OnFootendjump @Variables then you may not get the handle of the player_car 03C0: [email protected] = actor $PLAYER_ACTOR car and furthermore you don't need to check if the player_car could be the closest_vehicle 0045: [email protected] == [email protected] // (float) also isn't this a conditional opcode 0004: $ONMISSION = 0 this is the condition: 0038: $ONMISSION == 0 script below works for me {$CLEO .cs}thread 'CautDrv':Variableswait 0 if Player.Defined($PLAYER_CHAR) then if and $ONMISSION == 0 80DF: not actor $PLAYER_ACTOR driving then jump @OnFoot end jump @Variables end:OnFoot 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] 0 if Car.Defined([email protected]) then 020A: set_car [email protected] door_status_to 7 Car.RemoveReferences([email protected]) endjump @Variables CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Rocker453 Posted May 22, 2011 Author Share Posted May 22, 2011 Whoa so many mistakes! By the way, this script works perfectly for me without the corrections you have mentioned. Firstly, how is the directive {$E} wrong? I have been using it in most of my CLEO scripts and it is working fine. 03C0: [email protected] = actor $PLAYER_ACTOR car 0045: [email protected] == [email protected] // (float) These opcodes were in the bigger version of my script (which I didn't post, I just posted a part of it). I added them so that your car doesn't get locked when you get out of it. But now I have remade the script so I don't need them anymore: {$E}thread 'Locked':Variableswait 0 if and 0038: $ONMISSION == 0 Player.Defined($PLAYER_ACTOR) 80DF: not actor $PLAYER_ACTOR drivingthen jump @OnFootendjump @Variables:OnFootwait 0 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] or not Car.Defined([email protected]) 0965: actor $PLAYER_ACTOR swimming then jump @Variablesend046C: [email protected] = car [email protected] driverif Actor.Defined([email protected])then 020A: set_car [email protected] door_status_to 7 jump @Jackingendjump @Variables:Jackingwait 0if not Actor.Defined([email protected])then jump @Variablesend if or 0496: tire 1 on_car [email protected] deflated 0496: tire 2 on_car [email protected] deflated 0496: tire 3 on_car [email protected] deflated 0496: tire 4 on_car [email protected] deflated then 0633: AS_actor [email protected] exit_carendCar.RemoveReferences([email protected])Actor.RemoveReferences([email protected]) jump @Variables Is there anything wrong now? Link to comment Share on other sites More sharing options...
BnB Posted May 22, 2011 Share Posted May 22, 2011 Using $E directive the script be compiled as .scm. Link to comment Share on other sites More sharing options...
ZAZ Posted May 22, 2011 Share Posted May 22, 2011 Firstly, how is the directive {$E} wrong? I have been using it in most of my CLEO scripts and it is working fine. It compiles the source as main.scm there where your source.txt is stored It needs then to rename it into main.cs and put it manual into cleo folder use {$CLEO .cs}, then the compiled script gets the same name like the source text with extension *.cs and if you choose "compile + copy", sanny puts a copy into cleo folder Is there anything wrong now? looks good and works CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Rocker453 Posted May 22, 2011 Author Share Posted May 22, 2011 Thanks for the corrections! Now any idea about my original question? In the original mod for GTA4, there was a mechanism to jack a locked car. A driver would get out of his car and run away when you point a gun at him while he's driving. Now, I don't know how to do this in SA. Is there any opcode that can help me? This is an important feature cuz otherwise, all cars would be locked so there will not be ANY drivable cars in San Andreas (which is insane)! If you have another realistic idea for jacking locked cars, please tell me. Any help would be appreciated! Link to comment Share on other sites More sharing options...
ZAZ Posted May 23, 2011 Share Posted May 23, 2011 Thanks for the corrections! Now any idea about my original question? In the original mod for GTA4, there was a mechanism to jack a locked car. A driver would get out of his car and run away when you point a gun at him while he's driving. Now, I don't know how to do this in SA. Is there any opcode that can help me? This is an important feature cuz otherwise, all cars would be locked so there will not be ANY drivable cars in San Andreas (which is insane)! If you have another realistic idea for jacking locked cars, please tell me. Any help would be appreciated! The aimcheck or the cleo4 opcode 0AD2: don't work for peds inside a car unless they do driveby. A way to realize could be to get the player target point and check if it's the same like the actor position have a look to Wessers script: >click< CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Rocker453 Posted May 24, 2011 Author Share Posted May 24, 2011 (edited) Oh thanks a lot for that! I dont understand a single thing in that script but I've still managed to make something out of it by copying it. Check this out: {$CLEO}thread 'Fire':fireif Actor.Defined($PLAYER_ACTOR)then 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] jump @DEFINEDendjump @fire:DEFINEDwait 00470: [email protected] = actor $PLAYER_ACTOR [email protected] *= [email protected] += [email protected] += 0x80A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]: call_scm_func @getAimPoint 4 range [email protected] from [email protected] [email protected] [email protected] camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected] not Actor.Defined([email protected])then jump @fireendActor.StorePos([email protected], [email protected], [email protected], [email protected])wait 0if and Actor.Animation($PLAYER_ACTOR) == "Gun_stand" 00F0: actor $PLAYER_ACTOR 0 near_point [email protected] [email protected] radius 4.0 4.0 stopped_on_foot 00EE: actor [email protected] -1 near_point [email protected] [email protected] radius 50.0 50.0 in_car then 00BC: show_text_highpriority GXT 'RREPAIR' time 1000 flag 1 // ~s~Come back between 9:00 and 17:00. 0633: AS_actor [email protected] exit_car endjump @fire:getAimPoint{Parameters: Passed: [email protected] - aiming range [email protected] - start point X [email protected] - start point Y [email protected] - start point Z Result: [email protected] - camera point X [email protected] - camera point Y [email protected] - camera point Z [email protected] - aim point X [email protected] - aim point Y [email protected] - aim point ZExample: 0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]}0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 4 store_to [email protected]: call_scm_func @getLocalVarOffset 2 thread [email protected] var 7 store_to [email protected]: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint [email protected] pCamera [email protected] fZ [email protected] fY [email protected] fX [email protected] fRange [email protected] // CCamera__Find3rdPersonCamTargetVector0AB2: ret 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] :getLocalVarOffset{Parameters: Passed: [email protected] - thread pointer [email protected] - var number Result: [email protected] - var valueExample: 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected]}[email protected] <> [email protected] *= 0x40A8E: [email protected] = [email protected] + 0xDC // mission flagif [email protected] == 1then [email protected] += 0xA48960 // mission localselse 005A: [email protected] += [email protected] [email protected] += [email protected] = 0end0AB2: ret 1 [email protected] I think I'll use this as a separate script cuz I don't want to make the other script more complex. I can't find any problem in this right now. Can you please check it and tell if you find any flaws? And there is one more thing I'd like to know. Is there a way to add offset to already stored coords? Edited May 24, 2011 by Rocker453 Link to comment Share on other sites More sharing options...
ZAZ Posted May 24, 2011 Share Posted May 24, 2011 Oh thanks a lot for that! I dont understand a single thing in that script but I've still managed to make something out of it by copying it. Check this out: I think I'll use this as a separate script cuz I don't want to make the other script more complex. I can't find any problem in this right now. Can you please check it and tell if you find any flaws? And there is one more thing I'd like to know. Is there a way to add offset to already stored coords? That's good so far. You don't need to understand wessers values but you could integrate the aimpoint function in your script. Only one fatal failure you made: It needs to set a wait after the loop adress otherwise the game crashes :fire// loop adresswait 0// need a wait hereif Actor.Defined($PLAYER_ACTOR)then 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] jump @DEFINEDendjump @fire then you should do anything to show where the aimpoint is and where the actor coords add corona codes 04D5: create_corona_at [email protected] [email protected] [email protected] radius 1.5 type 1 flare 0 RGB 150 0 255//PINK 04D5: create_corona_at [email protected] [email protected] [email protected] radius 1.5 type 1 flare 0 RGB 247 206 12//YELLOW therefor it needs to remove the other waits try this: {$CLEO}thread 'Fire':fire// loop adresswait 0// need a wait hereif Actor.Defined($PLAYER_ACTOR)then 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] jump @DEFINEDendjump @fire:DEFINED0470: [email protected] = actor $PLAYER_ACTOR [email protected] *= [email protected] += [email protected] += 0x80A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]: call_scm_func @getAimPoint 4 range [email protected] from [email protected] [email protected] [email protected] camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]: create_corona_at [email protected] [email protected] [email protected] radius 1.5 type 1 flare 0 RGB 150 0 255//PINKif not Actor.Defined([email protected])then jump @fireendActor.StorePos([email protected], [email protected], [email protected], [email protected])04D5: create_corona_at [email protected] [email protected] [email protected] radius 1.5 type 1 flare 0 RGB 247 206 12//YELLOWif and //Actor.Animation($PLAYER_ACTOR) == "Gun_stand" 00F0: actor $PLAYER_ACTOR 0 near_point [email protected] [email protected] radius 4.0 4.0 stopped_on_foot 00EE: actor [email protected] 0 near_point [email protected] [email protected] radius 50.0 50.0 in_carthen 00BC: show_text_highpriority GXT 'RREPAIR' time 1000 flag 1 // ~s~Come back between 9:00 and 17:00. 0633: AS_actor [email protected] exit_car endjump @fire:getAimPoint{Parameters: Passed: [email protected] - aiming range [email protected] - start point X [email protected] - start point Y [email protected] - start point Z Result: [email protected] - camera point X [email protected] - camera point Y [email protected] - camera point Z [email protected] - aim point X [email protected] - aim point Y [email protected] - aim point ZExample: 0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]}0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 4 store_to [email protected]: call_scm_func @getLocalVarOffset 2 thread [email protected] var 7 store_to [email protected]: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint [email protected] pCamera [email protected] fZ [email protected] fY [email protected] fX [email protected] fRange [email protected] // CCamera__Find3rdPersonCamTargetVector0AB2: ret 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]:getLocalVarOffset{Parameters: Passed: [email protected] - thread pointer [email protected] - var number Result: [email protected] - var valueExample: 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected]}[email protected] <> [email protected] *= 0x40A8E: [email protected] = [email protected] + 0xDC // mission flagif [email protected] == 1then [email protected] += 0xA48960 // mission localselse 005A: [email protected] += [email protected] [email protected] += [email protected] = 0end0AB2: ret 1 [email protected] CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Rocker453 Posted May 24, 2011 Author Share Posted May 24, 2011 Hmmm... I did a similar thing before to see where the aimpoint was. And i didn't know it was necessary to add 'wait' after a loop address. So thanks for telling that. Now I have some last questions... ahem ahem..: Is there a method/opcode to add offset to already stored coords. That way I can change the y-axis of the aimpoint. The animation GUN_STAND works for most weapons. But it does not work when you are running while aiming a weapon. (You can run while aiming with some weapons after reaching hitman level.) So what anim can I use for such weapons? This is relating to another mod of mine that I mentioned about in the first post. I want to know how I can get the handle of a police ped. There is a conditional opcode for police cars nearby but not for on-foot police. I actually want to add a feature to that mod that if a cop sees you doing 'something' then you get a wanted level. Link to comment Share on other sites More sharing options...
ZAZ Posted May 24, 2011 Share Posted May 24, 2011 (edited) Hmmm... I did a similar thing before to see where the aimpoint was. And i didn't know it was necessary to add 'wait' after a loop address. So thanks for telling that. Now I have some last questions... ahem ahem..: Is there a method/opcode to add offset to already stored coords. That way I can change the y-axis of the aimpoint. The animation GUN_STAND works for most weapons. But it does not work when you are running while aiming a weapon. (You can run while aiming with some weapons after reaching hitman level.) So what anim can I use for such weapons? This is relating to another mod of mine that I mentioned about in the first post. I want to know how I can get the handle of a police ped. There is a conditional opcode for police cars nearby but not for on-foot police. I actually want to add a feature to that mod that if a cop sees you doing 'something' then you get a wanted level. don't know how to make offsets to coords, i think you ask that because the aimpoint is mostly far away so i think you should use his whole script to get the LaserPoint and instead create_corona_at [email protected] [email protected] [email protected] get_random_actor at [email protected] [email protected] [email protected] with radius 2.0 or is random_actor near [email protected] [email protected] [email protected] radius 2.0 or calculating: substract laserpoint coords from actor position and then check if the result is smaller than 1.0 and bigger than -1.0 each for x,y,z something you should read: call_scm_function Catch random actor example script about aiming peds For the animation: Maybe it could be enough to check for the current weapon and the aimkeypress if and02D8: actor $PLAYER_ACTOR current_weapon == 3000E1: key_pressed 0 6jf @next but i tell you how to find animations use Ryosukes Animation Manager The animations are stored in *.ifp files One ifp file is the GTASA\anim\ped.ifp (GTASA\anim\anim.img is unused) the other ifp files are in gta3.img like colt45.ifp, python.ifp, rifle.ifp, tec.ifp, weapons.ifp import these and play these with Animation Manager and Deji provides a list of the animation names: List of animations in San Andreas Edited May 24, 2011 by ZAZ CLEO MODS CLEO Script Tutorial 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