Jump to content
  • 0

How to add time delay to a warper npc?


Rain408

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

I currently using this code as a template

 

einbech,39,215,5 script Train Station Staff#ein3 852,{

mes "[staff]";
mes "Welcome to";
mes "the Train Station.";
mes "The fare to take the";
mes "train to Einbroch is";
mes "200 zeny. Would";
mes "you like to ride?";
next;
switch(select("Yes.:No.")) {
case 1:
if (Zeny > 199) {
mes "[staff]";
mes "Thank you and";
mes "we hope you enjoy";
mes "the ride. All aboard!";
close2;
set Zeny, Zeny-200;
warp "einbroch",226,276;
end;
}
else {
mes "[staff]";
mes "I'm sorry,";
mes "but you don't";
mes "have enough zeny";
mes "to pay the train fare.";
close;
}
case 2:
mes "[staff]";
mes "Please enjoy";
mes "your stay here";
mes "in Einbech.";
close;
}
 
And I'm wondering if it's possible to add in a time Delay, i would like it so that after people used the NPC they arent allowed to used it again for another mins.
The time delay is fix to each players who talks to the npc, and not the npc itself
 
The plan was to remove portals that take you to mvp maps, and where the portal was position. Replace it with a warping npc that warps them into the map. They wont able to use it again for 5 mins.
Edited by Rain408
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   0
  • Joined:  11/06/14
  • Last Seen:  

I was working on a delay and i got below logic. Try this one:

einbech,39,215,5 script Train Station Staff#ein3 852,{
	
	if(warpdelay > gettimetick(2)){ // Checks timer, if active it will block you from doing the quest.
		set .@delayremaining,(((warpdelay-gettimetick(2))+1)/60);
		mes "[Staff]";
		mes "You just have used the warper!";
		mes "Please wait "+.@delayremaining+" minutes longer.";
		close;
	}
	
	mes "[Staff]";
	mes "Welcome to";
	mes "the Train Station.";
	mes "The fare to take the";
	mes "train to Einbroch is";
	mes "200 zeny. Would";
	mes "you like to ride?";
	next;
		switch(select("Yes.:No.")) {
			case 1:
				if (Zeny > 199) {
					mes "[Staff]";
					mes "Thank you and";
					mes "we hope you enjoy";
					mes "the ride. All aboard!";
					close2;
					set Zeny, Zeny-200;
					warp "einbroch",226,276;
					set warpdelay,gettimetick(2)+60; // Sets delay for 60s
					end;
				}
				else {
					mes "[Staff]";
					mes "I'm sorry,";
					mes "but you don't";
					mes "have enough zeny";
					mes "to pay the train fare.";
					close;
				}
			case 2:
					mes "[Staff]";
					mes "Please enjoy";
					mes "your stay here";
					mes "in Einbech.";
					close;
		}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

 

I was working on a delay and i got below logic. Try this one:

einbech,39,215,5 script Train Station Staff#ein3 852,{
	
	if(warpdelay > gettimetick(2)){ // Checks timer, if active it will block you from doing the quest.
		set .@delayremaining,(((warpdelay-gettimetick(2))+1)/60);
		mes "[Staff]";
		mes "You just have used the warper!";
		mes "Please wait "+.@delayremaining+" minutes longer.";
		close;
	}
	
	mes "[Staff]";
	mes "Welcome to";
	mes "the Train Station.";
	mes "The fare to take the";
	mes "train to Einbroch is";
	mes "200 zeny. Would";
	mes "you like to ride?";
	next;
		switch(select("Yes.:No.")) {
			case 1:
				if (Zeny > 199) {
					mes "[Staff]";
					mes "Thank you and";
					mes "we hope you enjoy";
					mes "the ride. All aboard!";
					close2;
					set Zeny, Zeny-200;
					warp "einbroch",226,276;
					set warpdelay,gettimetick(2)+60; // Sets delay for 60s
					end;
				}
				else {
					mes "[Staff]";
					mes "I'm sorry,";
					mes "but you don't";
					mes "have enough zeny";
					mes "to pay the train fare.";
					close;
				}
			case 2:
					mes "[Staff]";
					mes "Please enjoy";
					mes "your stay here";
					mes "in Einbech.";
					close;
		}

Thanks, ill test it and see how it works

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...