Jump to content

Vago spawning script


Recommended Posts

Hi. I've been working a a simple Vago spawning script for a while now. It's pretty basic. It spawns random Vagos around the player after "2" is pressed on the keyboard. The vagos will then attack the player with pistols after they are spawned. But I've got 2 problems I need help with fixing. The first problem is that the Vagos don't spawn around the player. They only spawn at a certain position depending on where the player is facing. I don't want this. I want the Vagos to spawn around the player, like cops do when you have a 3+ wanted level.

 

 

And the next problem is with the dead bodies of the Vagos. I want the dead bodies of the Vagos to disappear, not to stay, as this causes alot of problems. I've tried multiple ways to get around this, but I can't get the bodies to go away.

 

Heres the code-

 

 

thread 'VSPAWN' :VSPAWN_47wait 0 if and  Player.Defined($PLAYER_CHAR)0AB0:   key_pressed 50jf @VSPAWN_47 Model.Load(#LSV1)Model.Load(#LSV2)Model.Load(#LSV3)Model.Load(#COLT45)Model.Load(#MICRO_UZI)038B: load_requested_models 04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 37.0 37.0 0.002C0: store_to 30@ 31@ 32@ ped_path_coords_closest_to 0@ 1@ 2@  :VSPAWN_100wait 0 if and  Model.Available(#LSV1)  Model.Available(#LSV2)  Model.Available(#LSV3)  Model.Available(#COLT45)  Model.Available(#MICRO_UZI)jf @VSPAWN_100 0209: 15@ = random_int_in_ranges 108 1113@ = Actor.Create(Criminal, 15@, 30@, 31@, 32@)01B2: give_actor 3@ weapon 22 ammo 9999 // Load the weapon model before using this Actor.WeaponAccuracy(3@) = 60081A: set_actor 3@ weapon_skill_to 1 07A5: AS_actor 3@ attack_actor $PLAYER_ACTOR 0 ms// The "Actor.RemoveReferences(3@)" has to be added somewhere, but I can't get it in a suitable location for bodies to go away.                                                               :VSPAWN_1337Model.Destroy(#LSV1)Model.Destroy(#LSV2)Model.Destroy(#LSV3)Model.Destroy(#COLT45)Model.Destroy(#MICRO_UZI) jump @VSPAWN_47

 

 

I hope someone can help me out.

Link to comment
https://gtaforums.com/topic/467742-vago-spawning-script/
Share on other sites

Peppo_o'Paccio

Well, you could solve it in two ways:

 

{$CLEO .cs}thread 'VSPAWN'while true   wait 0   077E: get_active_interior_to 20@     if and       Player.Defined($PLAYER_CHAR)       0AB0:   key_pressed 50       20@ == 1   then        Model.Load(#LSV1)       Model.Load(#LSV2)       Model.Load(#LSV3)       Model.Load(#COLT45)       Model.Load(#MICRO_UZI)       while true           wait 0           if and               Model.Available(#LSV1)               Model.Available(#LSV2)               Model.Available(#LSV3)               Model.Available(#COLT45)               Model.Available(#MICRO_UZI)           then               break           end       end       3@ = 40.0       4@ = 40.0        gosub @StorePos       8@ = Actor.Create(Gang3, #LSV1, 5@, 6@, 7@)       3@ = -40.0       4@ = -40.0       gosub @StorePos       9@ = Actor.Create(Gang3, #LSV2, 5@, 6@, 7@)       3@ = 0.0       4@ = 40.0       gosub @StorePos       10@ = Actor.Create(Gang3, #LSV3, 5@, 6@, 7@)       3@ = 40.0       4@ = 0.0       gosub @StorePos       11@ = Actor.Create(Gang3, #LSV1, 5@, 6@, 7@)       3@ = -40.0       4@ = 0.0       gosub @StorePos       12@ = Actor.Create(Gang3, #LSV2, 5@, 6@, 7@)       3@ = 0.0       4@ = -40.0       gosub @StorePos       13@ = Actor.Create(Gang3, #LSV3, 5@, 6@, 7@)         01B2: give_actor 8@ weapon 22 ammo 99999       01B2: give_actor 9@ weapon 22 ammo 99999       01B2: give_actor 10@ weapon 22 ammo 99999       01B2: give_actor 11@ weapon 28 ammo 99999       01B2: give_actor 12@ weapon 28 ammo 99999       01B2: give_actor 13@ weapon 28 ammo 99999       Actor.WeaponAccuracy(8@) = 60       Actor.WeaponAccuracy(9@) = 60       Actor.WeaponAccuracy(10@) = 60       Actor.WeaponAccuracy(11@) = 60       Actor.WeaponAccuracy(12@) = 60       Actor.WeaponAccuracy(13@) = 60       081A: set_actor 8@ weapon_skill_to 1       081A: set_actor 9@ weapon_skill_to 1        081A: set_actor 10@ weapon_skill_to 1        081A: set_actor 11@ weapon_skill_to 1        081A: set_actor 12@ weapon_skill_to 1        081A: set_actor 13@ weapon_skill_to 1       07A5: AS_actor 8@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 9@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 10@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 11@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 12@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 13@ attack_actor $PLAYER_ACTOR -1 ms       // Marker.CreateAboveActor(14@, 8@)       // Marker.CreateAboveActor(15@, 9@)       // Marker.CreateAboveActor(16@, 10@)       // Marker.CreateAboveActor(17@, 11@)       // Marker.CreateAboveActor(18@, 12@)       // Marker.CreateAboveActor(19@, 13@)        Model.Destroy(#LSV1)       Model.Destroy(#LSV2)       Model.Destroy(#LSV3)       Model.Destroy(#COLT45)       Model.Destroy(#MICRO_UZI)       gosub @Check   endend:StorePos04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 3@ 4@ 0.002C0: store_to 5@ 6@ 7@ ped_path_coords_closest_to 0@ 1@ 2@return:Check20@ = 0while true   wait 0   if Actor.Dead(8@)   then       Actor.DestroyWithFade(8@)       // Marker.Disable(14@)   end   if Actor.Dead(9@)   then       Actor.DestroyWithFade(9@)       // Marker.Disable(15@)   end   if Actor.Dead(10@)   then       Actor.DestroyWithFade(10@)       // Marker.Disable(16@)   end   if Actor.Dead(11@)   then       Actor.DestroyWithFade(11@)       // Marker.Disable(17@)   end   if Actor.Dead(12@)   then       Actor.DestroyWithFade(12@)       // Marker.Disable(18@)   end   if Actor.Dead(13@)   then       Actor.DestroyWithFade(13@)       // Marker.Disable(19@)   end   if and       not Actor.Defined(8@)        not Actor.Defined(9@)        not Actor.Defined(10@)       not Actor.Defined(11@)       not Actor.Defined(12@)       not Actor.Defined(13@)   then       return   end end

 

 

By doing this, six Vagos will be spawned around CJ (you can add the markers as I did to check where they are), and the first problem is solved. When you kill one of them, he will disappear, while if you kill all of them, you'll be able to restart the script, otherwise you'll not (and the second problem is also solved). Here's the second way:

 

{$CLEO .cs}thread 'VSPAWN'while true   wait 0   077E: get_active_interior_to 20@    if and       Player.Defined($PLAYER_CHAR)       0AB0:   key_pressed 50       20@ == 1   then        Model.Load(#LSV1)       Model.Load(#LSV2)       Model.Load(#LSV3)       Model.Load(#COLT45)       Model.Load(#MICRO_UZI)       while true           wait 0           if and               Model.Available(#LSV1)               Model.Available(#LSV2)               Model.Available(#LSV3)               Model.Available(#COLT45)               Model.Available(#MICRO_UZI)           then               break           end       end       3@ = 40.0       4@ = 40.0        gosub @StorePos       8@ = Actor.Create(Gang3, #LSV1, 5@, 6@, 7@)       3@ = -40.0       4@ = -40.0       gosub @StorePos       9@ = Actor.Create(Gang3, #LSV2, 5@, 6@, 7@)       3@ = 0.0       4@ = 40.0       gosub @StorePos       10@ = Actor.Create(Gang3, #LSV3, 5@, 6@, 7@)       3@ = 40.0       4@ = 0.0       gosub @StorePos       11@ = Actor.Create(Gang3, #LSV1, 5@, 6@, 7@)       3@ = -40.0       4@ = 0.0       gosub @StorePos       12@ = Actor.Create(Gang3, #LSV2, 5@, 6@, 7@)       3@ = 0.0       4@ = -40.0       gosub @StorePos       13@ = Actor.Create(Gang3, #LSV3, 5@, 6@, 7@)         01B2: give_actor 8@ weapon 22 ammo 99999       01B2: give_actor 9@ weapon 22 ammo 99999       01B2: give_actor 10@ weapon 22 ammo 99999       01B2: give_actor 11@ weapon 28 ammo 99999       01B2: give_actor 12@ weapon 28 ammo 99999       01B2: give_actor 13@ weapon 28 ammo 99999       Actor.WeaponAccuracy(8@) = 60       Actor.WeaponAccuracy(9@) = 60       Actor.WeaponAccuracy(10@) = 60       Actor.WeaponAccuracy(11@) = 60       Actor.WeaponAccuracy(12@) = 60       Actor.WeaponAccuracy(13@) = 60       081A: set_actor 8@ weapon_skill_to 1       081A: set_actor 9@ weapon_skill_to 1        081A: set_actor 10@ weapon_skill_to 1        081A: set_actor 11@ weapon_skill_to 1        081A: set_actor 12@ weapon_skill_to 1        081A: set_actor 13@ weapon_skill_to 1       07A5: AS_actor 8@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 9@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 10@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 11@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 12@ attack_actor $PLAYER_ACTOR -1 ms       07A5: AS_actor 13@ attack_actor $PLAYER_ACTOR -1 ms        Model.Destroy(#LSV1)       Model.Destroy(#LSV2)       Model.Destroy(#LSV3)       Model.Destroy(#COLT45)       Model.Destroy(#MICRO_UZI)       Actor.RemoveReferences(8@)       Actor.RemoveReferences(9@)       Actor.RemoveReferences(10@)       Actor.RemoveReferences(11@)       Actor.RemoveReferences(12@)       Actor.RemoveReferences(13@)   endend:StorePos04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 3@ 4@ 0.002C0: store_to 5@ 6@ 7@ ped_path_coords_closest_to 0@ 1@ 2@return

 

If you use this script, you can spawn the six Vagos any time you want, but if you use the script multiple times there are some problems about the coordinates (just try it). After the Vagos are spawned, they will be removed from the script.

 

In any case, I gave to some Vagos the micro uzi, because they were useless in your code. If this is not what you want, just modify the script.

Edited by Peppo_o'Paccio
Link to comment
https://gtaforums.com/topic/467742-vago-spawning-script/#findComment-1060300937
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
  • 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.