Jump to content

Recommended Posts

Posted

Hello,

 

i have a question about show and hide:

 

If i Hide an Object by this script

function Script:Show()--in
if (self.entity:Hidden()) then
self.entity:Show()
end
end
function Script:Hide()--in
if not self.entity:Hidden() then
self.entity:Hide()
end
end

 

then child are hide too.

 

But if i have an Object that is at "Start" hidden. Then the Childs ( the hole object) not show after i would show it . What i have to do that all Childs are show so i have not to put in every child a script with show ?

 

(the Childs are different Boxes and 2 ermitters)

 

i hope you can follow what i have written smile.png

Posted

Sorry, I'm not quite sure I follow but are you trying to make Show/Hide execute on all children? It would look something like this:

 

function Script:Show()
if self.entity:Hidden() then
self.entity:Show()
end

-- Show all children.
for i = 0, self.entity:CountChildren() - 1 do
local child = self.entity:GetChild(i)
if child:Hidden() then
child:Show()
end
end
end
function Script:Hide()
if not self.entity:Hidden() then
self.entity:Hide()
end

-- Hide all children.
for i = 0, self.entity:CountChildren() - 1 do
local child = self.entity:GetChild(i)
if not child:Hidden() then
child:Hide()
end
end
end

 

I feel like LE does this implicitly though... shouldn't be necessary.

Posted

ah ok at the moment i tryed to do the same but with no luck will try your version.. Thanks a lot. smile.png

 

Yeah, well wish I could help more because that code isn't necessary. Just tested and I was right, LE hides/shows the children implicitly. If you're referring to the "hidden" checkbox in the scene panel when you say "start as hidden" I don't think Show() will work to show it again. I'm not sure if it's a bug but it hasn't worked for quite a while.

  • 1 month later...
Posted

Sorry for a new question about this.

 

the script function good but not with a character model if i hide a character for example the merc with m4 and i will show the char at a Special Moment then the m4 is always hidden. Wy the child m4 does not show up? Is a char model with many bones as child a different child that has to be another script code ? Thanks for your help ... 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...