Jump to content
Sign in to follow this  
TheLocalPub

How to hide multiple objects with one addAction

Recommended Posts

Evening folk.

 

So I've always been interested in scripting and general mission making for Arma even since I first played the series. 

Recently I choose to actually take steps to learn the above and attempt to make a mission (Of which is going decently well)

 

Now while making the mission in question I've came to a point where I want to be able to make multiple objects at once disappear upon the chosen action being activated using the addAction command within an INIT;

I've managed to with the following to make one rock disappear using the hideObject command but I'm unsure how I'd make multiple variables do the same using the same action command.

rock1 addAction ["Move big fucking rock", "hideObject rock1"];

I presume this is very simple... Very, but I'm like stated above amateur at best so I'm using every moment to learn.

Any help? 

Share this post


Link to post
Share on other sites
rock1 addAction ["Move big fucking rocks", {hideObject rock1; hideObject rock2; hideObject rock3; hideObject rock4;}];


- or -

bigFuckingRocks = [

rock1,
rock2,
rock3,
rock4
];

rock1 addAction ["Move big fucking rocks", {
    {
        hideObject _x;
    } forEach bigFuckingRocks;
};
];

*edit* - or something like the above, I'm exhausted and that was just off the top of my head so caveat emptor.

Share this post


Link to post
Share on other sites

Harzach's suggestion works. If you want each rock to have its own addAction, do the following:

 

_listRocks = [rock1,rock2,rock3,rock4];

{
	_x addAction ["Move Rock",{hideObject (_this select 0);}];
} forEach _listRocks;

You can look up the commands on the scripting commands wiki if you don't understand some of them.

  • Like 1

Share this post


Link to post
Share on other sites

Cheers gents.

 

Like I said I'm amateur at best when it comes to this but looking st what you've wrote makes sense now someone has laid it out for me.

 

Once again thanks.

  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, TheLocalPub said:

Cheers gents.

 

Like I said I'm amateur at best when it comes to this but looking st what you've wrote makes sense now someone has laid it out for me.

 

Once again thanks.

Bookmark these:

 

Scripting_Commands_Arma_3

Event_Handlers

Initialization_Order

Event_Scripts

Code_Optimisation (I still go through this one a lot)

 

Also a must-have:

Poseidon SQF editor (made by a BI-dev)

 

Instant level up.

 

Cheers

  • Like 3
  • Thanks 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  

×