EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Delete Item on Player Death? (https://www.eqemulator.org/forums/showthread.php?t=41343)

Aquaojo 05-15-2017 03:30 PM

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!

ghanja 05-15-2017 03:34 PM

Event_death_complete

Aquaojo 05-15-2017 03:40 PM

Thanks ghanja! That was it mate.

Any way to use NukeItem (or something else) to just delete 1 quantity of a stack by chance?

Kingly_Krab 05-15-2017 03:52 PM

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


Aquaojo 05-15-2017 04:11 PM

Thanks Kingly - Doesn't seem to work, but I appreciate you taking time to try. Gives me some ideas on how it might work.

ghanja 05-15-2017 04:26 PM

Get rid of the last ) in the
Code:

if ($client->GetItemAt(
line

Kingly_Krab 05-15-2017 04:30 PM

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.

Aquaojo 05-15-2017 04:52 PM

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


All times are GMT -4. The time now is 09:39 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.