pryans / kcd-cheat

KCD Cheat Mod
https://www.nexusmods.com/kingdomcomedeliverance/mods/106
20 stars 13 forks source link

Get equipped items #12

Closed Andargor closed 4 years ago

Andargor commented 4 years ago

Have you figured out how to determine which items are equipped? I can iterate via player.inventory:GetInventoryTable(), but there is no indication of which items are equipped.

pryans commented 4 years ago

I don't remember. I found these commented out in my code: player.actor:UnequipInventoryItem(weapon) player.actor:EquipInventoryItem(weapon) player.human:GetItemInHand(0)

Andargor commented 4 years ago

Yeah I saw those. The two first actually make a change, but with no indication if there's something in the slot. And GetItemInHand is for the weapons only. I was hoping to get all of the equipped gear, including armor.

I've also tried something like this, but it only seems to give the items that need to be rendered:

for i,userdata in pairs(player.inventory:GetInventoryTable()) do
    local item = ItemManager.GetItem(userdata);
    local itemEntId = XGenAIModule.GetEntityIdByWUID( item.id );
    local itemSlot = EntityModule.GetSlotItemClassId(itemEntId);

(...do something with itemSlot...)

end