Jump to content
  • 0

Am I headed down the right path? (Event Manager NPC)


klaw

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  08/24/13
  • Last Seen:  

I simply don't want to waste my time trying to get this to work this way just to have it not work. I'm new to RO scripting, but you have to start somewhere right? :) Thanks for reading.

mapname,x,y,z	script	npcname	id,{

if(getgmlevel() < .Level) end;

mes .n$;

mes "What can I do for you?";

switch(select("Start Automated Events:End Automated Events")){

case 1:

next;

callfunc(startEvents);

mes .n$;

mes "Automated events started.";

close;

case 2:

next;

callfunc(endEvents);

mes .n$;

mes "Automated events ended.";

close;

}

function eventMgr {

OnClock0000:

OnClock0600:

OnClock1200:

OnClock1800:

callfunc(event1);

OnClock0100:

OnClock0700:

OnClock1300:

OnClock1900:

callfunc(event2);

OnClock0200:

OnClock0800:

OnClock1400:

OnClock2000:

callfunc(event3);

OnClock0300:

OnClock0900:

OnClock1500:

OnClock2100:

callfunc(event4);

OnClock0400:

OnClock1000:

OnClock1600:

OnClock2200:

callfunc(event5);

OnClock0500:

OnClock1100:

OnClock1700:

OnClock2300:

callfunc(event6);

}

function startEvents {

callfunc(eventMgr);

}

function endEvents {

//Not sure how to end them all at once

}

function script event1 {

}

function script event2 {

}

function script event3 {

}

function script event4 {

}

function script event5 {

}

function script event6 {

}

// -------------------- Configuration --------------------

OnInit:

set .aLevel,99; // GM Level to access NPC

set .n$,"[Event Manager]"; // NPC's Name

setarray .EventMenu[0], //Set Event Names Below

event1, // First Events Name

event2, // Second Events Name

event3, // Third Events Name

event4, // Fourth Events Name

event5; // Fifth Events Name

// Add more events here.

callfunc(eventMgr);

end;

}

Edited by Xyndor
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Yes, and no. It's hard to say, but you have the right idea, unfortunately without knowing how each event both starts and ends, we can't really give you an in depth guide. Though, depending on how each even is scripted, it might be easier to simple, use a doevent / donpcevent command, to just have the actual event NPC, shut off the event.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  08/24/13
  • Last Seen:  

Now that you mention it, it probably would be easier with doevent.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Yes, and you can even, separate them in your menu by event names, so you can specifically turn each one off. Then, when you need to turn all of them off at once, just have each doevent listed under 1 label. So depending on the amount of events you have, you could be looking at probably a 20-40 line script and thats all.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  08/24/13
  • Last Seen:  

Got it figured out now. What would be the best way to make the onclock function easier to customize. Example - can I make an onclock array and a nested if to set my events to specific times?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Hmmm, last I checked, I don't think labels were able to be built dynamically. So you may be stuck with doing it the manual way.

OnClock0000:
OnClock0200:
OnClock0400:
OnClock0600:
doevent XYZ;
end;

OnClock0800:
OnClock1000:
OnClock1200:
doevent 1;
doevent 2;
end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

It's possible to effectively automate the events by triggering a check OnMinute and storing the events to trigger for each hour as a bit integer (that's exactly what I use in my manager XD). It'll take some time to code, but once it's done you won't have to worry about it again.

  • Upvote 1
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...