function love.update()
if(love.time.readMonth() == 3) then --If the month is March...
if(love.time.ReadDay() == 19) then --...and if the day is 19...
doEventOne() --...do event one!
elseif(love.time.readHour == 20) then --Else, if the hour is 20 pm (any day in March)...
doEventTwo() --...do event two!
end
end
end
function love.update()
if(love.time.readMonth() == 3) then --If the month is March...
if(love.time.ReadDay() == 19) then --...and if the day is 19...
doEventOne() --...do event one!
elseif(love.time.readHour == 20) then --Else, if the hour is 20 pm (any day in March)...
doEventTwo() --...do event two!
end
end
end
Thank you!
When you talked about "time-based events" in a rpg/adventure I supposed you were talking about implement events like pop up a message dialog about x time. You for sure know that you should use dt time measure for that events and dont need to compare with OS clock/calender right? Just checking, your "time-based events" actually look more like "date-based events".
coffee wrote:When you talked about "time-based events" in a rpg/adventure I supposed you were talking about implement events like pop up a message dialog about x time. You for sure know that you should use dt time measure for that events and dont need to compare with OS clock/calender right? Just checking, your "time-based events" actually look more like "date-based events".
Yes, I meant date-based events (like at Christmas Eve you get 100 coins, a vanity item and accessable quest). That os.date('!*t') looks good, but can you use those infos as values, like this:
> table.foreach(os.date('!*t'), print)
hour 23
min 00
wday 5 --Is this weekday?
year 2012
yday 62 --Is this yearday?
month 3
sec 10
day 4
isdst false --What is this?
> if(month == 12 && day == 24) then coins = coins + 100 --Can you use && or || in Lua?
Make sure to put in a safety to make it so it only gives you these special things once else you have people launching and quitting the game over and over to get a million coins.