Sample Lua attack scenario

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

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

Sample Lua attack scenario

Post by michaelm75au »

I have created a simple scenario that shows how a ship could be ordered to attack with Lua.
Thought showing this off might be more helpful ...[:D]

There is an event that triggers on detection of SideA's LST400. When it triggers and the unit is identified as LST400, the SideB DDG is given instructions to attack the contact with a 'gun' weapon (manual weapon allocation). There is a commented line showing how to auto attack the contact.
In this case, the DDG is not in range or has the correct weapon on the mount. So once the attack order is issued, it reloads the correct weapon and closes with the target. [if it had been in range and weapon ready, it would have just started firing]. Once in range it fires the requested number of shells, and then stops.

There are a couple of hard-coded values in the script as the unit making the detection is not passed from the Event trigger. It may be something to think about (eg SE_DetectedByX() gives you who made the detection, and you could make conditions or actions more precise, like only do this if the detector is a small surface ship). Embedding this as part of the event editor would get tooooo messy.

Just load the scenario and press start. Time compressing to 5 seconds will speed it up without missing anything
Attachments
Sandbox..tingv5e.zip
(275.78 KiB) Downloaded 38 times
Michael
User avatar
Maromak
Posts: 1073
Joined: Wed Dec 26, 2007 1:40 pm
Location: Australia

RE: Sample Lua attack scenario

Post by Maromak »

Thanks this is very helpful for us non-coders!
Certa Cito
User avatar
AlGrant
Posts: 912
Joined: Tue Aug 18, 2015 4:38 am

RE: Sample Lua attack scenario

Post by AlGrant »

Thanks Michael
Thanks this is very helpful for us non-coders!
Agree. I find a working example of a particular Lua command really helpful.
GOD'S EYE DISABLED.
Post Reply

Return to “Lua Legion”