Jump to content
  • 0

Hourly automated event


dave23

Question


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  99
  • Reputation:   0
  • Joined:  04/23/12
  • Last Seen:  

Hi,

 

I need help with my events here:

disguise

dice

poring catcher

jumper

clucker

 

How can i change them to start hourly?

 

Like disguise started next hour is dice then next hour is poring and so on.

 

I tried this code: 

-	script	DiceTrigger	-1,{
OnMinute00:
if(gettime(3) % 3 == 0) donpcevent "DiceTrigger::OnDiceETrigger";
end;

}
-	script	PCETrigger	-1,{
OnMinute00:
if ( gettime(3) % 2 )  donpcevent "pcetrigger::OnCatcherTrigger";
end;
 
}

Not sure if it will help. Thanks!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   21
  • Joined:  01/31/12
  • Last Seen:  

Change your donpcevent to activate an event in each individual event script

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  99
  • Reputation:   0
  • Joined:  04/23/12
  • Last Seen:  

Where to check that Luciar? Sorry.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   21
  • Joined:  01/31/12
  • Last Seen:  

Find where each of those events is activated in their respective scripts. Add an appropriate label to the script (i.e. OnActivate). Then in your auto eventlauncher NPC, simply add:

donpcevent "NPC_NAME::EVENT_LABEL";
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  99
  • Reputation:   0
  • Joined:  04/23/12
  • Last Seen:  

Does it work like npc will start every other hour?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

using OnMinute00 will make the commands below it to start / executed when the time reaches XX:00:00 (XX hour, 0 minute, 0 second server time). If the nobody participated in that event (means the event is not stopped) then there would be overlapping.

 

does it answer your question?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  99
  • Reputation:   0
  • Joined:  04/23/12
  • Last Seen:  

I guess not. Not sure how to do to all of my scripts to automatically start every hour like diguise first then after an hour will be other event etc..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   21
  • Joined:  01/31/12
  • Last Seen:  

Here's an old automated event manager that I wrote in the past. You will have to modify it to meet what you want, or just look at it to get an idea of one possible way to accomplish your goal.

 

//===== rAthena Script =======================================================
//= Automated Events Manager
//===== By: ==================================================================
//= Dab (Luciar) - StaR-o
//===== Current Version: =====================================================
//= 1.0
//===== Compatible With: =====================================================
//= StaR-O rAthena SVN ONLY
//===== Description: =========================================================
//= Allows authorized GMs to disable all automated events
//= Allows authorized GMs to disable specific events from the automated rotation
//= --View active/inactive events
//= Allows authorized GMs to manually activate specific events
//============================================================================
ms_main,116,243,4	script	AutoEvents Manager	123,{
	OnWhisperGlobal:
		callfunc("checkPermission","4,5,7,8,9,10,11,12,99",1);
		set .@name$,"[^0000FFAutomated Events Manager^000000]";
	
		mes .@name$;
		mes "Hello, " + strcharinfo(0) +". How can I help you?";
		mes " ";
		if(!.master) mes "^FF0000Automated events are currently disabled!^000000";
		if(.lastevent$ != "") mes "Last AutoEvent Held @ "+ .lastevent$;
		mes "Current Date: "+ gettimestr("%m/%d Current Time: %H:%M",64);
		set .@m$,(.master ? "Disable Automated Events" : "Enable Automated Events");
		if(callfunc("checkPermission","9,12,99")) set .@m$, .@m$ + ":Manage Individual Events:Trigger A Specific Event";
		next;
		switch(select(.@m$)) {
	
			//Enable/Disable Automated Events
			case 1:
				if(.master) {
					set .master,0;
					mes .@name$;
					mes "Automated events have been ^FF0000Deactivated^000000.";
					stopnpctimer;
					addtimer 600000,"AutoGMRemind::OnRemindGM";
					close;
				} else {
					set .master,1;
					mes .@name$;
					mes "Automated events have been ^00FF00Activated^000000.";
					initnpctimer;
					deltimer "AutoGMRemind::OnRemindGM";
					close;
				}
				break;
		
			//Manage Individual Events	
			case 2:
				mes .@name$;
				mes "Please choose an event to activate or deactivate:";
				for(set .@i,0;.@i < getarraysize(.eventnames$); set .@i,.@i+1) {
					if(.@i != getarraysize(.eventnames$) - 1) set .@m2$,.@m2$ + (getd("."+strtolower(.eventnames$[.@i])+"_status") ? "^00FF00=^000000"+.eventnames$[.@i]+":" : "^FF0000=^000000"+.eventnames$[.@i]+":");
					else set .@m2$,.@m2$ + (getd("."+strtolower(.eventnames$[.@i])+"_status") ? "^00FF00=^000000"+.eventnames$[.@i] : "^FF0000=^000000"+.eventnames$[.@i]);
				}
				select(.@m2$);
				if(getd("." + .eventnames$[@menu-1] + "_status")) {
					setd "." + .eventnames$[@menu-1] + "_status",0;
					mes .eventnames$[@menu-1] + " has been ^FF0000Deactivated^000000.";
					close;
				} else {
					setd "." + .eventnames$[@menu-1] + "_status",1;
					mes .eventnames$[@menu-1] + " has been ^00FF00Activated^000000.";
					close;
				}
				close;
				break;

			//Trigger Individual Events
			case 3:
				if(!.master) {
					mes .@name$;
					mes "These events have been disabled globally, please make sure it is ok to host an event now before proceeding.";
					select("I understand");
					next;
				}
				mes .@name$;
				mes "Which event would you like to trigger manually? This will reset the auto timer.";
				for(set .@i,0;.@i < getarraysize(.eventnames$); set .@i,.@i+1) {
					if(.@i != getarraysize(.eventnames$) - 1) set .@m2$,.@m2$ + .eventnames$[.@i]+":";
					else set .@m2$,.@m2$ + .eventnames$[.@i];
				}
				select(.@m2$);
				set .@choice,@menu-1;
				next;
				if(!getd("."+strtolower(.eventnames$[@menu-1])+"_status")) {
					mes .@name$;
					mes "This event is currently disabled from the automatic rotation.";
					mes "Please make sure it is ok to run this event before proceeding.";
					select("I understand");
					next;
				}
				initnpctimer;
				donpcevent .npcnames$[.@choice]+"::OnAuto";
				.lastevent$ = gettimestr("%m/%d %H:%M",12);
				mes .@name$;
				mes .eventnames$[.@choice]+" has been activated!";
				mes "Auto timer reset!";
				close;
		}
	
	//Automatically trigger random event engine on hour
	OnTimer3600000:
		if(.master) {
			set .@delaycoeff,rand(1,32);
			//25% Chance of Not Hosting Event on Hour + Delay
			if(.@delaycoeff <= 8) {
				initnpctimer;
				end;
			}
			sleep .@delaycoeff*60000;
			L_randevt:
			set .@randevent,rand(0,getarraysize(.eventnames$)-1);
			if(getd("."+.eventnames$[.@randevent] + "_status") == 0) goto L_randevt;
			if(.master) {
				donpcevent .npcnames$[.@randevent] + "::OnAuto";
				.lastevent$ = gettimestr("%m/%d %H:%M",12);
			}
		}
		initnpctimer;
		end;
	
	//Remind GM That He/She Has Disabled Automated Events	
	OnRemindGM:
		mes "[^0000FFAutomated Events Manager^000000]";
		mes "This serves as a reminder that you have disabled automated events.";
		mes "Please remember to turn them back on once your event has concluded!";
		close2;
		addtimer 600000,"AutoGMRemind::OnRemindGM";
		end;
	
	//Initial Configuration of NPC
	OnInit: 
		initnpctimer;
		set .master,1;
		setarray .eventnames$[0],"Werewolf Game","Hide n Seek","Stop the Clock","Monster Count Game";
		setarray .npcnames$[0],"Werewolf Event#Init","Hide n Seek Event","Stop the Clock","Monster Count Game";
		for(set .@i,0;.@i < getarraysize(.eventnames$); set .@i,.@i + 1) {
			setd "." + .eventnames$[.@i] + "_status",1;
		}
		end;
}

-	script	AutoGMRemind	-1,{
	OnRemindGM:
		mes "[^0000FFAutomated Events Manager^000000]";
		mes "This serves as a reminder that you have disabled automated events.";
		mes "Please remember to turn them back on once your event has concluded!";
		close2;
		addtimer 600000,strnpcinfo(3)+"::OnRemindGM";
		end;
		
	OnPCLoginEvent:
		if(callfunc("checkPermission","4,6,7,8,10,11,99")) {
			if(getvariableofnpc(.master,"AutoEvents Manager") == 0) {
				announce "[Warning] : Automated Events are DISABLED. Check with online GMs to ensure this is intentional.",bc_self,0xFF0000;
			}
		}
		end;
}

function	script	AutoReward	{
	sendmail getarg(0),"Server","Minigame Reward","Congratulations, you were the winner of an automated minigame event! Please accept the prize attached to this mail!",0,30301,1;
	return;
}
Find //Initial Configuration of NPC and set the names and NPC names of each of your automated events in the correct setting array. Next, add an OnAuto: event label to each of your event NPCs that will activate the event.

The system is triggered every hour, but might not run an event every hour exactly. It adds a slight delay (sometimes) or might not host the event (sometimes) to prevent automated camping of certain events (i.e stop the clock)

You'll have to remove any instances of:

callfunc("checkPermission"...
as well as this was written for a private server with a special permissions system
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...