Jump to content
Sign in to follow this  
1para{god-father}

Use Array for Addaction

Recommended Posts

OK I have now managed to get an Array of places that i need to teleport to

My Array.....

TeleportLoc ["Base1","base2","Base3"] etc..... 

But how can I now add this Array list to a Flag pole ?

This is what I was using in my static Teleport but now i need to use an Array now , just not sure how to cycle though and add a list so it would be like below

FlagTP addAction ["Teleport > Base 1", "teleport.sqf", (base1)];
FlagTP addAction ["Teleport > Base 3", "teleport.sqf", (base2)];
FlagTP addAction ["Teleport > Base 5", "teleport.sqf", (base5)];
etc...

Hope that make some sense !

Share this post


Link to post
Share on other sites

Why do you need to use an array? Is it to do with moving teleport points?

Do you have any more sample code of what it is you are trying to achieve?

Share this post


Link to post
Share on other sites

I need to use an array because the Markers change color and they can only teleport to Captured markers and they change all the time, so i check the colour and make an array of all Blue markers.

Share this post


Link to post
Share on other sites

would

TeleportLocations = ["Base1","base2","Base3"];

{
_actionName = format["Teleport > %1",_x];
FlagTP addAction [_actionName, "teleport.sqf", _x];
}forEach TeleportLocations;

work for what you are trying to do?

This would create an action for every string in the array and pass the string to your function.

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  

×