Jump to content

reverse check


Nabx3n

Recommended Posts

is there a way to make a reverse check for the car?

i tried this one:

 

:REVERSE_19wait 0 if   Actor.Driving($PLAYER_ACTOR)else_jump @REVERSE_19 03C0: 0@ = actor $PLAYER_ACTOR car 02E3: 1@ = car 0@ speedif and 1@ > 1.000E1:   player 0 pressed_key 4 else_jump @REVERSE_11306A2: get_car 0@ velocity_in_direction_XYZ 2@ 3@ 4@if not 3@ > -1.0jf @REVERSE_1130338: set_car 0@ visibility 0jump @REVERSE_19 :REVERSE_1130338: set_car 0@ visibility 1jump @REVERSE_19

 

 

but it seams like it only works when the car is heading to south as driving forward and backward.

 

is there a way to get that check to work properly? smile.gif

Link to comment
Share on other sites

Yeah, but it would be only CLEO 3 compatible. I don't think there is any other way to check if a car's reversing...

 

 

if   00DF:   actor $PLAYER_ACTOR drivingthen   03C0: 0@ = actor $PLAYER_ACTOR car   0AB8: get_vehicle 0@ current_gear_to 1@   if       1@ == 0	// reversing gear   then       02E3: 1@ = car 0@ speed       if           1@ > 1.0       then           // car is reversing       end   endend

 

Link to comment
Share on other sites

Sure, there is. Gas pedal float is located at CVehicle + 0x49C:

 

[...]if 00DF:  actor $PLAYER_ACTOR drivingthen 03C0: 0@ = actor $PLAYER_ACTOR car 0A97: 0@ = car 0@ struct 0@ += 0x49C  0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // fGasPedal if   1@ < 0  then   // car is reversing endend[...]

 

You do not need to check if vehicle isn't stopped, since that value is speed dependant. Just add 0x4 to get brake pedal float.

Link to comment
Share on other sites

thanks for the help guy but there is something i forgot to write there, is that i only use main.scm. cause i only mod the Xbox suicidal.gif

i'm sorry guys sad.gif

 

is there a way with main.scm?

Link to comment
Share on other sites

I modified @Deji's code to make it working correctly:

 

[...]if 00DF:  actor $PLAYER_ACTOR drivingthen 03C0: 0@ = actor $PLAYER_ACTOR car 0AB8: get_vehicle 0@ current_gear_to 1@  if    1@ == 0 // reversing gear then   if    00E1:  player 0 pressed_key 14    then     // car is reversing   end endend[...]

 

Link to comment
Share on other sites

When I worked on backlights for SA, I used that method which Wesser posted.

I think it is also possible with animation-check. There's place where animID stored, but after anim setting for car, game restores that value, and you can't catch it in SCM.

Link to comment
Share on other sites

He was talking about using pure SCM opcodes because of different game's platform. My first solution works as desired, though. tounge.gif

Link to comment
Share on other sites

I modified @Deji's code to make it working correctly:

 

[...]if 00DF:  actor $PLAYER_ACTOR drivingthen 03C0: 0@ = actor $PLAYER_ACTOR car 0AB8: get_vehicle 0@ current_gear_to 1@  if    1@ == 0 // reversing gear then   if    00E1:  player 0 pressed_key 14    then     // car is reversing   end endend[...]

 

 

 0AB8: get_vehicle 0@ current_gear_to 1@ 

 

 

notify.gif isn't that a cleo opcode? cause that could crash the game no?

 

 

When I worked on backlights for SA, I used that method which Wesser posted.

I think it is also possible with animation-check. There's place where animID stored, but after anim setting for car, game restores that value, and you can't catch it in SCM.

that's what im working on, backlights biggrin.gif

 

thought about the same thing, i checked it on the Banshee (test model) but i noticed the player doesn't do an animation while reversing. confused.gif

i dunno, maybe it depends on the driving skills or maybe cause he hada gun, but i was thinking about another method and i just can't write it correctly, something about storing coords from car for example 0.0 -8.0 0.0 and everytime the car gets a little closer to it lights turns on and there should be a check if the car got too close to it about radius 2.0 the coords will change position again, "0.0 -8.0 0.0" i feel like it's possible that way but i just kind get confused when i start on it barf8bd.gif

Link to comment
Share on other sites

Sorry for double-posting but I found out a R*'s style solution.

 

I think it is also possible with animation-check. There's place where animID stored, but after anim setting for car, game restores that value, and you can't catch it in SCM.

This issue happens only for player walkstyle animations. Look at the following script:

 

[...]if 00DF:  actor $PLAYER_ACTOR drivingthen if and 8611:  not actor $PLAYER_ACTOR performing_animation 'CAR_LB'  8611:  not actor $PLAYER_ACTOR performing_animation 'CAR_LB_pro'  8611:  not actor $PLAYER_ACTOR performing_animation 'CAR_LB_weak'  8611:  not actor $PLAYER_ACTOR performing_animation 'QUAD_reverse'  // Quad then   goto @IsNotPlayerReversing  end if and 8611:  not actor $PLAYER_ACTOR performing_animation 'BIKEd_pushes'  // Motocross 8611:  not actor $PLAYER_ACTOR performing_animation 'BIKEh_pushes'  // Chopper 8611:  not actor $PLAYER_ACTOR performing_animation 'BIKEs_pushes'  // Motorbike 8611:  not actor $PLAYER_ACTOR performing_animation 'BIKEv_pushes'  // Moped 8611:  not actor $PLAYER_ACTOR performing_animation 'BMX_pushes'    // BMX 8611:  not actor $PLAYER_ACTOR performing_animation 'CHOPPA_pushes' // Crossbike 8611:  not actor $PLAYER_ACTOR performing_animation 'MTB_pushes'    // Mountainbike 8611:  not actor $PLAYER_ACTOR performing_animation 'WF_pushes'     // Scooter then   goto @IsNotPlayerReversing  end if  00E1:  player 0 pressed_key 14  then   // car is reversing end :IsNotPlayerReversingend[...]

 

P.S. Only 8 conditions can be used, else the game returns always false.

 

I don't know if XBOX version can handle DMA but give it a try:

 

{$CLEO}0000: NOPconst TYPE_BYTE  = 1  TYPE_SHORT = 2  TYPE_DWORD = 4 endwhile true wait 0  if  00DF:  actor $PLAYER_ACTOR driving then   0@ = 0xB6F3B8 // Player's CVehicle   1@ = TYPE_DWORD   gosub @ReadMemVal    0@ += 0x49C // fGasPedal   1@ = TYPE_DWORD   gosub @ReadMemVal    if      0@ < 0.0    then     // vehicle is reversing   end endend:ReadMemVal0@ -= 0xA49960 0@ /= 0x4 008B: 0@ = &0(0@,1i)if and 1@ == 1 // BYTE 0@ > 0xFF then 0085: 1@ = 0@  1@ -= 0xFF  0062: 0@ -= 1@ else if and   1@ == 2 // WORD   0@ > 0xFFFF  then   0085: 1@ = 0@    1@ -= 0xFFFF    0062: 0@ -= 1@  else   if      1@ <> 4 // DWORD   then     0@ = 0    end endendreturn 

 

Edited by Wesser
Link to comment
Share on other sites

ok i tried the first idea and it's working well but it's just that for some cars that are set to "LOW" on their handling wich makes the player lower on the seat, he doesnt perform any animation, but its fixable smile.gif all i did is just change the car animation in vehicle.ide from null to kart.

 

and this is the script i used:

 

 

:REVERSELIGHTthread 'REVERSELIGHT' :REVERSELIGHT_19wait 0 if and  Actor.Driving($PLAYER_ACTOR)847A:   not actor $PLAYER_ACTOR driving_bike 84A7:   not actor $PLAYER_ACTOR driving_boat 84A9:   not actor $PLAYER_ACTOR driving_heli   not Actor.DrivingPlane($PLAYER_ACTOR)else_jump @REVERSELIGHT_19 03C0: 0@ = actor $PLAYER_ACTOR car 02E3: 1@ = car 0@ speed if and  Actor.Driving($PLAYER_ACTOR) 1@ > 0.1 00E1:   player 0 pressed_key 4 else_jump @REVERSELIGHT_205 if or  Actor.Animation($PLAYER_ACTOR) == "CAR_LB"  Actor.Animation($PLAYER_ACTOR) == "CAR_LB_PRO"  Actor.Animation($PLAYER_ACTOR) == "CAR_LB_WEAK"  Actor.Animation($PLAYER_ACTOR) == "DRIVE_TRUCK_BACK"else_jump @REVERSELIGHT_205 // lights turn onjump @REVERSELIGHT_19 :REVERSELIGHT_205// lights turn offjump @REVERSELIGHT_19

 

 

 

0000: NOP

 

const

TYPE_BYTE  = 1

TYPE_SHORT = 2

TYPE_DWORD = 4

end

 

while true

wait 0

if

00DF:  actor $PLAYER_ACTOR driving

then

   0@ = 0xB6F3B8 // Player's CVehicle

   1@ = TYPE_DWORD

   gosub @ReadMemVal

   0@ += 0x49C // fGasPedal

   1@ = TYPE_DWORD

   gosub @ReadMemVal

   if

     0@ < 0.0

   then

     // vehicle is reversing

   end

end

end

 

:ReadMemVal

0@ -= 0xA49960

0@ /= 0x4

008B: 0@ = &0(0@,1i)

if and

1@ == 1 // BYTE

0@ > 0xFF

then

0085: 1@ = 0@

1@ -= 0xFF

0062: 0@ -= 1@

else

if and

   1@ == 2 // WORD

   0@ > 0xFFFF

then

   0085: 1@ = 0@

   1@ -= 0xFFFF

   0062: 0@ -= 1@

else

   if

     1@ <> 4 // DWORD

   then

     0@ = 0

   end

end

end

return [/code]

 

and exactly how do you make main.scm read it? i don't even know from where the name should start notify.gif

 

should i add something above the code as for example

 

:test

thread 'test'

 

that? sorry i'm just not used to this kind of scripts blush.gif

 

edit:

ok i tried it in that way and when i compiled and tested it, nothing happend while reversing, and the code was translated to this

 

:TESTthread 'TEST' :TEST_11wait 0 if   Actor.Driving($PLAYER_ACTOR)jf @TEST_102 0@ = 11989944 1@ = 4 gosub @TEST_109 0@ += 1180 1@ = 4 gosub @TEST_109 if   not 0@ >= 0.0 jf @TEST_102 Camera.Shake(100):TEST_102jump @TEST_11 :TEST_1090@ -= 10787168 0@ /= 4 008B: 0@ = &0(0@,1i) // (int) if and 1@ == 1  0@ > 255 jf @TEST_195 0085: 1@ = 0@ // (int) 1@ -= 255 0062: 0@ -= 1@ // (int) jump @TEST_281 :TEST_195if and 1@ == 2  0@ > 65535 jf @TEST_256 0085: 1@ = 0@ // (int) 1@ -= 65535 0062: 0@ -= 1@ // (int) jump @TEST_281 :TEST_256if   not 1@ == 4 jf @TEST_281 0@ = 0 :TEST_281return 

 

is that how it's supposed to be? dontgetit.gif

Edited by nabnabnabn
Link to comment
Share on other sites

Too bad, it works on Windows platform. Perhaps you have a different version than 1.0 or XBOX one is totally different.

Link to comment
Share on other sites

Too bad, it works on Windows platform. Perhaps you have a different version than 1.0 or XBOX one is totally different.

dang confused.gif

ok then, atleast it works fine with the animation way. better than nothing colgate.gif

 

thanks guys smile.gif

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.