JavaGuy
09-23-2002, 09:37 PM
So...I made a simple elevator script (the idea being that once I got it working I could add all the cool cusom features I want rather than be constrained by simple trigger-based 'vators) and threw it into my map with all the appropriate entities. I ripped the basic idea from the elevator tutorial over at massassi.net. My version of the script is below.
I fire up my map and push the button. It makes the beeping sound like it's supposed to, but then the elevator just disappears! Where could it have gone?
//Generated by BehavEd
rem ( "PARM1 - func_static, elevator, script_targetname" );
rem ( "PARM2 - ref_tag, up position, targetname" );
rem ( "PARM3 - ref_tag, down position, targetname" );
rem ( "PARM4 - func_usable, active button, targetname" );
rem ( "PARM5 - func_usable, inactive button, targetname" );
rem ( "PARM6 - Either up or down" );
sound ( CHAN_AUTO, "sound/movers/switches/switch1.mp3" );
rem ( "Start moving, so hide inactive button and show active button" );
affect ( get( STRING, "SET_PARM4"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "true" );
}
affect ( get( STRING, "SET_PARM5"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "false" );
}
rem ( "Move the elevator" );
declare ( STRING, "elevator_destination" );
if ( get( STRING, "SET_PARM6") = "up" )
{
rem ( "Move elevator up" );
set ( "elevator_destination", get( STRING, "SET_PARM2") );
}
else ( )
{
rem ( "Move elevator down" );
set ( "elevator_destination", get( STRING, "SET_PARM3") );
}
task ( "move_elevator" )
{
affect ( get( STRING, "SET_PARM1"), FLUSH )
{
move ( tag( get(STRING, "elevator_destination"), ORIGIN), 2000 );
}
}
dowait ( "move_elevator" );
free ( "elevator_destination" );
rem ( "Stop moving, so show inactive state button and hide active state button" );
affect ( get( STRING, "SET_PARM4"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "false" );
}
affect ( get( STRING, "SET_PARM5"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "true" );
}
I fire up my map and push the button. It makes the beeping sound like it's supposed to, but then the elevator just disappears! Where could it have gone?
//Generated by BehavEd
rem ( "PARM1 - func_static, elevator, script_targetname" );
rem ( "PARM2 - ref_tag, up position, targetname" );
rem ( "PARM3 - ref_tag, down position, targetname" );
rem ( "PARM4 - func_usable, active button, targetname" );
rem ( "PARM5 - func_usable, inactive button, targetname" );
rem ( "PARM6 - Either up or down" );
sound ( CHAN_AUTO, "sound/movers/switches/switch1.mp3" );
rem ( "Start moving, so hide inactive button and show active button" );
affect ( get( STRING, "SET_PARM4"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "true" );
}
affect ( get( STRING, "SET_PARM5"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "false" );
}
rem ( "Move the elevator" );
declare ( STRING, "elevator_destination" );
if ( get( STRING, "SET_PARM6") = "up" )
{
rem ( "Move elevator up" );
set ( "elevator_destination", get( STRING, "SET_PARM2") );
}
else ( )
{
rem ( "Move elevator down" );
set ( "elevator_destination", get( STRING, "SET_PARM3") );
}
task ( "move_elevator" )
{
affect ( get( STRING, "SET_PARM1"), FLUSH )
{
move ( tag( get(STRING, "elevator_destination"), ORIGIN), 2000 );
}
}
dowait ( "move_elevator" );
free ( "elevator_destination" );
rem ( "Stop moving, so show inactive state button and hide active state button" );
affect ( get( STRING, "SET_PARM4"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "false" );
}
affect ( get( STRING, "SET_PARM5"), FLUSH )
{
set ( "SET_FUNC_USABLE_VISIBLE", "true" );
}