gtaragemachine Posted May 23, 2009 Share Posted May 23, 2009 I always have been, still am, and always will be a simple hack when it comes to programming. I am just not made to fully get it. Nevertheless, I do love SA and have altered many an SCM script and CLEO script to make SA as fun as possible. I have asked in the past, and have noticed that others have also asked how to make CJ revive a ped like the Medics do. Sadly no one have come up with a solution or somehow I seem to have missed it. I would think it would be a great CLEO addition for CJ to be able to revive his homies if they die. Below I have used a foundation script of someone else's (I think it was a kissing a ped script) and tried to make it a script for reviving a dead ped. No surprise, it doesn't work. I would not bother this forum with this if I didn't think that other people wouldn't think this was a way cool idea. I sure hope someone can figure this out. Here's the lame attempt I had: {$CLEO .cs}thread 'REVIVE':REVIVE_1wait 0if and Player.Defined($PLAYER_CHAR) not Actor.Driving($PLAYER_ACTOR)else_jump @REVIVE_1if and00E1: player 0 pressed_key 17 00E1: player 0 pressed_key 19 Player.Controllable($PLAYER_CHAR)else_jump @REVIVE_1Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 1.0 handle_as [email protected] andnot [email protected] == -10118: actor [email protected] dead else_jump @REVIVE_1if 00F3: actor $PLAYER_ACTOR near_actor [email protected] radius 1.0 1.0 1.0 on_footelse_jump @REVIVE_900619: enable_actor [email protected] collision_detection 00619: enable_actor $PLAYER_ACTOR collision_detection 004ED: load_animation "MEDIC":REVIVE_30wait 0if04EE: animation "MEDIC" loadedelse_jump @REVIVE_30 0639: AS_actor $PLAYER_ACTOR rotate_to_actor [email protected]: AS_actor [email protected] rotate_to_actor $PLAYER_ACTOR0687: clear_actor_task $PLAYER_ACTOR0687: clear_actor_task [email protected]: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 1.0 0.002CE: [email protected] = ground_z_at [email protected] [email protected] [email protected]([email protected], [email protected], [email protected], [email protected])02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected]([email protected], [email protected], [email protected], [email protected])[email protected] = Actor.Angle($PLAYER_ACTOR)[email protected] += 180.0Actor.Angle([email protected]) = [email protected] 5000826: enable_hud 004C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 0.0 0.975 -0.9780395: clear_area 1 at [email protected] [email protected] [email protected] 3.001EB: set_traffic_density_to 0.003DE: set_pedestrians_density_multiplier_to 0.002A9: set_actor $PLAYER_ACTOR immune_to_nonplayer 102A9: set_actor [email protected] immune_to_nonplayer 102AB: set_actor [email protected] immunities 1 1 1 1 1 :REVIVE_60wait 00812: AS_actor [email protected] perform_animation "GETUP" IFP_file "PED" 4.0 loopA 1 lockX 0 lockY 0 lockF 1 time 0 // versionB 0812: AS_actor $PLAYER_ACTOR perform_animation "CPR" IFP_file "MEDIC" 4.0 loopA 1 lockX 0 lockY 0 lockF 1 time 0 // versionB wait 4000:REVIVE_9002EB: restore_camera_with_jumpcut0619: enable_actor [email protected] collision_detection 10619: enable_actor $PLAYER_ACTOR collision_detection 102A9: set_actor $PLAYER_ACTOR immune_to_nonplayer 002A9: set_actor [email protected] immune_to_nonplayer 002AB: set_actor [email protected] immunities 0 0 0 0 001EB: set_traffic_density_to 1.003DE: set_pedestrians_density_multiplier_to 1.00826: enable_hud 101B4: set_player $PLAYER_CHAR can_move 1Actor.RemoveReferences([email protected])jump @REVIVE_1 Link to comment Share on other sites More sharing options...
ZAZ Posted May 23, 2009 Share Posted May 23, 2009 (edited) The emergency revival is hardcoded. There is no opcode to handle a dead actor and I also dont know a memory adress. Dead actors are not valid for handling with mission coding. And I think the opcode 08E5: get_actor_in_sphere dont get a dead actor. The script below spawns an actor with weapon in Grovestreet. If he is dead he get health of 1000 and should make a animation. It doesnt work. The code stucks. The only chance which I see is to get the handle of all random peds in range of player Then get the health and prevent a dead. Then simulate a dead. But such a script will become very complex and isnt profitable. {$CLEO .cs}:DeadActor_103A4: name_thread 'Actor':DeadActor_20001: wait 0 ms00D6: if 00256: player $PLAYER_CHAR defined004D: jump_if_false @DeadActor_200D6: if 000FF: actor $PLAYER_ACTOR 1 (in-sphere)near_point_on_foot 2491.5 -1667.5 13.35 radius 1.0 1.0 1.0004D: jump_if_false @DeadActor_20247: request_model 1200247: request_model #AK47:DeadActor_50001: wait 0 ms00D6: if and0248: model 120 available0248: model #AK47 available004D: jump_if_false @DeadActor_5009A: [email protected] = create_actor 4 120 at 2486.5 -1664.5 13.450173: set_actor [email protected] z_angle_to 180.001B2: give_actor [email protected] weapon 30 ammo 99999 // Load the weapon model before using this02E2: set_actor [email protected] weapon_accuracy_to 1000223: set_actor [email protected] health_to 100005E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR0249: release_model 120:DeadActor_70001: wait 0 ms00D6: if 00256: player $PLAYER_CHAR defined004D: jump_if_false @DeadActor_2000D6: if 08118: NOT actor [email protected] dead004D: jump_if_false @DeadActor_1300D6: if 00104: actor $PLAYER_ACTOR near_actor [email protected] radius 80.0 80.0 10.0 sphere 0004D: jump_if_false @DeadActor_130002: jump @DeadActor_7:DeadActor_13//0001: wait 1000 ms0223: set_actor [email protected] health_to 10000001: wait 1000 ms05C9: AS_actor [email protected] on_guard 2000 ms0002: jump @DeadActor_7:DeadActor_2001C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian0002: jump @DeadActor_2 Edited May 23, 2009 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
CinthiaBarbie93 Posted May 4, 2018 Share Posted May 4, 2018 The emergency revival is hardcoded. There is no opcode to handle a dead actor and I also dont know a memory adress. Dead actors are not valid for handling with mission coding. And I think the opcode 08E5: get_actor_in_sphere dont get a dead actor. The script below spawns an actor with weapon in Grovestreet. If he is dead he get health of 1000 and should make a animation. It doesnt work. The code stucks. The only chance which I see is to get the handle of all random peds in range of player Then get the health and prevent a dead. Then simulate a dead. But such a script will become very complex and isnt profitable. CODE {$CLEO .cs} :DeadActor_1 03A4: name_thread 'Actor' :DeadActor_2 0001: wait 0 ms 00D6: if 0 0256: player $PLAYER_CHAR defined 004D: jump_if_false @DeadActor_2 00D6: if 0 00FF: actor $PLAYER_ACTOR 1 (in-sphere)near_point_on_foot 2491.5 -1667.5 13.35 radius 1.0 1.0 1.0 004D: jump_if_false @DeadActor_2 0247: request_model 120 0247: request_model #AK47 :DeadActor_5 0001: wait 0 ms 00D6: if and 0248: model 120 available 0248: model #AK47 available 004D: jump_if_false @DeadActor_5 009A: [email protected] = create_actor 4 120 at 2486.5 -1664.5 13.45 0173: set_actor [email protected] z_angle_to 180.0 01B2: give_actor [email protected] weapon 30 ammo 99999 // Load the weapon model before using this 02E2: set_actor [email protected] weapon_accuracy_to 100 0223: set_actor [email protected] health_to 1000 05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR 0249: release_model 120 :DeadActor_7 0001: wait 0 ms 00D6: if 0 0256: player $PLAYER_CHAR defined 004D: jump_if_false @DeadActor_20 00D6: if 0 8118: NOT actor [email protected] dead 004D: jump_if_false @DeadActor_13 00D6: if 0 0104: actor $PLAYER_ACTOR near_actor [email protected] radius 80.0 80.0 10.0 sphere 0 004D: jump_if_false @DeadActor_13 0002: jump @DeadActor_7 :DeadActor_13 //0001: wait 1000 ms 0223: set_actor [email protected] health_to 1000 0001: wait 1000 ms 05C9: AS_actor [email protected] on_guard 2000 ms 0002: jump @DeadActor_7 :DeadActor_20 01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian 0002: jump @DeadActor_2 Hi! will i could make the code: "not_near_actor" for establish that i wan't activate a script if the player its far of X actor Help me for this. Thank U Link to comment Share on other sites More sharing options...
Sanmodder Posted May 8, 2018 Share Posted May 8, 2018 (edited) I always have been, still am, and always will be a simple hack when it comes to programming. I am just not made to fully get it. Nevertheless, I do love SA and have altered many an SCM script and CLEO script to make SA as fun as possible. I have asked in the past, and have noticed that others have also asked how to make CJ revive a ped like the Medics do. Sadly no one have come up with a solution or somehow I seem to have missed it. I would think it would be a great CLEO addition for CJ to be able to revive his homies if they die. Below I have used a foundation script of someone else's (I think it was a kissing a ped script) and tried to make it a script for reviving a dead ped. No surprise, it doesn't work. I would not bother this forum with this if I didn't think that other people wouldn't think this was a way cool idea. I sure hope someone can figure this out. Here's the lame attempt I had: CODE {$CLEO .cs} thread 'REVIVE' :REVIVE_1 wait 0 if and Player.Defined($PLAYER_CHAR) not Actor.Driving($PLAYER_ACTOR) else_jump @REVIVE_1 if and 00E1: player 0 pressed_key 17 00E1: player 0 pressed_key 19 Player.Controllable($PLAYER_CHAR) else_jump @REVIVE_1 Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected]) 08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 1.0 handle_as [email protected] if and not [email protected] == -1 0118: actor [email protected] dead else_jump @REVIVE_1 if 00F3: actor $PLAYER_ACTOR near_actor [email protected] radius 1.0 1.0 1.0 on_foot else_jump @REVIVE_90 0619: enable_actor [email protected] collision_detection 0 0619: enable_actor $PLAYER_ACTOR collision_detection 0 04ED: load_animation "MEDIC" :REVIVE_30 wait 0 if 04EE: animation "MEDIC" loaded else_jump @REVIVE_30 0639: AS_actor $PLAYER_ACTOR rotate_to_actor [email protected] 0639: AS_actor [email protected] rotate_to_actor $PLAYER_ACTOR 0687: clear_actor_task $PLAYER_ACTOR 0687: clear_actor_task [email protected] 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 1.0 0.0 02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] Actor.StorePos([email protected], [email protected], [email protected], [email protected]) 02CE: [email protected] = ground_z_at [email protected] [email protected] [email protected] Actor.PutAt([email protected], [email protected], [email protected], [email protected]) [email protected] = Actor.Angle($PLAYER_ACTOR) [email protected] += 180.0 Actor.Angle([email protected]) = [email protected] wait 500 0826: enable_hud 0 04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset 0.0 0.975 -0.978 0395: clear_area 1 at [email protected] [email protected] [email protected] 3.0 01EB: set_traffic_density_to 0.0 03DE: set_pedestrians_density_multiplier_to 0.0 02A9: set_actor $PLAYER_ACTOR immune_to_nonplayer 1 02A9: set_actor [email protected] immune_to_nonplayer 1 02AB: set_actor [email protected] immunities 1 1 1 1 1 :REVIVE_60 wait 0 0812: AS_actor [email protected] perform_animation "GETUP" IFP_file "PED" 4.0 loopA 1 lockX 0 lockY 0 lockF 1 time 0 // versionB 0812: AS_actor $PLAYER_ACTOR perform_animation "CPR" IFP_file "MEDIC" 4.0 loopA 1 lockX 0 lockY 0 lockF 1 time 0 // versionB wait 4000 :REVIVE_90 02EB: restore_camera_with_jumpcut 0619: enable_actor [email protected] collision_detection 1 0619: enable_actor $PLAYER_ACTOR collision_detection 1 02A9: set_actor $PLAYER_ACTOR immune_to_nonplayer 0 02A9: set_actor [email protected] immune_to_nonplayer 0 02AB: set_actor [email protected] immunities 0 0 0 0 0 01EB: set_traffic_density_to 1.0 03DE: set_pedestrians_density_multiplier_to 1.0 0826: enable_hud 1 01B4: set_player $PLAYER_CHAR can_move 1 Actor.RemoveReferences([email protected]) jump @REVIVE_1 it can be done 1 peds have 100% health 2 check if the actor has 1% health and give him animations dead then he will lie down and will pretend then you come to him and resuscitate him and he really pretend to be dead look at my hack carl never dies even in the vehicle only he acts on the player in this way, he cheated hard coded xd {$ CLEO .cs}thread "pro_2":startwhile true wait 0 if Player.Defined (0) then if or 0741: actor $ PLAYER_ACTOR busted Actor.Dead ($ PLAYER_ACTOR) then break end endendActor.StorePos ($ PLAYER_ACTOR, 0 @, 1 @, 3 @)0362: remove_actor $ PLAYER_ACTOR from_car_and_place_at 0 @ 1 @ 3 @Actor.Health ($ PLAYER_ACTOR) = 25309C7: change_player $ PLAYER_CHAR model_to #NULLPlayer.Build ($ PLAYER_CHAR)0687: clear_actor $ PLAYER_ACTOR taskActor.StorePos ($ PLAYER_ACTOR, 0 @, 1 @, 3 @)Actor.PutAt ($ PLAYER_ACTOR, 0 @, 1 @, 3 @)wait 250while true wait 0 if and not Actor.Dead ($ PLAYER_ACTOR) not wasted_or_busted then goto @start endend Edited May 8, 2018 by Sanmodder 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