Page 1 of 1

LuA to set mission activation time

Posted: Fri Aug 23, 2024 12:23 am
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')

Re: LuA to set mission activation time

Posted: Fri Aug 23, 2024 2:19 am
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

Re: LuA to set mission activation time

Posted: Fri Aug 23, 2024 3:24 pm
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})