Jump to content

Cautious Traffic Drivers


Rocker453

Recommended Posts

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 tounge.gif)

 

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! colgate.gif

 

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: 10@ = actor $PLAYER_ACTOR car                                                  0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 15@ closest_ped_to 23@if or   not Car.Defined(15@)    0965:   actor $PLAYER_ACTOR swimming   0045:   15@ == 10@ // (float) then  jump @Variablesend020A: set_car 15@ door_status_to 7Car.RemoveReferences(15@)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 by Rocker453
Link to comment
Share on other sites

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: 10@ = actor $PLAYER_ACTOR car

 

 

and furthermore you don't need to check if the player_car could be the closest_vehicle

 

   0045:   15@ == 10@ // (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 15@ closest_ped_to 23@wait 0   if   Car.Defined(15@)   then       020A: set_car 15@ door_status_to 7       Car.RemoveReferences(15@)   endjump @Variables

 

Link to comment
Share on other sites

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: 10@ = actor $PLAYER_ACTOR car

 

 

0045:   15@ == 10@ // (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 15@ closest_ped_to 23@if or   not Car.Defined(15@)    0965:   actor $PLAYER_ACTOR swimming then  jump @Variablesend046C: 0@ = car 15@ driverif   Actor.Defined(0@)then   020A: set_car 15@ door_status_to 7   jump @Jackingendjump @Variables:Jackingwait 0if   not Actor.Defined(0@)then   jump @Variablesend   if or   0496:   tire 1 on_car 15@ deflated   0496:   tire 2 on_car 15@ deflated    0496:   tire 3 on_car 15@ deflated    0496:   tire 4 on_car 15@ deflated then   0633: AS_actor 0@ exit_carendCar.RemoveReferences(15@)Actor.RemoveReferences(0@)                        jump @Variables

 

 

Is there anything wrong now?

Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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! colgate.gif

 

Link to comment
Share on other sites

 

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! colgate.gif

 

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<

Link to comment
Share on other sites

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 20@ closest_ped_to 21@   jump @DEFINEDendjump @fire:DEFINEDwait 00470: 0@ = actor $PLAYER_ACTOR current_weapon0@ *= 0x700@ += 0xC8AAB80@ += 0x80A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@if   not Actor.Defined(21@)then   jump @fireendActor.StorePos(21@, 31@, 32@, 33@)wait 0if and   Actor.Animation($PLAYER_ACTOR) == "Gun_stand"   00F0:   actor $PLAYER_ACTOR 0 near_point 31@ 32@ radius 4.0 4.0 stopped_on_foot    00EE:   actor 21@ -1 near_point 7@ 8@ 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 21@ exit_car     endjump @fire:getAimPoint{Parameters:  Passed:    0@ - aiming range    1@ - start point X    2@ - start point Y    3@ - start point Z  Result:    4@ - camera point X    5@ - camera point Y    6@ - camera point Z    7@ - aim point X    8@ - aim point Y    9@ - aim point ZExample:  0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@}0A9F: 10@ = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 4 store_to 11@0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 7 store_to 12@0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 12@ pCamera 11@ fZ 3@ fY 2@ fX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@ :getLocalVarOffset{Parameters:  Passed:    0@ - thread pointer    1@ - var number  Result:    1@ - var valueExample:  0AB1: call_scm_func @getLocalVarOffset 2 thread 0@ var 0 store_to 1@}if0@ <> 0then1@ *= 0x40A8E: 2@ = 0@ + 0xDC // mission flagif  2@ == 1then  1@ += 0xA48960 // mission localselse  005A: 1@ += 0@  1@ += 0x3Cendelse1@ = 0end0AB2: ret 1 1@ 

 

 

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 by Rocker453
Link to comment
Share on other sites

 

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 20@ closest_ped_to 21@  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 7@ 8@ 9@ radius 1.5 type 1 flare 0 RGB 150 0 255//PINK

04D5: create_corona_at 31@ 32@ 33@ 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 20@ closest_ped_to 21@  jump @DEFINEDendjump @fire:DEFINED0470: 0@ = actor $PLAYER_ACTOR current_weapon0@ *= 0x700@ += 0xC8AAB80@ += 0x80A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@04D5: create_corona_at 7@ 8@ 9@ radius 1.5 type 1 flare 0 RGB 150  0  255//PINKif  not Actor.Defined(21@)then  jump @fireendActor.StorePos(21@, 31@, 32@, 33@)04D5: create_corona_at 31@ 32@ 33@ 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 31@ 32@ radius 4.0 4.0 stopped_on_foot  00EE:   actor 21@ 0 near_point 7@ 8@ 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 21@ exit_car    endjump @fire:getAimPoint{Parameters: Passed:   0@ - aiming range   1@ - start point X   2@ - start point Y   3@ - start point Z Result:   4@ - camera point X   5@ - camera point Y   6@ - camera point Z   7@ - aim point X   8@ - aim point Y   9@ - aim point ZExample: 0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@}0A9F: 10@ = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 4 store_to 11@0AB1: call_scm_func @getLocalVarOffset 2 thread 10@ var 7 store_to 12@0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 12@ pCamera 11@ fZ 3@ fY 2@ fX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@:getLocalVarOffset{Parameters: Passed:   0@ - thread pointer   1@ - var number Result:   1@ - var valueExample: 0AB1: call_scm_func @getLocalVarOffset 2 thread 0@ var 0 store_to 1@}if0@ <> 0then1@ *= 0x40A8E: 2@ = 0@ + 0xDC // mission flagif 2@ == 1then 1@ += 0xA48960 // mission localselse 005A: 1@ += 0@ 1@ += 0x3Cendelse1@ = 0end0AB2: ret 1 1@

 

Link to comment
Share on other sites

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

 

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 10@ 11@ 12@

get_random_actor at 10@ 11@ 12@ with radius 2.0 or is random_actor near 10@ 11@ 12@ 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 by ZAZ
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.