Jump to content

CJ is damaged when he is in the car.


Recommended Posts

Hi,

This is an idea for "CJ is damaged when he beats with the car".

The code doesn't work when CJ is in a car.

Help me, please!!!

 

004F: create_thread ££DAMAGE_1:DAMAGE_103A4: name_thread "DAMAGE":DAMAGE_20001: wait  0 ms00D6: if  10256:   player $PLAYER_CHAR defined00DF:   actor $PLAYER_ACTOR driving004D: jump_if_false ££DAMAGE_203C0: @0 = actor $PLAYER_ACTOR car0226: @39 = actor $PLAYER_ACTOR health0227: @36 = car @0 health:DAMAGE_50085: @37 = @36;; integer values and handles0001: wait  0 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££DAMAGE_700D6: if  000DB:   actor $PLAYER_ACTOR in_car @0004D: jump_if_false ££DAMAGE_700D6: if  08118:   NOT   actor $PLAYER_ACTOR dead004D: jump_if_false ££DAMAGE_500D6: if  003C9:   car @0 damaged004D: jump_if_false ££DAMAGE_5  000E: @36 -=  50;; integer values 0085: @38 = @37;; integer values and handles0062: @38 -= @36;; integer values 0066: @39 -= @38;; integer values:DAMAGE_701C3: remove_references_to_car @00002: jump ££DAMAGE_2

 

Edited by Wesser
Link to comment
https://gtaforums.com/topic/267917-cj-is-damaged-when-he-is-in-the-car/
Share on other sites

Your code shoulde be more like the following :

(I used your code as a basis although in Sanny Builder syntax this is untested and just a suggestion on an approach)

 

 

:DAMAGE_103A4: name_thread 'DAMAGE' :DAMAGE_20001: wait  200 ms00D6: if  10256:   is_player_playing $PLAYER_CHAR 00DF:   is_actor $PLAYER_ACTOR driving 004D: jump_if_false @DAMAGE_203C0: get_actor $PLAYER_ACTOR vehicle_handle_to 0@ 0226: get_actor $PLAYER_ACTOR health_to 9@ 0227: get_vehicle 0@ health_to 6@ :DAMAGE_50001: wait  100 ms00D6: if  10256:   is_player_playing $PLAYER_CHAR 8119:   not is_vehicle 0@ dead 004D: jump_if_false @DAMAGE_700D6: if  000DF:   is_actor $PLAYER_ACTOR driving 004D: jump_if_false @DAMAGE_700D6: if  08118:   not is_actor $PLAYER_ACTOR dead 004D: jump_if_false @DAMAGE_50227: get_vehicle 0@ health_to 5@00D6: if  0802D:   not  5@ >= 6@ // integer values 004D: jump_if_false @DAMAGE_5000C: 9@ -= 15 // integer values 0223: set_actor $PLAYER_ACTOR health_to 9@ :DAMAGE_701C3: mark_vehicle_as_no_longer_needed 0@0002: jump @DAMAGE_2

 

 

Not 100% sure on all the opcodes but i believe i have it pretty close

 

each time it loops if the health is lower in the second part than it was in the first part then the character recieves a little damage not very realistic but it could be better thought out and timed to seem more like it should be.

ph34r.gif

Edited by sleeper777

I have modified the line (000C) to make the most real script.

 

004F: create_thread ££DAMAGE_1:DAMAGE_103A4: name_thread 'DAMAGE':DAMAGE_20001: wait  200 ms00D6: if  10256:   player $PLAYER_CHAR defined00DF:   actor $PLAYER_ACTOR driving004D: jump_if_false ££DAMAGE_203C0: @0 = actor $PLAYER_ACTOR car0226: @9 = actor $PLAYER_ACTOR health0227: @6 = car @0 health:DAMAGE_50001: wait  100 ms00D6: if  10256:   player $PLAYER_CHAR defined8119:   NOT   car @0 wrecked004D: jump_if_false ££DAMAGE_700D6: if  000DF:   actor $PLAYER_ACTOR driving004D: jump_if_false ££DAMAGE_700D6: if  08118:   NOT   actor $PLAYER_ACTOR dead004D: jump_if_false ££DAMAGE_50227: @5 = car @0 health00D6: if  0802D:   NOT   @5 >= @6;; integer values004D: jump_if_false ££DAMAGE_5000C: 9@ -= 5 // integer values <--- 15 to 50223: set_actor $PLAYER_ACTOR health_to @9:DAMAGE_701C3: remove_references_to_car @0;; Like turning a car into any random car0002: jump ££DAMAGE_2

 

I have tried to modify the script but I don't succeed in making a release. Help me, please!

Edited by Wesser

you got caught in damage_5 loop. now it is just a hint. reverse you thinking for a moment and reconsider something like:

 

wait 250

all the checks needed in order to not allow the code to crash game (you do not need to 01C3 the car if you have not created it within this script)

get_car_health_to A

IF B>A hurt player

get_car_health_to B

jump at the begining

 

so it gets the reference B virtually 250ms in the past for present car health A. as more wait command you use in such a sniffer the more twisted the code becomes so actually reorganizing it a bit like that would be helpful.

 

 

Here is the code.

 

004F: create_thread ££DAMAGE_1:DAMAGE_103A4: name_thread 'DAMAGE':DAMAGE_20001: wait  200 ms00D6: if  10256:   player $PLAYER_CHAR defined00DF:   actor $PLAYER_ACTOR driving004D: jump_if_false ££DAMAGE_203C0: @0 = actor $PLAYER_ACTOR car0226: @9 = actor $PLAYER_ACTOR health0227: @6 = car @0 health:DAMAGE_50001: wait  100 ms00D6: if  100DF:   actor $PLAYER_ACTOR driving8118:   NOT   actor $PLAYER_ACTOR dead004D: jump_if_false ££DAMAGE_50227: @5 = car @0 health00D6: if  0801D:   NOT   @5 > @6 ;; integer values004D: jump_if_false ££DAMAGE_5000C: @9 -=  5 ;; integer values0223: set_actor $PLAYER_ACTOR health_to @90002: jump ££DAMAGE_2

 

ectually that is the way i was talking about. PM me if there is something unclear and i will answer. btw. you can still use old method of decreasing health instead of 0851.

 

 

:DAMAGE_20001: wait  250 ms00D6: if  10256:   player $PLAYER_CHAR defined00DF:   actor $PLAYER_ACTOR driving004D: jump_if_false ££DAMAGE_203C0: @0 = actor $PLAYER_ACTOR car0227: @6 = car @0 health00D6: if  0001D:   @5 > @6;; integer values004D: jump_if_false ££DAMAGE_30851: set_actor $PLAYER_ACTOR decrease_health_by  5  flag  1 :DAMAGE_30227: @5 = car @0 health0002: jump ££DAMAGE_2

 

 

now you realize that it is not ready code right? you have to consider all the things that can happen ie.: you get out of the car and it received damage- you will get hurt when you board it again, you get teleported from car and another part of script puts you in another vehicle... well that is up to you now.

Edited by PLPynton

 

 

 

Hi,

 

 

I like the idea, it is really realistic, and everyone around here knows that I like that.....

But don't you think that decreasing the same amoutn of health from the car to the player isn't very fair ? Well it is very easy to make it softer (50 health point off the car's health, 5 health point off the player's health), much easier than getting it to work, but I've no time to fix the thing, like making like PLPynton said last...

 

I got to say : People keep it up !!!!!!

 

 

Have fun

 

 

peoples you've got to see this. the most stupid mod i've ever did for SA

Movie 1 download (3.5MB)

Movie 2 download (1.5MB)

DivX codec required.

 

Edit: ok not that stupid i guess. i am gonna add airbags for more fun.

Edited by PLPynton

I have tried but i didn't work ...

I entered into a car ... and immediately the screen is shaking like there is an explosion nearby ...

after a while the screen stable biggrin.gif

I get out of the car and get in again

it started shake again biggrin.gif

may be it got conflicted with my codings

but I haven't try ur latest code

This is my coding for car lock and overspeeding check

the car will lock after you enter and unlock automatically when u get off

+ if u r overspeeding, u get one star

more overspeeding > two star

more and more overspeeding > three star

To unlock manutally while you are in a car, press HandBrake biggrin.gif

 


 

004f: create_thread ££labelcarpro

 

...

...

...

 

:Labelcarpro

0006: 3@ = 0

03A4: name_thread "LockIT"

0006: 16@ = 0

 

:Check

0001: wait 50 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££Check

00D6: if 0

0443: player $PLAYER_CHAR in_a_car

004D: jump_if_false ££Unlock

03C1: 4@ = player $PLAYER_CHAR car

020A: set car 4@ door_status_to 2

0006: 3@ = 1

02E3: 5@ = car 4@ speed

00D6: if 0

0021: 5@ > 20.0

004D: jump_if_false ££LockOpen

010E: set_player $PLAYER_CHAR minimum_wanted_level_to 1

00D6: if 0

0021: 5@ > 25.0

004D: jump_if_false ££LockOpen

010E: set_player $PLAYER_CHAR minimum_wanted_level_to 2

00D6: if 0

0021: 5@ > 35.0

004D: jump_if_false ££LockOpen

010E: set_player $PLAYER_CHAR minimum_wanted_level_to 3

 

:LockOpen

00D6: if 0

00E1: key_pressed 0 6

004D: jump_if_false ££Check

0039: 3@ == 1

0002: jump ££Unlock

 

:Unlock

0001: wait 50 ms

00D6: if 0

0039: 3@ == 1

004D: jump_if_false ££Check

00D6: if 0

8119: NOT car 4@ wrecked

004D: jump_if_false ££Remove

020A: set car 4@ door_status_to 1

0006: 3@ = 0

01C3: remove_references_to_car 4@

0002: jump ££Check

 

:Remove

0001: wait 50 ms

01C3: remove_references_to_car 4@

0002: jump ££Check

  • 2 weeks later...

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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