Jump to content
  • 0

How to put time interval before player can talk to the NPC?


Currently

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  313
  • Reputation:   1
  • Joined:  01/22/12
  • Last Seen:  

How to put time interval before player can talk to the NPC?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  143
  • Reputation:   30
  • Joined:  12/23/11
  • Last Seen:  

Example 1:

    <NPC Header> {
        // We need to use attachnpctimer because the mes command below needs RID attach
        attachnpctimer;
        initnpctimer;
        npctalk "I cant talk right now, give me 10 seconds";
        end;
    OnTimer5000:
        npctalk "Ok 5 seconds more";
        end;
    OnTimer6000:
        npctalk "4";
        end;
    OnTimer7000:
        npctalk "3";
        end;
    OnTimer8000:
        npctalk "2";
        end;
    OnTimer9000:
        npctalk "1";
        end;
    OnTimer10000:
        stopnpctimer;
        mes "[Man]";
        mes "Ok we can talk now";
        detachnpctimer;
        // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
    }
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Try sleep2 after the header or gettimetick

 

prontera,150,150,5	script	truc	58,{
	sleep2 2000;	// 2 secs delay
	npctalk "hono hono hono";
	end;
}

 

prontera,150,150,5	script	truc 2	58,{
	if( @time_tick - gettimetick(2) > 2 ) end;
	@time_tick = gettimetick(2) + 2;	// current time in secs since.. long ago 	+2 secs
	npctalk "hono hono hono";
	end;
}

There are others commands but these are the usual

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

*sleep2 {<milliseconds>};

 

1000 milliseconds in one Second.

 

mes "[Marky]";
mes "Please wait for 5 seconds..";
sleep2 5000;
mes "Ok, All done";
Edited by Metamorphic
  • 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...