CLEO Help AS actor exit car crash?

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
Hi Im just experimenting with this script to put on my script to make it a bit better i have made it so an actor spawns on a bike nearby and drives to you but you have a camera on him so you know he is coming but when he comes and stops the game crashes. I'm sure its the "AS actor exit car" code because i added a wait before that and it crashed after wait.


This is the code.

Code:
:TERMABK
wait 0 
if 
00F1:   actor 18@ sphere 0 near_point 10@ 11@ 12@ radius 10.0 10.0 10.0 stopped_in_car
 
jf @TERMABK

:ACTORSPAWN
wait 0
015A: restore_camera
0633: AS_actor 18@ exit_car  
Actor.Health(18@) = 500
Actor.SetImmunities(18@, 1, 1, 1, 1, 1)
Actor.GiveWeaponAndAmmo(18@, Shotgun, 99999)
Actor.WeaponAccuracy(18@) = 300
07DD: set_actor 18@ attack_rate 300 // previously known as temper_to
07AF: $terminator = player $PLAYER_CHAR group 
0630: put_actor $PLAYER_ACTOR in_group $bodyguard as_leader
0631: put_actor 18@ in_group $bodyguard
jump @THREATLIST
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
07AF: $terminator = player $PLAYER_CHAR group
0630: put_actor $PLAYER_ACTOR in_group $bodyguard as_leader
0631: put_actor 18@ in_group $bodyguard

=>>

07AF: $terminator = player $PLAYER_CHAR group
0630: put_actor $PLAYER_ACTOR in_group $terminator as_leader
0631: put_actor 18@ in_group $terminator
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
Well i fixed those problems but i think its this part of the script.

Code:
:THREATS
   Actor.Model(9@) == #LAPD1
   Actor.Model(9@) == #SFPD1
   Actor.Model(9@) == #LVPD1
   Actor.Model(9@) == #CSHER
   Actor.Model(9@) == #LAPDM1
   Actor.Model(9@) == #SWAT
   Actor.Model(9@) == #FBI
   Actor.Model(9@) == #ARMY
   Actor.Model(9@) == #DSHER
   Actor.Model(9@) == #BALLAS1
   Actor.Model(9@) == #BALLAS2
   Actor.Model(9@) == #BALLAS3
   Actor.Model(9@) == #LSV1
   Actor.Model(9@) == #LSV2
   Actor.Model(9@) == #LSV3
   Actor.Model(9@) == #DNB1
   Actor.Model(9@) == #DNB2
   Actor.Model(9@) == #DNB3

or this

Code:
:Noname_348
wait 0 
if 
00F1:   actor 18@ sphere 0 near_point 10@ 11@ 12@ radius 12.0 12.0 stopped_in_car 
else_jump @Noname_348
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
Model.Load(#BMYBOUN)
Model.Load(#CHROMEGUN)
Model.Load(#FREEWAY)
Model.Load(#LAPD1)
Model.Load(#SFPD1)
Model.Load(#LVPD1)
Model.Load(#CSHER)
Model.Load(#LAPDM1)
Model.Load(#SWAT)
Model.Load(#FBI)
Model.Load(#ARMY)
Model.Load(#DSHER)
Model.Load(#BALLAS1)
Model.Load(#BALLAS2)
Model.Load(#BALLAS3)
Model.Load(#LSV1)
Model.Load(#LSV2)
Model.Load(#LSV3)
Model.Load(#DNB1)
Model.Load(#DNB2)
Model.Load(#DNB3) 
jump @Noname_22 

:Noname_22
   Model.Available(#BMYBOUN)
   Model.Available(#CHROMEGUN)
   Model.Available(#FREEWAY)
   Model.Available(#LAPD1)
   Model.available(#SFPD1)
   Model.available(#LVPD1)
   Model.available(#CSHER)
   Model.available(#LAPDM1)
   Model.available(#SWAT)
   Model.available(#FBI)
   Model.available(#ARMY)
   Model.available(#DSHER)
   Model.available(#BALLAS1)
   Model.available(#BALLAS2)
   Model.available(#BALLAS3)
   Model.available(#LSV1)
   Model.available(#LSV2)
   Model.available(#LSV3)
   Model.available(#DNB1)
   Model.available(#DNB2)
   Model.available(#DNB3) 
038B: load_requested_models 
else_jump @Noname_22



:Noname_46
wait 0 
if 
0ADC:   test_cheat "DEPLOY" 
else_jump @Noname_46 
0ACD: show_text_highpriority "A terminator has been dispatched to your location" time 5000 
018C: play_sound 1052 at 0.0 0.0 0.0 
wait 0 
04C4: store_coords_to 30@ 31@ 32@ from_actor $PLAYER_ACTOR with_offset 50.0 0.0 5.0 
02C1: store_to 30@ 31@ 32@ car_path_coords_closest_to 30@ 31@ 32@ 
04C4: store_coords_to 23@ 24@ 25@ from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.0 
Actor.StorePos($PLAYER_ACTOR, 10@, 11@, 12@)
4@ = Car.Create(#FREEWAY, 30@, 31@, 32@)
00AE: set_car 4@ traffic_behaviour_to 2 
0423: set_car 4@ improved_handling_to 2.0 // (float) 
03CC: enable_car 4@ stuck_check_distance_to 2.0 time_to 2000 
18@ = Actor.CreateAsDriver(Mission1, #BMYBOUN, 4@)
Car.DriveTo(4@, 23@, 24@, 25@)
Car.SetMaxSpeed(4@, 50.0)
wait 1200 
Camera.OnVehicle(4@, 18, 2)
jump @Noname_348 

:Noname_348
wait 0 
if 
00F1:   actor 18@ sphere 0 near_point 10@ 11@ 12@ radius 12.0 12.0 stopped_in_car 
else_jump @Noname_348 

:Noname_384
wait 0 
Camera.Restore
0633: AS_actor 18@ exit_car  
Actor.Health(18@) = 500
Actor.SetImmunities(18@, 1, 1, 1, 1, 1)
Actor.GiveWeaponAndAmmo(18@, 25, 99999)
Actor.WeaponAccuracy(18@) = 300
07DD: set_actor 18@ attack_rate 300 // previously known as temper_to 
07AF: $terminator = player $PLAYER_CHAR group 
0630: put_actor $PLAYER_ACTOR in_group $terminator as_leader 
0631: put_actor 18@ in_group $terminator 
jump @Noname_484 

:Noname_484
wait 0 
if 
00EC:   actor 9@ sphere 0 near_point 10@ 11@ 12@ radius 10.0 10.0
else_jump @Noname_484 
05E2: AS_actor 18@ kill_actor 9@ 
jump @Noname_484
   
   
:VEHCHECK   
wait 0 
if 
   Actor.Driving($PLAYER_ACTOR)
$car = Actor.CurrentCar($PLAYER_ACTOR)
036A: put_actor 18@ in_car $car 
0501: set_player 18@ driveby_mode 1 
jump @Noname_713 

:Noname_713
wait 0 
if 
   Actor.Driving($PLAYER_ACTOR)
0AA0: gosub_if_false @Noname_733 

:Noname_733
wait 0 
0501: set_player $PLAYER_CHAR driveby_mode 0
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
The problem was in label Noname_484, there is no actor 9@.
00EC:  actor 9@ sphere 0 near_point 10@ 11@ 12@ radius 10.0 10.0
else_jump @Noname_484
05E2: AS_actor 18@ kill_actor 9@

Here's the script fixed:
Code:
{$CLEO .cs}

Model.Load(#BMYBOUN)
Model.Load(#CHROMEGUN)
Model.Load(#FREEWAY)
Model.Load(#LAPD1)
Model.Load(#SFPD1)
Model.Load(#LVPD1)
Model.Load(#CSHER)
Model.Load(#LAPDM1)
Model.Load(#SWAT)
Model.Load(#FBI)
Model.Load(#ARMY)
Model.Load(#DSHER)
Model.Load(#BALLAS1)
Model.Load(#BALLAS2)
Model.Load(#BALLAS3)
Model.Load(#LSV1)
Model.Load(#LSV2)
Model.Load(#LSV3)
Model.Load(#DNB1)
Model.Load(#DNB2)
Model.Load(#DNB3) 
038B: load_requested_models 

:Noname_46
wait 0 
if 
0ADC:   test_cheat "DEPLOY" 
else_jump @Noname_46 
0ACD: show_text_highpriority "A terminator has been dispatched to your location" time 5000 
018C: play_sound 1052 at 0.0 0.0 0.0 
04C4: store_coords_to 30@ 31@ 32@ from_actor $PLAYER_ACTOR with_offset 50.0 0.0 5.0 
02C1: store_to 30@ 31@ 32@ car_path_coords_closest_to 30@ 31@ 32@ 
04C4: store_coords_to 23@ 24@ 25@ from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.0 
Actor.StorePos($PLAYER_ACTOR, 10@, 11@, 12@)
4@ = Car.Create(#FREEWAY, 30@, 31@, 32@)
00AE: set_car 4@ traffic_behaviour_to 2 
0423: set_car 4@ improved_handling_to 2.0 // (float) 
03CC: enable_car 4@ stuck_check_distance_to 2.0 time_to 2000 
18@ = Actor.CreateAsDriver(Mission1, #BMYBOUN, 4@)
Car.DriveTo(4@, 23@, 24@, 25@)
Car.SetMaxSpeed(4@, 50.0)
wait 1200 
Camera.OnVehicle(4@, 18, 2)
jump @Noname_348 

:Noname_348
wait 0 
if 
00F1:   actor 18@ sphere 0 near_point 10@ 11@ 12@ radius 12.0 12.0 stopped_in_car 
else_jump @Noname_348 

:Noname_384
wait 0 
Camera.Restore
0633: AS_actor 18@ exit_car  
Actor.Health(18@) = 500
Actor.SetImmunities(18@, 1, 1, 1, 1, 1)
Actor.GiveWeaponAndAmmo(18@, 25, 99999)
Actor.WeaponAccuracy(18@) = 300
07DD: set_actor 18@ attack_rate 300 // previously known as temper_to    
07AF: $terminator = player $PLAYER_CHAR group 
0630: put_actor $PLAYER_ACTOR in_group $terminator as_leader 
0631: put_actor 18@ in_group $terminator 
jump @Noname_46
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
Well it works but the thing is  the guy that spawns is shit so i wanted to add a function where he has specific targets (most people that can hurt you)

like this.

Code:
:THREATS
   Actor.Model(9@) == #LAPD1
   Actor.Model(9@) == #SFPD1
   Actor.Model(9@) == #LVPD1
   Actor.Model(9@) == #CSHER
   Actor.Model(9@) == #LAPDM1
   Actor.Model(9@) == #SWAT
   Actor.Model(9@) == #FBI
   Actor.Model(9@) == #ARMY
   Actor.Model(9@) == #DSHER
   Actor.Model(9@) == #BALLAS1
   Actor.Model(9@) == #BALLAS2
   Actor.Model(9@) == #BALLAS3
   Actor.Model(9@) == #LSV1
   Actor.Model(9@) == #LSV2
   Actor.Model(9@) == #LSV3
   Actor.Model(9@) == #DNB1
   Actor.Model(9@) == #DNB2
   Actor.Model(9@) == #DNB3 



:Noname_23
wait 0
if
00EC:   actor 9@ sphere 0 near_point 10@ 11@ 12@ radius 10.0 10.0
else_jump @Noname_23
gosub @THREATS
05E2: AS_actor 18@ kill_actor 9@

but that seems to not work
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 50.0 find_next 0 pass_deads 1
if or
Actor.Model(9@) == #LVPD01
Actor.Model(9@) == #BALLAS1
// ...
jf [member=23507]Label[/member]
05E2: AS_actor 18@ kill_actor 9@
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
1 Problem i can't have more then 8 models or conditions as the compiler says any fix for this?
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
Check like this:
Code:
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 50.0 find_next 0 pass_deads 1

:1
wait 0
if or
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #BALLAS4
Actor.Model(9@) == #BALLAS5
Actor.Model(9@) == #BALLAS6
Actor.Model(9@) == #BALLAS7
Actor.Model(9@) == #BALLAS8
jf @2
goto @KILL

:2
wait 0
if or
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3
Actor.Model(9@) == #LSV4
Actor.Model(9@) == #LSV5
Actor.Model(9@) == #LSV6
Actor.Model(9@) == #LSV7
Actor.Model(9@) == #LSV8
jf @etc
goto @KILL

:KILL
05E2: AS_actor 18@ kill_actor 9@
goto @MAIN
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
Those targets models are seem to be useless because the ped that spawns just kills everyone not the specific people

Code:
:Noname_23
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 50.0 find_next 0 pass_deads 1

:1
wait 0
if or
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
jf @2


:2
wait 0
if or 
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
05E2: AS_actor 18@ kill_actor 9@
jump @Noname_23
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
zin link said:
Those targets models are seem to be useless because the ped that spawns just kills everyone not the specific people

Code:
:Noname_23
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 50.0 find_next 0 pass_deads 1

:1
wait 0
if or
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
jf @2


:2
wait 0
if or 
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
05E2: AS_actor 18@ kill_actor 9@
jump @Noname_23
Because there's no jf in label 2, put jf @Noname_23 under Actor.Model(9@) == #LSV3
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
1 last question about cleo in general.

How can i run two parts of the script at the same time because the list of actors for the guy to kill part of the script runs in a loop how can i run another part of the script that runs in a loop? at the same time like checking for a car id or something?
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
Make another labels and use jf from one to another so they can run in a loop.
Example:

:1
wait 0
if
..
jf @2
goto @MAIN

:2
if
..
jf @3
goto @MAIN

:3
if
..
jf @1
goto @MAIN
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,738
Solutions
2
Reaction score
117
I meant like so.

Code:
:DEACT
wait 0
if or
actor.Dead($PLAYER_ACTOR)
0ADC:   test_cheat "TERM"
jf @DEACT
actor.DestroyInstantly(18@)

So that works with

Code:
:Noname_23
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 20.0 find_next 0 pass_deads 1

:1
wait 0
if or
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
jf @2


:2
wait 0
if or 
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3
jf @Noname_23 
05E2: AS_actor 18@ kill_actor 9@
jump @Noname_23

So i can deactivate it but he is still killing those people.
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
I already explained very well how to do it, I don't understand what's not clear.

Code:
:MAIN
wait 0
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AE1: 9@ = random_actor_near_point 1@ 2@ 3@ in_radius 20.0 find_next 0 pass_deads 1

:1
if or
Actor.Model(9@) == #DSHER
Actor.Model(9@) == #BALLAS1
Actor.Model(9@) == #BALLAS2
Actor.Model(9@) == #BALLAS3
Actor.Model(9@) == #LSV1
Actor.Model(9@) == #LSV2
Actor.Model(9@) == #LSV3 
jf @DEACT
05E2: AS_actor 18@ kill_actor 9@

:DEACT
if or
Actor.Dead($PLAYER_ACTOR)
0ADC:   test_cheat "TERM"
jf @MAIN
Actor.RemoveReferences(18@) // to stop him killing people
Actor.DestroyInstantly(18@) // to make him disappear
goto @FIRST_LABEL // DO NOT JUMP TO MAIN, OTHERWISE YOU WILL GET CRASH
Btw, I deleted label 2 because it was same as label 1.
 
Status
Not open for further replies.
Top