Special Action to activate events

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
Randomizer
Posts: 1535
Joined: Sat Jun 28, 2008 8:31 pm

Special Action to activate events

Post 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
User avatar
SeaQueen
Posts: 1436
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

RE: Special Action to activate events

Post 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 })
User avatar
Randomizer
Posts: 1535
Joined: Sat Jun 28, 2008 8:31 pm

RE: Special Action to activate events

Post by Randomizer »

Great, many thanks to you!

-C
User avatar
tjhkkr
Posts: 2431
Joined: Wed Jun 02, 2010 11:15 pm
Contact:

RE: Special Action to activate events

Post by tjhkkr »

This is great; thank you!
Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.
Post Reply

Return to “Lua Legion”