Jump to content
  • 0
Sign in to follow this  
Wolfeh

Item script: On player death, resurrect, consume item

Question

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.

Edited by Wolfeh

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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 :)

-    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;
}

Share this post


Link to post
Share on other sites
  • 0

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.

Edited by Wolfeh

Share this post


Link to post
Share on other sites
  • 0

That's what my script does. You can toggle on and off via typing @autoheal to consume said item automatically or not.

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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