Yoh Asakura
New member
- Messages
- 261
- Points
- 0
- Emulator
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.
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;
}
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;
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;
}