Jump to content
Sign in to follow this  
jazzraill

(Question) Spawning objects/units by trigger

Recommended Posts

Hello everyone. I am trying to spawn units and some objects with trigger, then delete them when player leaves the trigger area (eg. 200x200) and re-spawn when entering again. what i am trying to do is to create a military bases around the map with camps/ tents and units patrolling but it costs a lot of fps. i would like to place units and objects in editor but they should spawn when player is in their activation trigger. then they should despawn if player leaves the area. sorry for bad english 

Share this post


Link to post
Share on other sites

Type: none

Activation: any

condition:

this && {(isPlayer _x) and (alive _x)}count thisList > 0

On act:

yourglobalarray = [];

_nul = yourglobalarray pushBack ("O_G_Soldier_F" createVehicle position thisTrigger);

_nul = yourglobalarray pushBack ("O_G_Soldier_F" createVehicle position thisTrigger);

On deact:

_nul =

{

if(!isNull _x) then {deleteVehicle _x;};

true

} count yourglobalarray;

yourglobalarray=nil;

this spawns 2 opfor if player enters area of trigger and deletes them if player leaves area. U just also need to ensure that the empty groups will be deleted with deleteGroup. But there is a good example at the wiki which describes how to delete all empty groups. This is neccessary becaue of the 144 groups limit.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×