Jump to content

Removing actor from turret after being killed by player


Fenton

Recommended Posts

Hey guys, I wan't to remove a actor from turret if the actor has been killed by the player but the one problem, After i kill the actor, the actor still here not detached from the vehicle.

 

Here it is the script

 

EDIT : Sorry my mistake

 

wait 100
if
Actor.Dead(7@)
else_jump @NONAME_748
0407: store_coords_to 21@ 22@ 23@ from_car 0@ with_offset 1.3 0.0 1.2
Actor.StorePos(7@, 21@, 22@, 23@)
0465: remove_actor 7@ from_turret_mode
wait 1000
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(7@)
wait 30000
jump @NONAME_2
Edited by ALAN41
Link to comment
Share on other sites

You can also try to check, if his health is < 1. Maybe the turret option handles death differently.

Link to comment
Share on other sites

 

 

// This file was decompiled using SASCM.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP

:NONAME_2
wait 100
096A: enable_flying_helis 0
if
Player.Defined($PLAYER_CHAR)
else_jump @NONAME_2
if and
$ACTIVE_INTERIOR == 0
Player.WantedLevel($PLAYER_CHAR) > 2
else_jump @NONAME_2
jump @NONAME_58

:NONAME_58
wait 5000
Model.Load(#POLMAV)
Model.Load(#SWAT)
Model.Load(#MP5LNG)
if
Model.Load(#POLMAV)
Model.Available(#SWAT)
Model.Available(#MP5LNG)
else_jump @NONAME_58
038B: load_requested_models
jump @NONAME_113

:NONAME_113
wait 4000
04C4: store_coords_to 8@ 9@ 10@ from_actor $PLAYER_ACTOR with_offset 2.0 4.0 22.0
04D3: get_nearest_car_path_coords_from 8@ 9@ 10@ type 0 store_to 19@ 20@ 21@
0@ = Car.Create(#POLMAV, 19@, 20@, 10@)
Car.StorePos(0@, 1@, 2@, 3@)
0825: set_helicopter 0@ instant_rotor_start
0727: set_heli 0@ behavior_to_police_heli_and_follow_actor $PLAYER_ACTOR follow_car -1 radius 14.0
0129: 4@ = create_actor_pedtype 6 model #SWAT in_car 0@ driverseat
01C8: 5@ = create_actor_pedtype 6 model #SWAT in_car 0@ passenger_seat 0
6@ = Actor.Create(Cop, #SWAT, 1@, 2@, 3@)
7@ = Actor.Create(Cop, #SWAT, 1@, 2@, 3@)
17@ = Actor.Create(Cop, #SWAT, 1@, 2@, 3@)
18@ = Actor.Create(Cop, #SWAT, 1@, 2@, 3@)
01B2: give_actor 6@ weapon 29 ammo 9999 // Load the weapon model before using this
01B2: give_actor 7@ weapon 29 ammo 9999 // Load the weapon model before using this
01B2: give_actor 17@ weapon 29 ammo 9999 // Load the weapon model before using this
01B2: give_actor 18@ weapon 29 ammo 9999 // Load the weapon model before using this
Actor.WeaponAccuracy(6@) = 45
Actor.WeaponAccuracy(7@) = 45
Actor.WeaponAccuracy(17@) = 45
Actor.WeaponAccuracy(18@) = 45
0464: put_actor 6@ into_turret_on_car 0@ at_car_offset 1.4 1.3 -0.1 position 3 shooting_angle_limit 190.0 with_weapon 29
0350: set_actor 6@ maintain_position_when_attacked 1
04EB: AS_actor 6@ crouch 1
0464: put_actor 7@ into_turret_on_car 0@ at_car_offset 1.4 -0.8 -0.1 position 3 shooting_angle_limit 190.0 with_weapon 29
0350: set_actor 7@ maintain_position_when_attacked 1
04EB: AS_actor 7@ crouch 1
0464: put_actor 17@ into_turret_on_car 0@ at_car_offset -1.4 1.3 -0.1 position 1 shooting_angle_limit 190.0 with_weapon 29
0350: set_actor 17@ maintain_position_when_attacked 1
04EB: AS_actor 17@ crouch 1
0464: put_actor 18@ into_turret_on_car 0@ at_car_offset -1.4 -0.8 -0.1 position 1 shooting_angle_limit 190.0 with_weapon 29
0350: set_actor 18@ maintain_position_when_attacked 1
04EB: AS_actor 18@ crouch 1
07A5: AS_actor 6@ attack_actor $PLAYER_ACTOR 999999 ms
07A5: AS_actor 7@ attack_actor $PLAYER_ACTOR 999999 ms
07A5: AS_actor 18@ attack_actor $PLAYER_ACTOR 999999 ms
07A5: AS_actor 17@ attack_actor $PLAYER_ACTOR 999999 ms

:NONAME_572
wait 100
if
Actor.Dead(4@)
else_jump @NONAME_661
Car.Health(0@) = 0
0564: heli 0@ simulate_crash_landing
0465: remove_actor 6@ from_turret_mode
0465: remove_actor 7@ from_turret_mode
0465: remove_actor 17@ from_turret_mode
0465: remove_actor 18@ from_turret_mode
Model.Destroy(#POLMAV)
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(4@)
Actor.RemoveReferences(5@)
Actor.RemoveReferences(6@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(17@)
Actor.RemoveReferences(18@)
wait 30000
jump @NONAME_2

:NONAME_661
wait 100
if or
02BF: car 0@ sunk
Car.Wrecked(0@)
else_jump @NONAME_748
0465: remove_actor 6@ from_turret_mode
0465: remove_actor 7@ from_turret_mode
0465: remove_actor 17@ from_turret_mode
0465: remove_actor 18@ from_turret_mode
Model.Destroy(#POLMAV)
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Car.RemoveReferences(0@)
Actor.RemoveReferences(4@)
Actor.RemoveReferences(5@)
Actor.RemoveReferences(6@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(17@)
Actor.RemoveReferences(18@)
wait 30000
jump @NONAME_2

:NONAME_748
wait 100
if or
8202: not actor $PLAYER_ACTOR near_car 0@ radius 110.0 110.0 flag 0
not Player.WantedLevel($PLAYER_CHAR) > 2
not $ACTIVE_INTERIOR == 0
else_jump @NONAME_975
04C4: store_coords_to 14@ 15@ 16@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 90.0
04A2: set_heli 0@ fly_to 14@ 15@ 16@ altitude_between 0.0 and 16@
Car.SetImmunities(0@, 0, 0, 0, 0, 0)
//0407: store_coords_to 21@ 22@ 23@ from_car 0@ with_offset 1.3 0.0 1.2
//Actor.StorePos(6@, 21@, 22@, 23@)
//Actor.DestroyInstantly(6@)
//0503: create_actor_on_rope_with_pedtype 24 model #SWAT at 21@ 22@ 23@ handle_as 6@
//Actor.StorePos(7@, 21@, 22@, 23@)
//Actor.DestroyInstantly(7@)
//0503: create_actor_on_rope_with_pedtype 24 model #SWAT at 21@ 22@ 23@ handle_as 7@
//Actor.StorePos(17@, 21@, 22@, 23@)
//Actor.DestroyInstantly(17@)
//503: create_actor_on_rope_with_pedtype 24 model #SWAT at 21@ 22@ 23@ handle_as 17@
//Actor.StorePos(18@, 21@, 22@, 23@)
//Actor.DestroyInstantly(18@)
//0503: create_actor_on_rope_with_pedtype 24 model #SWAT at 21@ 22@ 23@ handle_as 18@
//wait 1000
//01B2: give_actor 6@ weapon 29 ammo 9999 // Load the weapon model before using this
//01B2: give_actor 7@ weapon 29 ammo 9999 // Load the weapon model before using this
//01B2: give_actor 17@ weapon 29 ammo 9999 // Load the weapon model before using this
//01B2: give_actor 18@ weapon 29 ammo 9999 // Load the weapon model before using this
wait 10000
Model.Destroy(#POLMAV)
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Car.RemoveReferences(0@)
Actor.RemoveReferences(4@)
Actor.RemoveReferences(5@)
Actor.RemoveReferences(6@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(17@)
Actor.RemoveReferences(18@)
jump @NONAME_2

wait 100
if
Actor.Dead(6@)
else_jump @NONAME_748
0465: remove_actor 6@ from_turret_mode
wait 1000
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(6@)
wait 30000
jump @NONAME_2

wait 100
if
Actor.Dead(7@)
else_jump @NONAME_748
0465: remove_actor 7@ from_turret_mode
wait 1000
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(7@)
wait 30000
jump @NONAME_2

wait 100
if
Actor.Dead(17@)
else_jump @NONAME_748
0465: remove_actor 17@ from_turret_mode
wait 1000
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(17@)
wait 30000
jump @NONAME_2

wait 100
if
Actor.Dead(18@)
else_jump @NONAME_748
0465: remove_actor 18@ from_turret_mode
wait 1000
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Actor.RemoveReferences(18@)
wait 30000
jump @NONAME_2

:NONAME_975
wait 100
if
Actor.InCar($PLAYER_ACTOR, 0@)
else_jump @NONAME_1177
00BB: show_text_lowpriority GXT 'P' time 5000 flag 1
0221: set_player $PLAYER_CHAR trapped_in_car 1
0508: car 0@ close_all_doors
Car.LockInCurrentPosition(0@) = True
0465: remove_actor 6@ from_turret_mode
0465: remove_actor 7@ from_turret_mode
0465: remove_actor 17@ from_turret_mode
0465: remove_actor 18@ from_turret_mode
0825: set_helicopter 0@ instant_rotor_start
Car.SetMaxSpeed(0@, 120.0)
020B: explode_car 0@ // versionA
0221: set_player $PLAYER_CHAR trapped_in_car 0
wait 1000
Model.Destroy(#POLMAV)
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
Car.RemoveReferences(0@)
Actor.RemoveReferences(4@)
Actor.RemoveReferences(5@)
Actor.RemoveReferences(6@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(17@)
Actor.RemoveReferences(18@)
wait 10000
jump @NONAME_2

:NONAME_1177
wait 100
if or
Actor.Dead($PLAYER_ACTOR)
0741: actor $PLAYER_ACTOR busted
else_jump @NONAME_572
Player.WantedLevel($PLAYER_CHAR) = 0
wait 100
Car.Destroy(0@)
Car.RemoveReferences(0@)
Actor.RemoveReferences(4@)
Actor.RemoveReferences(5@)
Actor.RemoveReferences(6@)
Actor.RemoveReferences(7@)
Actor.RemoveReferences(17@)
Actor.RemoveReferences(18@)
Model.Destroy(#POLMAV)
Model.Destroy(#MP5LNG)
Model.Destroy(#SWAT)
wait 10000
jump @NONAME_2

Edited by ALAN41
Link to comment
Share on other sites

you asked why this scriptblock don't work

 

wait 100ifActor.Dead(7@)else_jump @NONAME_7480407: store_coords_to 21@ 22@ 23@ from_car 0@ with_offset 1.3 0.0 1.2Actor.StorePos(7@, 21@, 22@, 23@)0465: remove_actor 7@ from_turret_modewait 1000Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Actor.RemoveReferences(7@)wait 30000jump @NONAME_2
it don't work because it will not be read

 

your whole script have jump to label NONAME_2 befor your scriptblocks

 

Model.Destroy(#POLMAV)Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Car.RemoveReferences(0@)Actor.RemoveReferences(4@)Actor.RemoveReferences(5@)Actor.RemoveReferences(6@)Actor.RemoveReferences(7@)Actor.RemoveReferences(17@)Actor.RemoveReferences(18@)jump @NONAME_2 <----------------------- here it jumps to label NONAME_2 and the rest below will not be readwait 100ifActor.Dead(6@)else_jump @NONAME_7480465: remove_actor 6@ from_turret_modewait 1000Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Actor.RemoveReferences(6@)wait 30000jump @NONAME_2wait 100ifActor.Dead(7@)else_jump @NONAME_7480465: remove_actor 7@ from_turret_modewait 1000Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Actor.RemoveReferences(7@)wait 30000jump @NONAME_2wait 100ifActor.Dead(17@)else_jump @NONAME_7480465: remove_actor 17@ from_turret_modewait 1000Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Actor.RemoveReferences(17@)wait 30000jump @NONAME_2wait 100ifActor.Dead(18@)else_jump @NONAME_7480465: remove_actor 18@ from_turret_modewait 1000Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Actor.RemoveReferences(18@)wait 30000jump @NONAME_2:NONAME_975wait 100if   Actor.InCar($PLAYER_ACTOR, 0@)else_jump @NONAME_117700BB: show_text_lowpriority GXT 'P' time 5000 flag 10221: set_player $PLAYER_CHAR trapped_in_car 10508: car 0@ close_all_doorsCar.LockInCurrentPosition(0@) = True0465: remove_actor 6@ from_turret_mode0465: remove_actor 7@ from_turret_mode0465: remove_actor 17@ from_turret_mode0465: remove_actor 18@ from_turret_mode0825: set_helicopter 0@ instant_rotor_startCar.SetMaxSpeed(0@, 120.0)020B: explode_car 0@ // versionA0221: set_player $PLAYER_CHAR trapped_in_car 0wait 1000Model.Destroy(#POLMAV)Model.Destroy(#MP5LNG)Model.Destroy(#SWAT)Car.RemoveReferences(0@)Actor.RemoveReferences(4@)Actor.RemoveReferences(5@)Actor.RemoveReferences(6@)Actor.RemoveReferences(7@)Actor.RemoveReferences(17@)Actor.RemoveReferences(18@)wait 10000jump @NONAME_2
gave it up and learn first coding by writing own simple scripts
Link to comment
Share on other sites

It works for first gunner, But it won't works for second gunner, I've remove third and fourth gunner from the script

 

EDIT : Working properly for now, Thanks anyway

Edited by ALAN41
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.