Data Realms Fan Forums http://868000.nnhp.asia/ |
|
Making limbs gib upon gibbing of the body? http://868000.nnhp.asia/viewtopic.php?f=73&t=46184 |
Page 1 of 1 |
Author: | RandomCoderZ [ Sat Jul 01, 2017 8:28 pm ] |
Post subject: | Making limbs gib upon gibbing of the body? |
I'm looking for a simple way to make limbs attached to a body gib (Dissapear) upon not being attached to the body anymore. Any help is appreciated. |
Author: | CaveCricket48 [ Sun Jul 02, 2017 8:50 am ] |
Post subject: | Re: Making limbs gib upon gibbing of the body? |
Something like Code: function Update(self) if self.RootID == self.ID then self:GibThis(); end end .RootID is the ID of the root MO. So, the RootID of a limb is the torso ID. When the limb is detached/the torso is destroyed, the RootID of the limb will match the limb's ID, since it's no longer connected. |
Author: | RandomCoderZ [ Sun Jul 02, 2017 12:32 pm ] |
Post subject: | Re: Making limbs gib upon gibbing of the body? |
CaveCricket48 wrote: Something like Code: function Update(self) if self.RootID == self.ID then self:GibThis(); end end .RootID is the ID of the root MO. So, the RootID of a limb is the torso ID. When the limb is detached/the torso is destroyed, the RootID of the limb will match the limb's ID, since it's no longer connected. Hello! Thanks for the help. I see! So i applied it both to the body and the limbs, on different occasions. Though none of them would work. If applied to legs and arms i get this error in console. And once added to the body the Actor instaGibs upon spawning. Code: ERROR: [string "Legs.Obj00163 = ToLeg(MovableMan.ScriptedEn..."]:1: attempt to call global 'ToLeg' (a nil value) ERROR: [string "Legs.Obj00164 = ToLeg(MovableMan.ScriptedEn..."]:1: attempt to call global 'ToLeg' (a nil value) ERROR: [string "Arms.Obj00165 = ToArm(MovableMan.ScriptedEn..."]:1: attempt to call global 'ToArm' (a nil value) ERROR: [string "Arms.Obj00166 = ToArm(MovableMan.ScriptedEn..."]:1: attempt to call global 'ToArm' (a nil value) CaveCricket48 wrote: When the limb is detached/the torso is destroyed I think we misunderstood eachother, I meant as in destroying the arms and legs when the torso is destroyed. They are big so they look weird when they just fall off when the Actor dies. Thank You. |
Author: | CaveCricket48 [ Sun Jul 02, 2017 3:59 pm ] |
Post subject: | Re: Making limbs gib upon gibbing of the body? |
RandomCoderZ wrote: I think we misunderstood eachother, I meant as in destroying the arms and legs when the torso is destroyed. Yeah, I got that. If the RootID ~= self.ID on a limb, that means it's no longer attacher to the parent body, the torso. If it's no longer attached to the torso, that means the torso was destroyed. Anyways, here's a fixed version of the script. This needs to go on the actor, not the limbs, because apparently limbs can't have scripts. Make sure you do the AI integration thing, and change the name of the limbs. Code: function Create(self) self.limbList = {}; for i = 1, MovableMan:GetMOIDCount()-1 do local mo = MovableMan:GetMOFromID(i); if mo.RootID == self.ID and (mo.PresetName == "Dummy Arm FG A" or mo.PresetName == "Dummy Arm BG A" or mo.PresetName == "Dummy Leg FG A" or mo.PresetName == "Dummy Leg BG A") then self.limbList[#self.limbList+1] = mo; end end end function Destroy(self) for i = 1, #self.limbList do if self.limbList[i].ID ~= 255 then ToMOSRotating(self.limbList[i]):GibThis(); end end end |
Author: | RandomCoderZ [ Sun Jul 02, 2017 4:56 pm ] |
Post subject: | Re: Making limbs gib upon gibbing of the body? |
So limbs cant have scripts eh? Interesting, that's good to know. Anyway, Thank you very much. That worked wonders. I couldn't have achieved this by my self! |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |