Data Realms Fan Forums
http://45.55.195.193/

finding held item
http://45.55.195.193/viewtopic.php?f=73&t=25458
Page 1 of 1

Author:  akblabla [ Thu Sep 08, 2011 5:20 pm ]
Post subject:  finding held item

Is it possible to find the item currently held by an actor? Or alternatively just force it out of his hand. I've tried actor:DropAllInventory(), but it only drops his inventory obviously :/

Author:  Gotcha! [ Thu Sep 08, 2011 6:10 pm ]
Post subject:  Re: finding held item

Does this help :???:

It's a bit from a lua script from CaveCricket, but I am sure he won't mind. :)

funtion Create(self) bit
Code:
   for i = 1,MovableMan:GetMOIDCount()-1 do
      gun = MovableMan:GetMOFromID(i);
    if gun.PresetName == "<presetname of gun>" and gun.ClassName == "HDFirearm" then
      actor = MovableMan:GetMOFromID(gun.RootID);


funtion Update(self) bit
Code:
   if MovableMan:IsActor(self.parent) and self.parentgun.ID ~= 255 and self.parent:HasObject("<presetname of gun>") then

Author:  akblabla [ Thu Sep 08, 2011 6:31 pm ]
Post subject:  Re: finding held item

Gotcha! wrote:
Does this help :???:

It's a bit from a lua script from CaveCricket, but I am sure he won't mind. :)



Thanks, it worked.

Now the tradestar selling module will detect the held device of the sold actor as well.

Author:  TheLastBanana [ Thu Sep 08, 2011 11:12 pm ]
Post subject:  Re: finding held item

Or, you could just use this:
Code:
ToAHuman(actor).EquippedItem

Author:  Asklar [ Thu Sep 08, 2011 11:18 pm ]
Post subject:  Re: finding held item

Hah, I forgot that thing too. Along with accesing the arms and legs using actor.FGArm or actor.FGLeg.

Maybe I should make a gun that makes the FGArm gib. That would be cool.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/