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



Reply to topic  [ 5 posts ] 
 Making limbs gib upon gibbing of the body? 
Author Message
User avatar

Joined: Fri Sep 13, 2013 1:39 am
Posts: 157
Location: ᴱᵛᵉʳʸʷʰᵉʳᵉ
Reply with quote
Post 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.


Sat Jul 01, 2017 8:28 pm
Profile
User avatar

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


Sun Jul 02, 2017 8:50 am
Profile
User avatar

Joined: Fri Sep 13, 2013 1:39 am
Posts: 157
Location: ᴱᵛᵉʳʸʷʰᵉʳᵉ
Reply with quote
Post 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.


Sun Jul 02, 2017 12:32 pm
Profile
User avatar

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


Sun Jul 02, 2017 3:59 pm
Profile
User avatar

Joined: Fri Sep 13, 2013 1:39 am
Posts: 157
Location: ᴱᵛᵉʳʸʷʰᵉʳᵉ
Reply with quote
Post 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!


Sun Jul 02, 2017 4:56 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.155s | 15 Queries | GZIP : Off ]