Help for Action Script
Posted: Fri Jan 24, 2020 1:17 pm
Attached is a Lua Event Action script from a vestigial scenario being written for CMO. The aim of the action is to limit the availability of Player aircraft by applying a Reserve loadout with a Ready time of random duration of between ten-hours and 23-hours, 59-minutes.
The event fires at midnight local time and represents aircraft developing 'gripes' and being unavailable for much or all of the day's missions.
The script for the individual aircraft randomized ready times was easy enough and this works when triggered individually:
a=math.random(1,100)
if a <16 then
ScenEdit_SetLoadout({UnitName='300 #3', guid='61870050-cb82-4944-abb0-e2082871b87c', LoadoutID='3', TimeToReady_Minutes=math.random(600,1439)})
end
The Action script needs to do the following:
- Interrogate each aircraft in the air group and apply a 15% chance of the Reserve loadout for the random time
- Omit aircraft not present when triggered due to being on operations or lost so to avoid the Player receiving any error messages
Included is the scenario including the Action (but not the Trigger), the Action text on M$ Notepad and the scenario *.ini file. When run in the Consul the script returns a Consul error #1 and I have no idea what's wrong or how to fix.
If any of the Lua writers out there can sort this out I would be eternally grateful. Thanks in advance for any assistance.
-C
The event fires at midnight local time and represents aircraft developing 'gripes' and being unavailable for much or all of the day's missions.
The script for the individual aircraft randomized ready times was easy enough and this works when triggered individually:
a=math.random(1,100)
if a <16 then
ScenEdit_SetLoadout({UnitName='300 #3', guid='61870050-cb82-4944-abb0-e2082871b87c', LoadoutID='3', TimeToReady_Minutes=math.random(600,1439)})
end
The Action script needs to do the following:
- Interrogate each aircraft in the air group and apply a 15% chance of the Reserve loadout for the random time
- Omit aircraft not present when triggered due to being on operations or lost so to avoid the Player receiving any error messages
Included is the scenario including the Action (but not the Trigger), the Action text on M$ Notepad and the scenario *.ini file. When run in the Consul the script returns a Consul error #1 and I have no idea what's wrong or how to fix.
If any of the Lua writers out there can sort this out I would be eternally grateful. Thanks in advance for any assistance.
-C