Jump to content
Sign in to follow this  
deniodan

setDamage 1 to a collection of ID's (Trees)

Recommended Posts

Hey guys!

My question is more for the acquisition of knowledge rather than a problem in itself.

I was using this code found here to "kill" the trees using his ID's.

(getPos this nearestObject 314) setDamage 1;

For that, I put this command in a Game logic obj ini and it worked pretty well.

But for each ID I have to copy the whole command.

I was wondering if there is a way (and probably have) to make a collection of ID's in a single code. Something like this:

(getPos this nearestObject [314, 315, 316, 317]) setDamage 1;

I've tryed some things but always got a error instead.

Someone could enlight how to do such thing?

I'm pretty new with this script thing.

Thanks you guys!

Share this post


Link to post
Share on other sites

Maybe something like this?

{
(getPos this nearestObject _x) setDamage 1;
} foreach [314,315,,316,317];

Share this post


Link to post
Share on other sites

Thank you Mr. Tonic!

Works just fine!

So simple!!

I have to study more!

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  

×