Page 1 of 1
scripting newbie
Posted: Tue Sep 16, 2003 11:04 pm
by SlasherZ
ok, please keep in mind i know
no scripting. i know one command, movenorth (orwhat everdicetion) # please tell me how to make this work
this is my script:
moveup 128
waitmove
movedown 128
how do i make this activated by a swich (like in liberation)
Re: scripting newbie
Posted: Wed Sep 17, 2003 9:49 am
by Bjarne BZR
SlasherZ wrote:ok, please keep in mind i know
no scripting. i know one command, movenorth (orwhat everdicetion) # please tell me how to make this work
this is my script:
moveup 128
waitmove
movedown 128
how do i make this activated by a swich (like in liberation)
Make a trigger_use around your switch graphics, give it
key/value setthread/up_n_down
Put this in your script...
Code: Select all
up_n_down:
moveup 128
waitmove
movedown 128
end
Posted: Wed Sep 17, 2003 12:46 pm
by SlasherZ
thanks, but it doesn't work right, here is my problem... when map loads door goes up and the doesn't come down.... trigger doesn't work
here is script:
// Door Test
// ARCHITECTURE: SlasherZ
// SCRIPTING: SlasherZ
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Door Test"
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
exec global/ambient.scr yourmapname
// may want to make your own ambient sounds, read the tut
level.script = "maps/dm/door.scr"
// remember to put in your map name
level waittill spawn
up_n_down:
$door moveup 134
$door waitmove 7
$door movedown 134
end
end
Posted: Wed Sep 17, 2003 1:16 pm
by Bjarne BZR
Try
Code: Select all
up_n_down:
if ($door.moving != 1)
{
$door.moving = 1
$door moveup 134
$door waitmove
$door movedown 134
$door waitmove
$door.moving = 0
}
end
The if stuff is to prevent multiple triggerings of the door.
( The error for you was that you had no move command after the movedown command )
Posted: Wed Sep 17, 2003 1:18 pm
by SlasherZ
ok thanks! this has helped me understand scripting a little more!

Posted: Wed Sep 17, 2003 1:22 pm
by Bjarne BZR
Glad to help.
Posted: Thu Sep 18, 2003 12:16 am
by nuggets
that will prevent multiple triggerings but it's un-needed with the script you have,
$door moveUp 134
$door speed 3 //will take 3 seconds to move to destination
$door waitmove //executes all directions, angles and speeds set for entity
/*therefore you'll need a $door waitmove or $door move after the
downward settings*/
$door moveDown 134
$door waitmove
triggering your thread
Posted: Thu Sep 18, 2003 2:06 am
by tltrude
The way you have the script, the door will open as soon as the player spawns. Your door thread should be after the "end" line.
---------------------------------------------
level waittill spawn
end
up_n_down:
$door moveup 134 //sets the direction and distance
$door waitmove //tells it to move and stops the script until it is done
wait 7 //wait for 7 seconds
$door movedown 134 //sets the direction and distance
$door move //tells it to move
end
---------------------------------------------
But, something has to tell this thread to run when the door is triggered. There are two ways you can do that. The first is to put the following key/value in the trigger_use:
Key: setthread
Value: up_n_down
That make the trigger run the thread when a player uses it.
The second way is to put the trigger's targetname into the script and start the thread in prespawn like this:
---------------------------------------------
level waittill prespawn
thread up_n_down // starts the thread
level waittill spawn
end
up_n_down:
$door_trigger waittill trigger //script waits here for the trigger event.
$door moveup 134
$door waitmove
wait 7
$door movedown 134
$door move
end
---------------------------------------------
This is a good practice door, but the same thing can be done by just making it a func_door with a targetname and "targeted" set. Then just target the door with the trigger_use.
Key: target
Value: door
A red line will connect the trigger and the door.