Jump to content
Sign in to follow this  
Eddie Haskel

Can someone proof this pls?

Recommended Posts

Code Sample:

vehicleName addAction ["Kick the tyres","kick.sqs"]

That will add an action menu item for the vehicle called "Kick the tyres". It will be visible to the player near or inside the vehicle. The script "kick.sqs" will be executed when selecting the action.

addAction carries three parameters to the kick.sqs:

1)The name of the unit that has the action (the vehicle in this case.)

2)The name of the unit that activated the action (the player)

3)The action index number (used with removeAction -command)

_unitWithAction = _this select 0;

_activatingUnit = _this select 1;

_actionIndex = _this select 2;

Can someone tell me what the action index number is, and where do I find it?

Also, pretend this was for turning a light on and off. The above covers how I turn it on, but would turning it off be:

_activatingUnit = _this select0; following on line after _this select 1; ?

I plan on having the above trigger to light a fire and put out a fire.

Thnx

Eddie

Share this post


Link to post
Share on other sites

First part looks good.

(But in .sqs you don't have to use ; at the end of a line)

An Action Index Number is created automaticly when ever you addaction to an object.

You have already found it for your script with _actionIndex = _this select 2;

(The 3rd value a custom action returns (That's what select 2 looks at.) , is its index number)

You need it, if you want to remove the action.

So you will need it for fire on/off:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_fire = _this select 0

_guywithlighter = _this select 1

_fireonaction = _this select 2

_fire removeaction _fireonaction

add your line(s) to start the fire simulation here

_fire addAction ["Put Out Fire", "extinguish.sqs"]

exit

You'll need a second script (extinguish.sqs) like the one before, for the reverse commands.

You may have noticed, that _this select 1 isn't needed in these scripts, as nothing changes for the guy who plays with the fire.

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  

×