Yoh Asakura 9 Posted April 13, 2015 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; } Quote Share this post Link to post Share on other sites
0 Litro 45 Posted April 13, 2015 (edited) 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 April 13, 2015 by Litro Quote Share this post Link to post Share on other sites
0 Yoh Asakura 9 Posted April 13, 2015 It's not working the delay function. No error in ssh. Quote Share this post Link to post Share on other sites
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)) {
function script CheckLastUse {
}
Share this post
Link to post
Share on other sites