View unanswered posts | View active topics It is currently Tue Mar 19, 2024 5:52 am



Reply to topic  [ 3 posts ] 
 Attachable: self.RootID = self.ID? What? 
Author Message
User avatar

Joined: Sat Feb 26, 2011 10:29 am
Posts: 163
Reply with quote
Post 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?


Mon Jan 09, 2017 8:14 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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


Mon Jan 09, 2017 3:22 pm
Profile
User avatar

Joined: Sat Feb 26, 2011 10:29 am
Posts: 163
Reply with quote
Post 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!


Tue Jan 10, 2017 4:48 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.550s | 15 Queries | GZIP : Off ]