Page 1 of 1

Special Action selection

Posted: Mon Jun 25, 2018 10:02 pm
by Gunner98
This may be more of a logic question than a pure Lua one but here goes:

1. I have set up four special actions in a scenario, each one 'builds' something then turns all four special actions off. E.g.:

ScenEdit_AddUnit({type = 'Facility', name = 'Socotra Landing Zone', dbid = 91, side = 'NATO', latitude='12.6289409489019', longitude='53.9100187657863'})
ScenEdit_SpecialMessage('NATO','Sir: The Engineers have cleared a helicopter landing and operations area')
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - HLZ', IsActive='False'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Parking', IsActive='False'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Pier', IsActive='False'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Runway', IsActive='False'})

2. On a regular time interval these special actions will be turned back on:

ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - HLZ', IsActive='True'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Parking', IsActive='True'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Pier', IsActive='True'})
ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Runway', IsActive='True'})
ScenEdit_SpecialMessage('NATO','You have Special Actions available for engineering work')

This all works fine but - is there a way I can remove the special action just completed from the active list? For instance, player decides to build the HLZ, so once s/he choses that action it no longer appears when the list of available actions is triggered again.

Thanks.

B

RE: Special Action selection

Posted: Tue Jun 26, 2018 2:36 am
by Rory Noonan
You could store a key value which indicates whether the HLZ has been set up or not, then check that when re-activating the special actions.

RE: Special Action selection

Posted: Tue Jun 26, 2018 10:48 am
by stilesw
Bart,

Perhaps I am misunderstanding your question but I've used this to remove (or add) a Special Action from the SA menu:

ScenEdit_SetSpecialAction({ActionNameOrID="Set Difficulty Extreme", IsActive="False", IsRepeatable="False"})

You just need some event to activate it.

-Wayne

RE: Special Action selection

Posted: Tue Jun 26, 2018 10:51 am
by stilesw
NEVER MIND! I reread your question and this doesn't help.

RE: Special Action selection

Posted: Tue Jun 26, 2018 11:41 am
by michaelm75au
I thought you could 'delete' the event, but I haven't coded that (only can add and update).

RE: Special Action selection

Posted: Sun Sep 30, 2018 3:24 pm
by Norm49
I am still learning slowly with lua so I don't know how to code this but I use to have a similar problem in ARMA editor. I will tell you how my solution may apply her.In green is the part that i don't exactly know how to code but with a bit of research I am sure it is possible for you to make it work.



So I would try to make some thing like this to all my special action script.

A = 0 at the beginning of the script and A + 1 at the end of the script. So if the action never been fire A = 0 and if the player use it 1 time A = 1. I will use A of the fist action B for the next and so on.

Now in the script that activate the spacial action will look something like (Note that in that case I use 4 different triggers. I am sure it is possible to do it all it the same trigger I just don't know how.

get valure A
if A = 0 then

ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - HLZ', IsActive='True'})

get valure B
if B = 0 then

ScenEdit_SetSpecialAction ({ActionNameOrID ='Engr - Parking', IsActive='True'})

continue for the next scrip

And now for the message.
get valure A
get valure B
get valure C
get valure D
if A = 0 or B = 0 or C = 0 or D = 0 then

ScenEdit_SpecialMessage('NATO','You have Special Actions available for engineering work')

I hope it help.

RE: Special Action selection

Posted: Sun Sep 30, 2018 4:19 pm
by Gunner98
Thanks Norm49

I think I can make that work, and it looks like a slick solution. I won't have a chance to work on it for a few weeks but when I get back to the game I'll give it a go.

B