Building scenario from Lua

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
michaelm75au
Posts: 11889
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

Building scenario from Lua

Post by michaelm75au »

I am building a scenario from scratch, just using the SE commands (version 1.14)
Basically load the scenario, go to special actions and execute the action.

You will need to switch to the USN to see the units. [Need to see if this can be done in future by a SE command]

25.02.2018
Create a couple of sides
Add some units to one side
Add some missions and assign aircraft to them

Next steps
Add side units to the opposing side
Create some events
Attachments
Buildingscenario.zip
(3.8 KiB) Downloaded 244 times
Michael
thewood1
Posts: 6847
Joined: Sun Nov 27, 2005 6:24 pm

RE: Building scenario from Lua

Post by thewood1 »

Is this the beginning of a quick scenario builder of some sort?
You are like puss filled boil on nice of ass of bikini model. You are nasty to everybody but then try to sweeten things up with a nice post somewhere else. That's nice but you're still a boil on a beautiful thing! - BDukes
User avatar
michaelm75au
Posts: 11889
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Building scenario from Lua

Post by michaelm75au »

No just an example of building a scenario using a number of Lua functions. Should be helpful to see how the commands are put together.
Could be used to say create a new side when certain things happen. Currently it is not easy to hide units are 'inactive'
Michael
User avatar
aerosky
Posts: 37
Joined: Tue Jul 20, 2021 6:38 am
Location: USA

RE: Building scenario from Lua

Post by aerosky »

I have downloaded your "Building scenario.scen", and read the lua script. But I can't find where to trigger the script.
ORIGINAL: michaelm75au

No just an example of building a scenario using a number of Lua functions. Should be helpful to see how the commands are put together.
Could be used to say create a new side when certain things happen. Currently it is not easy to hide units are 'inactive'
In the future, no space, no win
User avatar
nukkxx5058
Posts: 3064
Joined: Thu Feb 03, 2005 2:57 pm
Location: France

RE: Building scenario from Lua

Post by nukkxx5058 »

[/quote]
But I can't find where to trigger the script.

Same. I don't understand how the script is incorporated in the scen and how to trigger it other than manually by copy-paste into the Lua console.
The only Lua code I can see is in "special action" when I choose to edit it. Is it it ?
Winner of the first edition of the Command: Modern Operations COMPLEX PBEM Tournament (April 2022) :-)
thewood1
Posts: 6847
Joined: Sun Nov 27, 2005 6:24 pm

RE: Building scenario from Lua

Post by thewood1 »

I think if you don't understand where to "find" lua, you really need to start with the basics and not just examples. I suggest you look at a few of these videos.

https://www.youtube.com/results?search_ ... ua+gatcomb

He does a great job in manageable concepts of showing what lua is and does.

I would start with this one that explains the event editor and that's important to how most people use lua in a scenario design.

https://www.youtube.com/watch?v=TCApvEgog4U

Then this one does a good job of expanding on it and getting into how lua works in the event editor. Its pretty simple. He has a number of others that go into more detail.

https://www.youtube.com/watch?v=0_XMMSs ... T&index=75
You are like puss filled boil on nice of ass of bikini model. You are nasty to everybody but then try to sweeten things up with a nice post somewhere else. That's nice but you're still a boil on a beautiful thing! - BDukes
User avatar
nukkxx5058
Posts: 3064
Joined: Thu Feb 03, 2005 2:57 pm
Location: France

RE: Building scenario from Lua

Post by nukkxx5058 »

These videos are about syntax which I'm not interested in. What I want is to see where the code is located when I open a scenario with existing Lua script. For example if I want to edit the Lua script of an existing scenario.
Winner of the first edition of the Command: Modern Operations COMPLEX PBEM Tournament (April 2022) :-)
musurca
Posts: 141
Joined: Wed Jul 15, 2020 10:06 pm
Contact:

RE: Building scenario from Lua

Post by musurca »

"Where" exactly the Lua is in a scenario can be a bit of a complicated question. Lua code can be either:

1) Executed as an LuaScript Action from an Event. (See Editor -> Event Editor -> Events or Actions).
2) Executed from an external file in the CMO/Lua directory.
3) Executed from a Lua script added to the scenario as an attachment.
4) Executed directly from Editor -> Lua Script Console.

Most of the time, the answer is #1, so you'll be able to find the code by browsing through the Events.
User avatar
nukkxx5058
Posts: 3064
Joined: Thu Feb 03, 2005 2:57 pm
Location: France

RE: Building scenario from Lua

Post by nukkxx5058 »

ORIGINAL: musurca

"Where" exactly the Lua is in a scenario can be a bit of a complicated question. Lua code can be either:

1) Executed as an LuaScript Action from an Event. (See Editor -> Event Editor -> Events or Actions).
2) Executed from an external file in the CMO/Lua directory.
3) Executed from a Lua script added to the scenario as an attachment.
4) Executed directly from Editor -> Lua Script Console.

Most of the time, the answer is #1, so you'll be able to find the code by browsing through the Events.

OK, got my answer, thanks ! I obviously knew about 4) but was wondering about the other ways. Perfect !



Winner of the first edition of the Command: Modern Operations COMPLEX PBEM Tournament (April 2022) :-)
Post Reply

Return to “Lua Legion”