Special Action selection

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
Gunner98
Posts: 5996
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

Special Action selection

Post 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
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: Special Action selection

Post 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.
Image
User avatar
stilesw
Posts: 1572
Joined: Wed Jun 25, 2014 10:08 pm
Location: Hansville, WA, USA

RE: Special Action selection

Post 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
“There is no limit to what a man can do so long as he does not care a straw who gets the credit for it.”

Charles Edward Montague, English novelist and essayist
~Disenchantment, ch. 15 (1922)
User avatar
stilesw
Posts: 1572
Joined: Wed Jun 25, 2014 10:08 pm
Location: Hansville, WA, USA

RE: Special Action selection

Post by stilesw »

NEVER MIND! I reread your question and this doesn't help.
“There is no limit to what a man can do so long as he does not care a straw who gets the credit for it.”

Charles Edward Montague, English novelist and essayist
~Disenchantment, ch. 15 (1922)
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Special Action selection

Post by michaelm75au »

I thought you could 'delete' the event, but I haven't coded that (only can add and update).
Michael
Norm49
Posts: 96
Joined: Fri Jun 05, 2015 3:59 pm

RE: Special Action selection

Post 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.
User avatar
Gunner98
Posts: 5996
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Special Action selection

Post 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
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Post Reply

Return to “Lua Legion”