Jump to content

is OnZombieDead, only supposed to return the outfit items at the time the event is firing?


Xyberviri

Recommended Posts

So i wrote this to trouble shoot a issue i was seeing with trying to mess with loot from my mod, i wanted to change some mod data on the items that spawn on zombies but not ones that were crafted or spawned in by a admin.  The issue is im only able to see the items worn on a zed when this event fires.

local function zombieDead(zombie)    
    local inv = zombie:getInventory():getItems();
    for i = 0, inv:size() - 1 do
        local item = inv:get(i)
        print("ZEDLOOT: "..item:getFullType())
    end
end
Events.OnZombieDead.Add(zombieDead);

If i kill a zombie only the items on that zombie are being returned when i get the inventory. The Hand Fork on this zombie was in its back

 

324f7d407d.jpg

 

here is another one where the matches and wallet had to be added after the event fires:

7e32b39004.jpg

 

this one wasnt able to see the lighter.

bbf8bd1ce1.png

 

Im trying to figure out if this is intended behavior or if there is something else up since the only use cases in the game of this event aren't dealing with the inventory of the corpse. And other mods all seem to just be checking for the outfit to see if they want to add inventory not mess with existing. But the issue is im going to have to write my own loot tables if i want to do that.

Edited by Xyberviri
Link to comment
Share on other sites

  • Xyberviri changed the title to is OnZombieDead, only supposed to return the outfit items at the time the event is firing?

Hi,

 

As you noticed, at the time the IsoDeadCorpse container is created:

1- the visible items (clothes, worn weapons..) are transferred from the  "just dead" IsoZombie to the IsoDeadCorpse.

2- the invisible items are created.

 

If you wanna mess with loots that pop up at IsoDeadCorpse time, without using the loot tables, there is a (twisted) way:

- Store the IsoZombie identifier when the Zombie Dies.

- When a new container is reacheable (OnRefreshInventoryWindowContainers) check it is a Dead corpse, check the associated IsoZombie identifier matches a Zombie newly dead, add your loot.

Link to comment
Share on other sites

16 hours ago, Tchernobill said:

OnRefreshInventoryWindowContainers

 

Ah thanks for the tip I played with this the other day with another object and didnt think about checking the container that way. that gives me somethign to work with.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...