Jump to content
  • 0

Count time and show the time left


Tywin Lannister

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/23/16
  • Last Seen:  

I want to make an NPC that can be talked to only 12 or 24 hours after you talked with him for the first time.

 

But, how do i do that? gettimetick? If yes, how to make "long times count" like 12 hours? And there is any way to show that, for example, "you must wait 11 hours and 35mins to be anabled to talk again"?

 

And, if possible, a way to make that count worth for the whole account, and not for each character in the account.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  03/18/16
  • Last Seen:  

// on talk with NPC set perm char variable to current timetick, and a variable for indicating that the player has talked to npc:
set char_timer, gettimetick(2);
set has_talked, 1;
		
// check with an 'if()' case, which text to output. Is has_talked == 1, then go to:

L_wait_time:
		set .@char_time,char_timer+43200; // 12 hours
		set .@cur_time,gettimetick(2);
		set .@npc_next_t,(.@char_time - .@cur_time);
		set .@npc_h,(.@npc_next_t / 3600);
		set .@npc_m,(.@npc_next_t - (.@npc_h * 3600)) / 60;
		set .@npc_s,.@npc_next_t - ((.@npc_h * 3600) + (.@npc_m * 60));

		mes "You have to wait " + .@dun_h + "hours " + .@dun_m + "minutes " + .@dun_s + "seconds before you can talk to me agin.";
		close;

Try something like this, it is taken from Endless Tower script (Line 271~). Didn't test it, so if it doesn't work, check ET script for a template :)

Edited by moik
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...