LuA to set mission activation time

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
orca
Posts: 545
Joined: Wed Nov 06, 2013 4:59 pm

LuA to set mission activation time

Post by orca »

Is there a LUA script to set the activation time for a mission?

I tried this but it doesn't work. I'm not sure if this is the correct function or if I'm using the correct format for the date/time.

local mission = ScenEdit_SetMission('Red','initial DF-26 strike RAAF Townsville',starttime='05/06/2024 00:30:00')
Kushan04
Posts: 1210
Joined: Tue Jun 28, 2005 9:27 pm
Location: USA
Contact:

Re: LuA to set mission activation time

Post by Kushan04 »

orca wrote: Fri Aug 23, 2024 12:23 am Is there a LUA script to set the activation time for a mission?

I tried this but it doesn't work. I'm not sure if this is the correct function or if I'm using the correct format for the date/time.

local mission = ScenEdit_SetMission('Red','initial DF-26 strike RAAF Townsville',starttime='05/06/2024 00:30:00')
Missed brackets around start time

local mission = ScenEdit_SetMission('Red','initial DF-26 strike RAAF Townsville', {starttime='05/06/2024 00:30:00'})

ScenEdit_SetMission
orca
Posts: 545
Joined: Wed Nov 06, 2013 4:59 pm

Re: LuA to set mission activation time

Post by orca »

thanks!

I expanded it to make it a random time activation time activation (on a set date). See below

math.randomseed(os.time() )
local hour = math.random (0,23)
print (hour)
local minute = math.random(0,50)
print (minute)
local second = math.random(0,59)
print(second)

local random_time= string.format("%02d:%02d:%02d", hour, minute, second)
print("random time: ".. random_time)
local date = "05/06/2024"
print (date)

local datetime = date.." "..random_time
print("Randome Date and Time:".. datetime)


local mission = ScenEdit_SetMission('Red','initial DF-26 strike RAAF Townsville', {starttime=datetime})
Post Reply

Return to “Lua Legion”