Jump to content
  • 0

Timer that continues when player relogs.


Genesis

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   2
  • Joined:  12/01/11
  • Last Seen:  

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?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

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;

 

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