Item script: On player death, resurrect, consume item

Wolfeh

New member
Messages
63
Points
0
Github
ItsWolfeh
Emulator
Basically I want to have a miscellaneous item (so the player does not attempt to consume it) that is consumed upon the player's death, and resurrects them (full health and everything). I've made several attempts through trial and error to no avail. If I can't do it purely through item script I will have to do an NPC.

 
Last edited by a moderator:
Just adjust the Item ID / Requirement in the OnInit.
Also use @autoheal to Enable/Disable the Auto Phoenix consumption. Inspired by Final Fantasy and brought to the table right to you. Enjoy
default_smile.png


Code:
-    script    AutoPhoenix    -,{
end;
 
OnAtAutoHeal:
if ( !AutoHealEnable ) {
    AutoHealEnable = 1;
    message strcharinfo(0),"[Auto-Heal] Passive skill activated.";
    end;
} else
if ( AutoHealEnable ) {
    AutoHealEnable = 0;
    message strcharinfo(0),"[Auto-Heal] Passive skill deactivated.";
end;
}
    
OnPCDieEvent:
if ( AutoHealEnable ) {
if (countitem( .ItemReq ) >= .ItemAm ) {
delitem .ItemReq, .ItemAm;
sleep2 1;
atcommand "@raise";
message strcharinfo(0),"[Auto-Heal] Consumed "+getitemname( .ItemReq ) +" x ("+.ItemAm+").";
end;
}
} else
end;
 
OnInit:
    .ItemReq = 501;
    .ItemAm = 1;
    bindatcmd "autoheal",strnpcinfo(0)+"::OnAtAutoHeal";
end;
}
 
Last edited by a moderator:
@@Wolfeh

Use item 7621 (Token of Siegfried) 

It is a misc item, and on death it adds the resurrection button to the game setting window (esc)

ac90a1387181100cff86a26aad100bf9.png


 
Last edited by a moderator:
Thanks everyone! @@Ridley that is weird that that item doesn't have a script but apparently it has a client function? O_o Decided to go with something like @@Legend script because I want the player to die and just be automatically resurrected, don't want the resurrection button and I don't need a message or anything for it (doesn't need to be too complicated). I do really appreciate the help though!

Edit: Idk on second thought might actually just replace Sieg token, because that would be nice for the players to choose whether or not they actually want to use it, and keeps them from using it accidentally. HNNNG DECISIONS.

 
Last edited by a moderator:
Back
Top