Data Realms Fan Forums
http://forums.datarealms.com/

Attachable: self.RootID = self.ID? What?
http://forums.datarealms.com/viewtopic.php?f=73&t=46131
Page 1 of 1

Author:  Xery [ Mon Jan 09, 2017 8:14 am ]
Post subject:  Attachable: self.RootID = self.ID? What?

Now I'm modding a sniper gun, which uses Lua to charge and fire bullets.
So I added an attachable with Lua script:

to the HDFirearm:


and then used:
Code:
   if not self.gun then
      print("1");
      if self.RootID == self.ID then
         print("3");
      end
      mo = MovableMan:GetMOFromID(self.RootID);
      if IsHDFirearm(mo) then
         print("2");
         self.gun = ToHDFirearm(mo);
      end
...

to check it. It print "3", the RootID of the attachable is its self.ID. :???:
The attachable thing did attach to the gun in game. Oh and, even with DrawAfterParent = 0, it showed beyond the sniper. What's wrong?

Author:  CaveCricket48 [ Mon Jan 09, 2017 3:22 pm ]
Post subject:  Re: Attachable: self.RootID = self.ID? What?

MOs that have GetsHitByMOs = 0 will have the null MOID (255), and using RootID on them will return the null MOID as well.

Since both the ID and RootID are 255, it printed 3.

Basically, you can't use ID as a means of figuring out attachments/parents if it's GetsHitByMOs = 0

Author:  Xery [ Tue Jan 10, 2017 4:48 am ]
Post subject:  Re: Attachable: self.RootID = self.ID? What?

CaveCricket48 wrote:
MOs that have GetsHitByMOs = 0 will have the null MOID (255), and using RootID on them will return the null MOID as well.
Since both the ID and RootID are 255, it printed 3.
Basically, you can't use ID as a means of figuring out attachments/parents if it's GetsHitByMOs = 0


Oh...that explains it. Thanks a lot!

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