Hiding/Un-hiding is it Possible???

Post your scripting questions / solutions here

Moderator: Moderators

Shifty
Map Reviewer
Posts: 717
Joined: Sun Dec 15, 2002 11:53 pm
Location: UK
Contact:

Hiding/Un-hiding is it Possible???

Post by Shifty »

Would it be possible to use a trigger to hide/unhide things, i.e. if i walk to a location go through the trigger and something appears behind you. I'f so this would be very cool for my next Top Secret Map Plans 8)

Thanks
.MDT Webmaster, Mapper, Moddeler & Concept Artist
.Map Reviewer
Image
http://www.shiftys-bunker.tk Under Construction
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

What kind of thing?
Image
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

heh. I know exactly how you would go about this.

1. Create a trigger_multiple and give it a targetname of thetrigger.
2. Then create the object that you want to show/hide and give it a targetname of theobject.
3. In your .scr file, put in this code after level waittill spawn :

thread show_setup
end

show_setup:
$thetrigger waittill trigger
$theobject show
thread hide_setup
end

hide_setup:
$thetrigger waittill trigger
$theobject hide
thread show_setup
end


That should do it. Step in and out of the trigger to show and hide the object you want. Let me know if there is any other complications.

And jv, make sure I got it right this time. hehe :wink:
Shifty
Map Reviewer
Posts: 717
Joined: Sun Dec 15, 2002 11:53 pm
Location: UK
Contact:

Post by Shifty »

Cool thanks - if what im hoping to do works i'll put a little test map up :) if i cant get it to work ill let u know my idea and maybe some1 else can crack it.......
.MDT Webmaster, Mapper, Moddeler & Concept Artist
.Map Reviewer
Image
http://www.shiftys-bunker.tk Under Construction
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

MPowell1944 wrote: thread show_setup
end

show_setup:
$thetrigger waittill trigger
$theobject show
thread hide_setup
end

hide_setup:
$thetrigger waittill trigger
$theobject hide
thread show_setup
end

And jv, make sure I got it right this time. hehe :wink:
You're a champion in dodgy code Powell ;). Better not link threads to each other, it's kinda like a goto :).

This is what you want - right? You can now easily see the code loops forever:

Code: Select all

while(1)
{
    $thetrigger waittill trigger
    $theobject show
    wait 2    
    $thetrigger waittill trigger
    $theobject hide
}
I added a 'wait 2' to prevent infinite loops. Note that it's probably better to use separate triggers for hiding and showing instead.
Image
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

Directed at Shifty :

*Edit. Shifty I forgot to tell you to add $theobject hide after level waittill spawn in the first script I gave you. Just a heads up.*

I am the one that created working lights, and that involved showing and hiding the light and the corona, so I am positive that this will work. You can use different names if you want, I just used those as an example. Also, if you just want the object to show once and not have it show/hide, you can use these steps instead :

1. Create a trigger_multiple and give it a targetname of thetrigger and a setthread of showobject.
2. Then create the object that you want to show/hide and give it a targetname of theobject.
3. In your .scr file, put in this code after level waittill spawn :

$theobject hide
end

showobject:
$theobject show
$thetrigger remove
end

Directed at jv :

Your script is refined, and I know that mine threads other scripts, but I did this with my lights and it worked flawlessly. Oh and by the way, I finally caught a mistake you made. You have it to show from the beginning, but without it being hidden in the first place, you would have to reverse the script. No big deal, just pickin' on you.
Last edited by MPowell1944 on Mon Mar 10, 2003 6:35 pm, edited 1 time in total.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I think your script will go crazy when a player stays in the trigger for a while :roll:.
Image
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

It wont. The object will just keep showing and hiding. I would know.

I think you just like to argue with me alot. Fun fun fun. :wink:
Slyk
Lieutenant Colonel
Posts: 361
Joined: Sun Jul 14, 2002 12:42 am
Location: Elizabethtown, PA

Post by Slyk »

Ok, so the threads work, one way or the other. Isn't just safe to make any 'walk-into' trigger as small as possible to eliminate any camping inside it and freaking the trigger??? As for lights and other 'switch' related things, I'd guess making a moving switch would be best then with the trigger operating the hide/unhide. Of course you need switch scripting then, which can be taken from the TOW maps easily. I also think JV's wait line is a good idea depending on the situation...in an MP map you could have sheer mayhem with this system. :shock:
Shifty
Map Reviewer
Posts: 717
Joined: Sun Dec 15, 2002 11:53 pm
Location: UK
Contact:

Darn

Post by Shifty »

Ok i'll let u into what im playing with

Basicly when i'm at work - I get bored my mind wonders and I think about what I can try mapping, anyway I was thinking it would be cool to be able to parachute into the map basicly the reason i want the hide/unhide is after you've parachuted in you walk past the trigger and your chute is behind you (but i donw want it to be seen as you drop in.

Only the dam thing (mockup of chute - looks nothing like one) is visible when u spawn aghhhh heres my script

Code: Select all

main:

// set scoreboard messages 
setcvar "g_obj_alliedtext1" "" 
setcvar "g_obj_alliedtext2" "" 
setcvar "g_obj_alliedtext3" "" 
setcvar "g_obj_axistext1" "" 
setcvar "g_obj_axistext2" "" 
setcvar "g_obj_axistext3" "" 

setcvar "g_scoreboardpic" "none" //your score board picture 

level waittill prespawn

exec global/DMprecache.scr 

level.script = "para_test.scr" // remember to put in your map name 

level waittill spawn

$theobject hide

thread show_setup 
end 

show_setup: 
$thetrigger waittill trigger 
$theobject show 
thread hide_setup 
end 

hide_setup: 
$thetrigger waittill trigger 
$theobject hide 
thread show_setup 
end 
.MDT Webmaster, Mapper, Moddeler & Concept Artist
.Map Reviewer
Image
http://www.shiftys-bunker.tk Under Construction
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

MPowell1944 wrote:I think you just like to argue with me alot. Fun fun fun. :wink:
I don't :wink:
Image
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

Well, if you want to use a switch to toggle the object visibilty, then check out this modified version of my lightswitch tutorial. Yes it uses the thread command, but it works 100%. So no refining by jv is needed this time.

1. Create a switch by selecting animate_equipment_electric>>switch>>nopulse

2. Give the switch a targetname of object_switch

3. Create a trigger_use around the switch and give it a targetname of switch_trigger

4. Now create the object that you want to show/hide and give it a targetname of theobject

5. Enter the following script after level waittill spawn in your .scr file :

$theobject hide
thread object_show
end

object_show:
$switch_trigger triggerable
$switch_trigger waittill trigger
$switch_trigger nottriggerable
$object_switch anim turn
$object_switch playsound alarm_switch
wait .25
$theobject show
wait .5
thread object_hide
end

object_hide:
$switch_trigger triggerable
$switch_trigger waittill trigger
$switch_trigger nottriggerable
$object_switch anim off
$object_switch playsound alarm_switch
wait .25
$theobject hide
wait .5
thread object_show
end

Its as simple as that. Taken directly from my lightswitch tutorial. :wink:
Shifty
Map Reviewer
Posts: 717
Joined: Sun Dec 15, 2002 11:53 pm
Location: UK
Contact:

Post by Shifty »

K thx ill try that
.MDT Webmaster, Mapper, Moddeler & Concept Artist
.Map Reviewer
Image
http://www.shiftys-bunker.tk Under Construction
Shifty
Map Reviewer
Posts: 717
Joined: Sun Dec 15, 2002 11:53 pm
Location: UK
Contact:

Post by Shifty »

I know why it wasnt working before - for some reason the trigger keeps dissapearing i put it in the map save reopen it and its gone wot the hell is goin on there
.MDT Webmaster, Mapper, Moddeler & Concept Artist
.Map Reviewer
Image
http://www.shiftys-bunker.tk Under Construction
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

Its Radiant. Sometimes its glitchy and deletes part of .map files.
Post Reply