Page 1 of 1

Special Action to activate events

Posted: Sun Jan 05, 2020 8:16 pm
by Randomizer
Have slammed into a Lua wall and would really appreciate some help at the "Lua for Dummies" level.

I need a special action that will simultaneously activate nine previously inactive events, each of which then has a random time trigger. I have no idea how to script this and so far attempting to do so has failed completely. Selecting the Special Action also places new units on the map while costing the Player Victory Points, which I think I can successfully script.

The Lua documentation often refers to the GUID for units and groups, found easily enough by right-clicking and following the popup menu but how does one find the GUID for an Event? Is just the name of the event sufficient to describe it in Lua? Is the Boolean "Event Active Yes/No" a switch or information only?

Thank you in advance.

-C

RE: Special Action to activate events

Posted: Mon Jan 06, 2020 7:53 am
by SeaQueen
The Lua documentation often refers to the GUID for units and groups, found easily enough by right-clicking and following the popup menu but how does one find the GUID for an Event?

evt = ScenEdit_GetEvent(...)
evt.guid
Is just the name of the event sufficient to describe it in Lua? Is the Boolean "Event Active Yes/No" a switch or information only?

I prefer to use guids just because they're unique identifiers and theoretically you could have two events with the same name. In most cases the name is sufficient, though.

Then to make the event active, use...

ScenEdit_SetEvent (evt.guid, { isActive=True })

RE: Special Action to activate events

Posted: Mon Jan 06, 2020 1:01 pm
by Randomizer
Great, many thanks to you!

-C

RE: Special Action to activate events

Posted: Tue Jan 07, 2020 11:34 pm
by tjhkkr
This is great; thank you!