Jump to content
  • 0
Currently

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

Question

3 answers to this question

Recommended Posts

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

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

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.