Jump to content
  • 0

Timer that continues when player relogs.


Question

Posted

Hi,

 

I currently have a NPC that sets a timer on a player like so:

 

addtimer 7200000, "NPC::Tag";

when they finish a particular quest. This timer serves as a way to stop them from doing the quest again for 2 hours.

I am also using OnPCLoginEvent to reset the timer when they login. However, I'd like to make it so it doesn't add the timer again, but instead, continues the existing timer.

 

I was thinking of setting a variable and having it decrease by 1 every second, and that variable being the "time left." However, I do not know how to implement this using the eA/rA scripting language. Any suggestions?

1 answer to this question

Recommended Posts

  • 1
Posted

I think a better way to handle this is to add a player variable that holds a timestamp when he last finished a quest you've made.

example:

OnQuestFinish:
	set CustomQuestTimeStamp, gettimetick(2);
	end;

OnQuestCheck:
	set @TimeDelay, gettimetick(2) - CustomQuestTimeStamp;
	if (@TimeDelay < (.TimeBeforeAplayerCanDoThisQuestAgain))
    	mes "Sorry you can't do this quest right now. Please come back later.";
	 	close;
    else {
		//... quest stuff here
	}
	end;
                                                            
OnInit:
   	set .TimeBeforeAplayerCanDoThisQuestAgain, 1 * 86400; //60 secs/min * 60 mins/hr * 24 hrs/day * how many days you want
	end;

 

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