Jump to content
  • 0

R> Event random time


Question

Posted

Hi All

please help me to set event time to start every 20 minutes +/- 2 minutes and end time will close after event start 5 minutes

sorry for my bad english

Thank you in advance

 

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Crude and Untested (just figured i would whip something to get you started...)

 

-	script	TestEvent	-1,{

  OnInit:
    initnpctimer;
    .event_started = 0;
    end;

  OnTimer300000: // 5 Minutes Check (When Event is on)
    if (.event_started == 1) {
      doevent("TestEvent::OnStopEvent");
    }
    end;

  OnTimer1080000: // 18 Minutes
    .r = rand(5);
    if (.r == 0) { doevent("TestEvent::OnRunEvent"); }
    end;

  OnTimer1140000: // 19 Minutes
    if (.r == 1) { doevent("TestEvent::OnRunEvent"); }
    end;

  OnTimer1200000: // 20 Minutes
    if (.r == 2) { doevent("TestEvent::OnRunEvent"); }
    end;

  OnTimer1260000: // 21 Minutes
    if (.r == 3) { doevent("TestEvent::OnRunEvent"); }
    end;

  OnTimer1320000: // 22 Minutes
    if (.r == 4) { doevent("TestEvent::OnRunEvent"); }  
    end; 

  OnRunEvent:  
    .event_started = 1;
    setnpctimer(0);
    announce("Event Running...", bc_all, C_YELLOW);
    // Do Other Event Things
    end;

  OnStopEvent:
    .event_started = 0;
    setnpctimer(0);
    announce("Event Stopped", bc_all, C_YELLOW);
    end;

}

 

Edited by Z3R0
Updated to do -2 and +2 mintues (18 to 22)
  • 0
Posted

you can try something like this too.

-	script	TestEvent	-1,{

	OnInit:
		sleep ( rand(18,22) * 60000 );
		doevent "TestEvent::OnRunEvent";
		end;
}

 

 

  • 0
Posted
1 minute ago, Emistry said:

you can try something like this too.


-	script	TestEvent	-1,{

	OnInit:
		sleep ( rand(18,22) * 60000 );
		doevent "TestEvent::OnRunEvent";
		end;
}

 

 

I still hate you sometimes :D *much love*

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...