Jump to content
  • 0
Yoh Asakura

Delay to use NPC

Question

How to add delay to use the npc again?

 

Example:

The player uses the NPC, like the healer, after that he needs to wait 1 hour to use it again.

 

I tried using function but it didin't work.

 

 

if (!callfunc("CheckLastUse",1,$@delay)) {

dispbottom "Desculpe mas você precisa esperar "+($@delay - (gettimetick(2) - @TLTime))+" segundos para utilizar meus serviços novamente.";
close;
}
percentheal 100,100;
sc_start 32, 240000, 10; // Increase Agi Duração: 999 sec
   sc_start 30, 240000, 10; // Blessing Duração: 999 sec
   skilleffect 29,0; // Increase Agi
   skilleffect 34,0; // Blessing
if(gethominfo(1)) healhomun 100,100;
goto L_END;
end;
 
L_END:
callfunc "SetLastUse",1;
end;

 

 

function script CheckLastUse {

set @TNPCID, getarg(0);
set @delay, $@delay;
set @TLTime, getd("$@NPT_" + getcharid(3) + "_" + @TNPCID);
if (!@TLTime) return 1;
set @TLEFT, (gettimetick(2) - @TLTime);
if (@TLEFT < @delay) return 0;
return 1;
}
 
function script SetLastUse {
set @TNPCID, getarg(0);
setd "$@NPT_" + getcharid(3) + "_" + @TNPCID, gettimetick(2);
return;

}

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

try this..

-    script    Healer    -1,{    if (Delay > gettimetick(2)) {        message strcharinfo(0),"Can be used on: "+callfunc("Time2Str", Delay);        end;    }    percentheal 100,100;    sc_start 32, 240000, 10; // Increase Agi Duração: 999 sec    sc_start 30, 240000, 10; // Blessing Duração: 999 sec    skilleffect 29,0; // Increase Agi    skilleffect 34,0; // Blessing    if (gethominfo(1)) healhomun 100,100;    Delay = gettimetick(2) +.Delay;    end;    OnInit:    .Delay = 3600; // value are in second    end;}
Edited by Litro

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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