Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
RabbitxRabbit

getPos of EVERY object in an array and createVehicle on EVERY position in that array?

Recommended Posts

I am trying to create a script for an incendiary bomb that sets fire to all objects within a 20m radius. So far, this is what I have:

_objectList = nearestObjects [bomb1, [], 20]; 	//this creates an array "_objectList" of all objects within 20m of object "bomb1"

_posArray = []; 				//this creates an array "_posArray" of the positions of each object in the previous array "_objectList"
 { 							
    _pos = getPosATL _x; 	
 _posArray pushBack _pos; 	
} forEach _objectList;		

All of that works. What I can't figure out is how to create a fire on each position in the array "_posArray". I can create a fire on any ONE of the  positions, using this:

"test_EmptyObjectForFireBig" createVehicle (getPos (_objectList3 select  index)); // where "index" is the index number of any one of the positions in the array _posArray"

But I don't know how to create a fire on EVERY position.

 

Thank you in advance for any help!

  • Like 1

Share this post


Link to post
Share on other sites

You are pretty close to your solution already; the position array seems a bit redundant since you are just using the object list to get the position anyways...

Just need something like:

{"test_EmptyObjectForFireBig" createVehicle (getPosATL _x)} forEach _objectList; // _x is any given object in the object list from nearestObjects


Edit: Also, may want to refine your list of nearest objects or check if a fire is already created nearby when creating other fire objects, it could just be a lot of unnecessary effects if there are lots of small objects or something

  • Like 1

Share this post


Link to post
Share on other sites

×