Welcome to the Builder Academy

Question How hard is adding events - Happyhour specifically

More
26 Jun 2025 20:13 #10773 by wlessard1
Been trying to figure out the code for events in order to make "happyhour" randomly begin and a variable duration if possible.

Just wondering if this can be done and how difficult it might be. Still trying to find the files that are needed to be changed.

Thanks for any suggestions. I did look through the Coder Doc  to see if there was anything in it.

Please Log in or Create an account to join the conversation.

More
27 Jun 2025 22:48 - 27 Jun 2025 22:48 #10775 by thomas
Not so hard, really.

To trigger a happy hour, you just need to set the HAPPY_TIME to the number of ticks it should last.
github.com/tbamud/tbamud/blob/master/src/act.other.c#L926

So, in the game loop, add a function call to something that does this (browser code):
Code:
void should_we_start_happy_hour() {   if (HAPPY_TIME) {     return; // already in a happy hour.   }   if (rand_number(1, 10000) < 5) { // adjust numbers to vary chance of starting a happy hour this tick     // also adjust these if you wish     HAPPY_EXP = 100;     HAPPY_GOLD = 50;     HAPPY_QP  = 50;     HAPPY_TIME = rand_number(30, 70);     game_info("A Happyhour has started!");   } }
 
Last edit: 27 Jun 2025 22:48 by thomas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.308 seconds