![Post Post](./styles/images/imageset/icon_topic_latest.gif)
CreateHDFirearm and AddInventoryItem resutls in ID=255 ?
EDIT: For future visitors stumbling upon this:
The issue with ID = 255 is the "GetsHitByMOs = 0" property on the Weapon!
--------
I first add a fist item to my actor upon spawning them
Code:
self.actor = ToActor(self)
if not (self.actor:HasObject("Fist")) then
local newFist = CreateHDFirearm("Fist", "The5");
self.actor:AddInventoryItem(newFist);
end
And then later I try to access the weapons ID:
Code:
function The5Lib.GetWeaponHeldByID(obj)
local MO = ToMovableObject(obj) --even tried casting to MO to make sure I get the ID
if (MO.RootID == MO.ID or MO.RootID == 255) then return -1
else return MO.RootID
end
end
Both ID and RootID return 255.
Been 6 years since I last modded CC, so bare with me here ;)