I was more looking to setup happyhour to kick off randomly during the day.
That's what Thomas' supplied example does.
Essentially, you create a function to roll a random happyhour. I implemented a working example on my game as follows:
in act.other.c I added:
Code:
void check_random_happyhour()
{
if (HAPPY_TIME)
{
/* Feel free to remove this mudlog, I did it for testing */
mudlog(NRM, LVL_GOD, TRUE, "check_random_happyhour called with HAPPY_TIME == TRUE");
return;
}
else
{
if (!rand_number(0,999)) /* A one in a thousand chance */
{
HAPPY_EQ = rand_number(1,100); /* This is unique to my game */
HAPPY_EXP = rand_number(50,500);
HAPPY_TIME = rand_number(60,600);
/* Add more values like HAPPY_GOLD or HAPPY_QP if you wish */
game_info("A Happyhour has started!");
}
}
}
in act.h I added:
Code:
void check_random_happyhour();
in comm.c, there is a function: void heartbeat(int heart_pulse)
I added our check_random_happyhour() to the tick update portion of the heartbeat. This will call the check whenever the mud hour begins.
Code:
if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC)))
{ /* Tick ! */
next_tick = SECS_PER_MUD_HOUR; /* Reset tick coundown */
weather_and_time(1);
check_time_triggers();
affect_update();
point_update();
check_timed_quests();
check_random_happyhour(); /* Our new random happyhour */
}
Now, on to example:
Code:
< Salty | 100(100)hp 100(100)mana 100(100)mv >
TICK!
[Info] : A Happyhour has started!
< Salty | 100(100)hp 100(100)mana 100(100)mv >
happyh show
tbaMUD Happy Hour!
------------------
+328% to Experience per kill
+98% to equipment repop percentage
Time Remaining: 5 hours 53 mins 54 secs
< Salty | 100(100)hp 100(100)mana 100(100)mv >
And here's when it calls the function again with an active happyhour:
Code:
TICK!
[ check_random_happyhour called with HAPPY_TIME == TRUE ]
< Salty | 100(100)hp 100(100)mana 100(100)mv >
So yeah, Thomas gave you the solution. Thanks for the idea.
Salty