Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2017, 03:30 PM
Aquaojo
Sarnak
 
Join Date: Feb 2012
Location: GA
Posts: 34
Default Delete Item on Player Death?

Is there a way to remove a certain item on player death? I want to check and see if players have a specific item and then delete it when they die.

Code:
sub EVENT_DEATH {
    if(plugin::check_hasitem($client, 86009)){

                quest::level(1);
		quest::setallskill(0);
		$client->NukeItem(86009);}
}
NukeItem seems to disrupt the death cycle.

Is there a way to use DeleteItemInInventory without knowing the exact slot the item will be in?

I can use qglobals, but I like the idea of players having to have an item.

Thanks as usual!
Reply With Quote
  #2  
Old 05-15-2017, 03:34 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Event_death_complete
Reply With Quote
  #3  
Old 05-15-2017, 03:40 PM
Aquaojo
Sarnak
 
Join Date: Feb 2012
Location: GA
Posts: 34
Default

Thanks ghanja! That was it mate.

Any way to use NukeItem (or something else) to just delete 1 quantity of a stack by chance?
Reply With Quote
  #4  
Old 05-15-2017, 03:52 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Try this:
Code:
sub EVENT_DEATH_COMPLETE {
    if (plugin::check_hasitem($client, 86009)) {
        quest::level(1);
        quest::setallskill(0);
        $client->DeleteItemInInventory(FindFirstSlot(86009), 1, 1);
    }
}

sub FindFirstSlot {
    my $item = shift;
    foreach my $slot (0..30, 251..340, 2000..2023, 2031..2271, 2500, 2501, 2531..2550, 9999) {
        if ($client->GetItemAt($slot) && $client->GetItemIDAt($slot) == $item) {
            return $slot;
        }
    }
}

Last edited by Kingly_Krab; 05-15-2017 at 04:29 PM..
Reply With Quote
  #5  
Old 05-15-2017, 04:11 PM
Aquaojo
Sarnak
 
Join Date: Feb 2012
Location: GA
Posts: 34
Default

Thanks Kingly - Doesn't seem to work, but I appreciate you taking time to try. Gives me some ideas on how it might work.
Reply With Quote
  #6  
Old 05-15-2017, 04:26 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Get rid of the last ) in the
Code:
if ($client->GetItemAt(
line
Reply With Quote
  #7  
Old 05-15-2017, 04:30 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Ah yeah, I was in a rush and accidentally put an extra ) at the end. I don't test stuff before I post it, it's usually just to give you something to use as an example. Hope I helped though.
Reply With Quote
  #8  
Old 05-15-2017, 04:52 PM
Aquaojo
Sarnak
 
Join Date: Feb 2012
Location: GA
Posts: 34
Default

Boom! Thanks again mates. Both of ya. I would've never gotten that. Really appreciated.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:17 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3