Page 1 of 2
Linking a door with a switch to open/close
Posted: Tue May 31, 2005 8:20 pm
by mcunha98
Hi,
I make a map and have a idea of use a door (door, dont is rotationdoor) with two dispositives to open/close (one dispositive in each side (in/out) of door).
Exist a tutorial to show this technique ????
Posted: Tue May 31, 2005 8:33 pm
by Axion
Posted: Tue May 31, 2005 8:38 pm
by Master-Of-Fungus-Foo-D
not to spam but i have question:
can you also name the switch (the switcch being on that can animate) door1 and have it animate when the trigger is fire?
[trigger connects to door and switch... hit trigger, switch animates and door turns]
Posted: Tue May 31, 2005 8:54 pm
by Axion
Sure. Just place you animated switch model wherever you want and give it a targetname of doorswitch.
Then, just give your trigger_use these additional values:
targetname:
doorswitch_trigger
setthread:
switchmove
Then, in your script:
Code: Select all
switchmove:
level.doorswitch_on = 0
$doorswitch_trigger waittill trigger
if (level.doorswitch_on == 0)
{
level.doorswitch_on = 1
$doorswitch playsound alarm_switch
$doorswitch anim on
end
}
if (level.doorswitch_on == 1)
{
level.doorswitch_on = 0
$doorswitch playsound alarm_switch
$doorswitch anim off
end
}
end
I'm pretty sure that should work. If it doesn't, I'll do some tweaking.
Posted: Tue May 31, 2005 9:36 pm
by mcunha98
Axion
Thanks for your indication, is very simple the tutorial, but very good !
My unique question, is possible make two triggers/targets for a unique door,
Code: Select all
------------------------------
| t1 d |
| o |
| o |
| r t2 |
------------------------------
Posted: Tue May 31, 2005 10:00 pm
by Axion
Yes, it is possible.
I'm making a test map now to double check the scripting I posted earlier. When I'm finished I'll give you a link to download the example map if you'd like to study it.
Posted: Tue May 31, 2005 10:08 pm
by Master-Of-Fungus-Foo-D
uhm i meant w/o a script... (not to bog you down with two tasks)
Posted: Tue May 31, 2005 10:28 pm
by Axion
Well, to my knowledge I don't think it's possible to command an animate_object to move without commanding it to do so through script commands.
Posted: Tue May 31, 2005 10:47 pm
by Axion
Here's a link to download the example map (Don't be fooled by the name, I added onto an already existing tutorial map of mine):
http://webzoom.freewebs.com/axion9/down ... torial.zip
If you want to play the map to test out the door, you'll have to load it like a single-player map. Open up the console and type the following:
map test_sit_tutorial
The hit enter and the map will load.
By the way, here is how I ended up scripting the door switches-
Code: Select all
switchmove1:
$doorswitch1_trigger waittill trigger
iprintln "The door has been triggered!"
$doorswitch1_trigger nottriggerable
$doorswitch1 anim turn
$doorswitch1 playsound alarm_switch
wait 3
$doorswitch1_trigger triggerable
$doorswitch1 anim off
goto switchmove1
end
switchmove2:
$doorswitch2_trigger waittill trigger
iprintln "The door has been triggered!"
$doorswitch2_trigger nottriggerable
$doorswitch2 anim turn
$doorswitch2 playsound alarm_switch
wait 3
$doorswitch2_trigger triggerable
$doorswitch2 anim off
goto switchmove2
end
Posted: Wed Jun 01, 2005 3:50 pm
by mcunha98
Axion
I read your tutorial, really is very good.
But when i make the door, i have some questions:
1) I set the var "wait " to -1, none return, when i open the door using the trigger, if i press "E" again the door not close (never). Is possible control the open / close action using the switch ?
2) When i open the door, the default sound is the common sound of a door,how i play a specific sound of ubersound.scr while the door is opened.
Some to comment, exist a website with "scrolling doors" textures (gates or some like this) ????
Posted: Wed Jun 01, 2005 4:16 pm
by Green Beret
Master-Of-Fungus-Foo-D wrote:not to spam but i have question:
can you also name the switch (the switcch being on that can animate) door1 and have it animate when the trigger is fire?
[trigger connects to door and switch... hit trigger, switch animates and door turns]
Im sure you can, Just change the anim from idle to on?
Does this sound close?
Posted: Wed Jun 01, 2005 4:26 pm
by Axion
mcunha98 wrote:
1) I set the var "wait " to -1, none return, when i open the door using the trigger, if i press "E" again the door not close (never). Is possible control the open / close action using the switch ?
2) When i open the door, the default sound is the common sound of a door,how i play a specific sound of ubersound.scr while the door is opened.
Some to comment, exist a website with "scrolling doors" textures (gates or some like this) ????
1) I believe that if you make the door lockable with the global/door_locked.scr, it's possible. If the door being closed = locked, then pressing the switch to unlock it would open the door. Pressing the switch again would lock the door, making it close. I don't know if it's possible to fit all of that into just two switches (my feeble scripting brain isn't sure), so you may need to have two sets of switches (One set to open the door, and the other set to lock the door).
2) *Edit* You can specify different sounds for the door in the entity dialogue box. You just need to get the aliases for the different sounds and then specify them.
Posted: Wed Jun 01, 2005 6:35 pm
by mcunha98
2) When i open the door, the default sound is the common sound of a door,how i play a specific sound of ubersound.scr while the door is opened.
You tell to i simply make a sound in script file using scriptmaker, and based into the ALIAS of sound, example "door_open", put in dialogue with key soundopen and the alias name ?
Posted: Wed Jun 01, 2005 6:56 pm
by Axion
You would need to cache the sounds in your script.
Code: Select all
aliascache door_metal_open_move2 sound/mechanics/DoorMetalOpen_05.wav soundparms 1.2 0.2 0.8 0.2 160 1600 item loaded maps "dm obj
door_metal_open_move2 = the alias name. When you select the sounds you want for your door, you can give them your own alias names when you cache them in your script.
Once you cache all the sounds in your script, you would select your door in radiant and enter these key/values:
sound_move -
The alias to the sound you've selected for when the door opens and closes
sound_locked -
The alias to the sound that plays when the door is locked
You should also write your own custom ubersound.scr for your map and cache the sounds in there as well to avoid sound issues.
Posted: Wed Jun 01, 2005 8:11 pm
by mcunha98
Axion,
Thanks !!!!
You detailed the process in minimum items !
I will try put this changes in my map and return the result in this topic.