Files
gamedir/Data-1.13/Scripts/HourlyUpdate.lua
T
noooooo4499andAsdow e0d58cb9ec Fix lua hourly update script
Use lua setters instead of reassigning the global so it actually does something
Reverted the time conditionals so that it only updates on the opening/closing hours instead of every hour in between. Why was this change necessary to begin with? It also makes it so it resets all the boxing variables every hour instead of daily (not that it even worked before the setter change anyway)

In practice, this fixes a few things so they work as originally intended:
Boxers will actually rest for 1 day after every 3 fights as originally intended
After every rest, boxers will get progressively stronger and harder to beat as originally intended
2026-02-09 15:57:51 +02:00

57 lines
1.2 KiB
Lua

Facts =
{
FACT_BROTHEL_OPEN = 251,
FACT_MUSEUM_OPEN = 250,
FACT_CLUB_OPEN = 252,
FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED = 107,
}
local p = 0
function HourlyQuestUpdate()
if (cHour == 4) then
SetFactFalse( Facts.FACT_BROTHEL_OPEN )
elseif (cHour == 20) then
SetFactTrue( Facts.FACT_BROTHEL_OPEN )
end
-- Bar/night club
if ( cHour == 15 ) then
SetFactTrue( Facts.FACT_CLUB_OPEN )
SetFactFalse( Facts.FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED )
-- Reset boxes fought
for i = 0,2 do
-- Set false
gfBoxerFought(i,false)
end
-- If # of boxing matches the player has won is a multiple of
-- 3, and the boxers haven't rested, then make them rest
if ( gfBoxersResting == true ) then
-- Done resting now!
SetgfBoxersResting(false)
SetgubBoxersRests(gubBoxersRests + 1)
elseif ( gubBoxingMatchesWon / 3 > gubBoxersRests ) then
-- Time for the boxers to rest!
SetgfBoxersResting(true)
end
elseif ( cHour == 2 ) then
SetFactFalse( Facts.FACT_CLUB_OPEN )
end
-- Museum
if ( cHour == 9 ) then
SetFactTrue( Facts.FACT_MUSEUM_OPEN )
elseif ( cHour == 18 ) then
SetFactFalse( Facts.FACT_MUSEUM_OPEN )
end
end