Scripts / Show / Hide

Author
Message
Big Dog Game Studios
12
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 17:59 Edited at: 6th Mar 2015 22:50
Hey all,

Another quick question here (I am actually getting the hang of Lua), If I trigger a Hide(e) for a specific entity in my level by using a trigger zone, the object is indeed hidden. However, when I try to run Show(e) to bring the object back (either through another trigger zone or by setting a script to use on an object), the entity is still hidden. Anyone run into this before? Thank you in advance for any help on this
Big Dog Game Studios
12
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 18:35 Edited at: 6th Mar 2015 22:49
***Update***

I figured it out but decided to post an update for anyone else who runs into this problem. I started out with a trigger zone that hid an entity with this simple script:



Now, I wanted the players to be able to make the hidden object, "purple", reappear. The problem is that once it is triggered in the zone, that is it.. it stays triggered. However, this can still be done by destroying the zone and then calling for the entity to reappear, like so:



This is the best way that I have found to re-display a hidden object. Hope this helps
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2015 20:14
i think the problem is just that the first script has no condition - i.e. no in zone check? - so just constantly hides the object.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Big Dog Game Studios
12
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 21:34 Edited at: 6th Mar 2015 22:49
That is because if you use a zone check, the moment you leave the zone then the object hides again. So, by destroying the original zone once you accomplish the first task seems ideal to me.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2015 21:58
im not sure i understand, is this not what you're after?


basically i have 2 zones with a check and depending on which zone you enter it either hides or shows the object

(just need to set the entity number of the object to hide/show in 1 of the scripts - i used the show script)
Quote: "entity = 2
function show_init(e)

end

function show_main(e)

if g_Entity[e]['plrinzone'] == 1 then
Show(entity)
end

end"


and to hide

Quote: "function hide_init(e)

end

function hide_main(e)

if g_Entity[e]['plrinzone'] == 1 then
Hide(entity)
end

end"
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Big Dog Game Studios
12
Years of Service
User Offline
Joined: 18th Jun 2012
Location: Port Angeles, WA
Posted: 6th Mar 2015 22:49
Yes, I understand the code. For some reason (even when I tried it on my test level), once I leave the trigger zone, the object vanishes again. Hmmm... I'll look more into this, now you have me wondering lol

Login to post a reply

Server time is: 2024-12-21 14:50:02
Your offset time is: 2024-12-21 14:50:02