Lua in Command tutorial 1

Post new mods and scenarios here.

Moderator: MOD_Command

User avatar
Primarchx
Posts: 1954
Joined: Sun Jan 20, 2013 9:29 pm

RE: Lua in Command tutorial 1

Post by Primarchx »

Any options for joining a unit to a group using Lua? How about units switching sides? Thanks!
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: Lua in Command tutorial 1

Post by Tomcat84 »

Glad you guys found it useful!

Both good ideas Primarchx! Possibly for the future? [:)] I know unit switching sides has already been requested.
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
User avatar
Primarchx
Posts: 1954
Joined: Sun Jan 20, 2013 9:29 pm

RE: Lua in Command tutorial 1

Post by Primarchx »

The idea I had was to use the unit joining a group to do dynamic resupply for ground elements, like air defense. Let's say you have logistics trucks with SAMs driving to your ADA sites each night. When they arrive they join the ADA site group, reload missiles, unjoin the group and return to their origin. I can do this manually now, of course.

Switching sides would be good for capturing ground facilities like airbases, and of course capturing pirate vessels, et al.
thewood1
Posts: 10292
Joined: Sun Nov 27, 2005 6:24 pm
Location: Boston

RE: Lua in Command tutorial 1

Post by thewood1 »

Not sure if it does everything for you, but you could switch sides by deleting the unit on one side and then immediately adding a duplicate on the other side. Then you can use other logic to award points for capture.
User avatar
Primarchx
Posts: 1954
Joined: Sun Jan 20, 2013 9:29 pm

RE: Lua in Command tutorial 1

Post by Primarchx »

With the Lua change posture scripts you can sort of capture an airbase now. The best way I've found is to make 'capturable' airbases a separate side that are allied with the OpFor. When you 'capture' the base, it becomes allied with you. Of course any enemy aircraft stationed there are still there - unflyable as far as I can tell but using ramp and hangar space. You also have to have a way of getting ordnance for your aircraft there, which can be done by teleporting in the appropriate munitions bunkers and (manually) grouping them with the new airbase ... which is another reason to have a Lua script that can create/add to groups!
User avatar
tjhkkr
Posts: 2431
Joined: Wed Jun 02, 2010 11:15 pm
Contact:

RE: Lua in Command tutorial 1

Post by tjhkkr »

Thank you very much for this! I have been playing with the editor, but this solidifies a lot.
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.
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: Lua in Command tutorial 1

Post by Tomcat84 »

It was brought to my attention that this tutorial doesn't load in CMO because it uses an older version of the database that is not included anymore. So I have updated to the latest Database.

Find attached a zip file with those updated files. I have not changed the contents of the scenario nor verified the functionality.

Thanks a lot to kylania for informing me!
Attachments
Lua in Com.. 1 newDB.zip
(27.36 KiB) Downloaded 44 times
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
Post Reply

Return to “Mods and Scenarios”