Jump to content
  • 0

R> Event random time


wut751

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   2
  • Joined:  07/17/17
  • Last Seen:  

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

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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)
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you can try something like this too.

-	script	TestEvent	-1,{

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

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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*

Link to comment
Share on other sites

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.

×
×
  • Create New...