Data Realms Fan Forums
http://45.55.195.193/

How to get parent
http://45.55.195.193/viewtopic.php?f=73&t=31557
Page 1 of 1

Author:  TND [ Wed Aug 08, 2012 6:53 pm ]
Post subject:  How to get parent

I have a TDExplosive I am making, and I want it to get a reference to whoever is holding it, if at all. How can I do that?

Thanks :grin:

Author:  Roast Veg [ Wed Aug 08, 2012 6:56 pm ]
Post subject:  Re: How to get parent

Code:
MovableMan:GetMOFromID(self.RootID)
You'll need to add in occasions for when there is no actor holding it though.

Author:  TND [ Wed Aug 08, 2012 7:36 pm ]
Post subject:  Re: How to get parent

What would I need to do? How do I get the ID of self? I'd assume you would check if self.RootID is equal to your own ID.

Edit: Nevermind, found the documentation! :D

Edit 2: No! D:
It doesn't work. This code, in Update, just says 255 as the ID and the RootID, no matter what circumstances, or how many of the item there are:
Code:
   print("ID: "..self.ID .. "     Root: "..self.RootID)
   if self.ID ~= self.RootID then
      self.ParentActor = ToActor(MovableMan:GetMOFromID(self.RootID))
      self.FutureTeam = self.ParentActor.Team
   end

(I'm trying to find the team of the actor holding the TDExplosive)

Author:  CaveCricket48 [ Wed Aug 08, 2012 9:25 pm ]
Post subject:  Re: How to get parent

If your TDExplosive is GetsHitByMOs = 0, then it will always report its RootID and its own ID as 255.

If an ID is 255, that means the object either doesn't exist any more or is GetsHitByMOs = 0.

Author:  TND [ Wed Aug 08, 2012 9:38 pm ]
Post subject:  Re: How to get parent

CaveCricket48 wrote:
If your TDExplosive is GetsHitByMOs = 0, then it will always report its RootID and its own ID as 255.

If an ID is 255, that means the object either doesn't exist any more or is GetsHitByMOs = 0.

Okay, I understand now. I think I have this figured out.

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