Help with a lever activated door (script_mover)


(BlackStorm) #1

Ok I’ve got the basic of shaders, scripting, and map making down. The next I wanted to tackle was lever activated doors (im talking about the type of doors located in battery by the gun where u can siwtch a lever and they open/close. I followed as close as I could to what they did map wise and script wise but when I go to activate mine, the script_movers float away into space lol.

here is what it looks like:

Trigger is trigger_invisilbe_user which targets a target_script_trigger to call main in door_trigger, pathcorners are obvoiusly to define the markers and are named the same in the script.

and here is the script:

//
// Door
//
door1
{
spawn
{
}

trigger open
{
wait 500
playsound sound/movers/misc/big_gate1.wav
wait 400
playsound sound/movers/misc/big_gate2.wav looping forever
gotomarker door_uppos 32 wait
stopsound
playsound sound/movers/misc/big_gate3.wav
}

trigger close
{
wait 500
playsound sound/movers/misc/big_gate1.wav
wait 400
playsound sound/movers/misc/big_gate2.wav looping forever
gotomarker door_downpos 32 wait
stopsound
playsound sound/movers/misc/big_gate3.wav
}
}

door_lever
{
spawn
{
}

trigger down
{
gotomarker door_lever_downpos 16
trigger door1 open
}

trigger up
{
gotomarker door_lever_uppos 16
trigger door1 close
}
}

door_trigger
{
spawn
{
accum 6 set 1
}

trigger main
{
trigger door_trigger door_leverup
trigger door_trigger door_leverdown
}

trigger door_leverup
{
accum 6 abort_if_not_equal 1
resetscript

  	trigger door_lever up
  	accum 6 set 0

}

trigger door_leverdown
{
accum 6 abort_if_not_equal 0
resetscript

  	trigger door_lever down
  	accum 6 set 1

}

trigger setaccum0
{
accum 6 set 0
}

trigger setaccum1
{
accum 6 set 1
}
}

I was sort of copying off of tc_base’s gate which is the exact idea I want, but with just 1 lever instead of 2. I hope it isnt a stupid mistake but I am stepping into unknown territory so I am unsure how to resolve it. Do I need a orgin brush somewhere?? I was looking at the gate in tc_base but I didnt see any.

Thanks.


(DerSaidin) #2

The brush which goes up and down needs an origin. The origin is what will be moved to the parth corner.

Also, you dont need a target_script_trigger
Just make sure your func_invisible_user has a script name

then do

thefuncinvisuserscriptname
{
activate
{
//do stuff to open door here
}
}

If you want put the word “axis” or “allied” after the word “activate” to make it only for one team.

If your looking for an example, you can find one in the source of adlernest… theres a link to that omewhere on these forums.


(Loffy) #3

Hi BlackStorm
Yup, all script movers need an origin brush.
it is just a cube (or any shape really), with the texture “origin” (found under the texture-heading Common) that is forced by the mapper (in radiant) to merge with the script_mover.
Shift-click the cube, then shift-click the script_mover. When both are selected, right-click in the 2D window and select “move into entity” (or something like that, cannot remember).


(Flippy) #4

like said above, all script_movers need an origin brush (and a scriptname). I always tend to make the origin brush the same size as the path_corner entities, because the script_mover behaves like this:

say you have a platform that you want to rise upwards. you make a path_corner where it should stop. But the game doesn’t know by default which PART of your script_mover should stop at the path_corner. If you make an origin brush (which is part of the script_mover) , the script_mover will stop when its origin brush reaches the path_corner.

Note that the origin brush can be anywhere in your map, even if it’s like 100 meters away from your scriptmover… (but ofcourse that wouldn’t be very smart… :stuck_out_tongue: ). It doesn’t have to be in the middle.
Therefor you can also use only 1 path_corner for multiple script_movers (quickly judging by your image, you have 2 path_corners to define where to close the door, one for the left door and one for the right i assume).
If you make the origin brush at the side of the door you can use only one script_mover for the closing motion


(BlackStorm) #5

Thanks guys for your help, added some orgin brushes and it the gate and level open/close/shift correctly! :smiley: