Data Realms Fan Forums
http://45.55.195.193/

GetMOFromID for a device in a craft
http://45.55.195.193/viewtopic.php?f=73&t=31835
Page 1 of 1

Author:  Awpteamoose [ Wed Oct 03, 2012 8:33 am ]
Post subject:  GetMOFromID for a device in a craft

So, I made this mod. I modified the code to not check if it's held by an actor and tried to load it into a craft and the invisible brain lost track of the TDExplosive.
I'm not exactly sure how everything works, but GetMOFromID returns MO of the Actor if the device is held by him, but why does it return nil if it's inside a craft? How can I get MO of the craft in such case?
Code:
function Create(self)
   self.tracker = CreateTDExplosive("Brain","PocketBrain.rte");
   self.tracker.Pos = self.Pos;
   MovableMan:AddMO(self.tracker);
end

function Update(self)
   local newHolder = MovableMan:GetMOFromID(self.tracker.RootID);
   --if MovableMan:IsActor(newHolder) then
        self.Pos = newHolder.Pos;
   --else self.Pos = self.tracker.Pos;
   --end
   if self.tracker.ToDelete == true then
      self.GibThis(self);
   end
end

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