EquippedItem Property Troubles [Solved]
So I'm trying to improve the scripts for visible inventory. These scripts are applied to attachables, the root object of which are AHumans. But if I try to access the EquippedItem property on a pointer to the root MO, it comes up as nil even when the actor is holding something.
An example of one of my attempts to access it:
Code:
function Update(self)
self.rootofdevice = MovableMan:GetMOFromID(self.RootID)
if self.rootofdevice then
if self.rootofdevice:IsActor() then
self.operator = ToActor(self.rootofdevice)
print(ToHDFirearm(self.operator.EquippedItem).PresetName)
end
end
end
ERROR: call of overloaded function '(nil)' is ambiguous
none of the overloads have a best conversion:(Entity*)
(const Entity*)
A functional example from the vanilla human AI:
Code:
AimPos = ToHDFirearm(self.EquippedItem).MuzzlePos