View unanswered posts | View active topics It is currently Sun Aug 25, 2019 3:29 pm



Reply to topic  [ 5 posts ] 
 finding held item 
Author Message
User avatar

Joined: Wed May 20, 2009 3:10 pm
Posts: 366
Location: Århus, Denmark
Reply with quote
Post 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 :/


Thu Sep 08, 2011 5:20 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1966
Location: The Netherlands
Reply with quote
Post 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


Thu Sep 08, 2011 6:10 pm
Profile
User avatar

Joined: Wed May 20, 2009 3:10 pm
Posts: 366
Location: Århus, Denmark
Reply with quote
Post 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.


Thu Sep 08, 2011 6:31 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3134
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: finding held item
Or, you could just use this:
Code:
ToAHuman(actor).EquippedItem


Thu Sep 08, 2011 11:12 pm
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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.


Thu Sep 08, 2011 11:18 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.017s | 15 Queries | GZIP : Off ]