Page 2 of 5
Posted: Wed Feb 11, 2004 1:51 am
by M&M
[DL]-[Gen] Dragon wrote:, where do i write the scripting stuff
i guess that means u dont have a .scr file for ur map.if u do then add the script there under waittill spawn,if not then u have 2 make a .scr file .look
hereand c how a basic script is done then add ur thread under waittill spawn.oh and use notepad 2 type all this stuff then save it as a .scr file.hope that helped

script
Posted: Thu Feb 12, 2004 1:29 am
by tltrude
What he posted is called a "thread". A script is made from any number of these threads. Threads normally start with the thread "name:" and stop with the word "end".
You can make a simple script for your map with Notpad or Wordpad. Most multiplayer deathmatch or team deathmatch map scripts will start with a "main:" thread like the one below.
BTW, the "//" marks tell the game to ignore what follows on that line.
Code: Select all
// MAP NAME
// ARCHITECTURE: Your name
// SCRIPTING: Your name
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Map Name"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
// exec global/door_locked.scr::lock
level.script = maps/dm/yourmapname.scr
exec global/ambient.scr mohdm7 // background sound
level waittill spawn
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
// level waittill roundstart // remove slash marks for final script
end
Your new thread for the bridge would go at the bottom of the page. Also, go through the script lines and find where your name, or your map name, need to be. The script file must be named the same as your bsp file (compiled map) and be in the same folder. Be sure to change the extention of the script file from ".txt" to ".scr". If the script loads, you should hear the wind blowing in the game and, hopefully, your bridge will open when the trigger is used.
main/maps/dm
.....................yourmapname.bsp
.....................yourmapname.scr
Hope that helps!
Posted: Thu Apr 01, 2004 8:39 pm
by HDL_CinC_Dragon
um, how do i tell my computer to say "hey! thats not a screen saver! Its a script for the best map ever made!"? is there something in the "properties" of the file that i have to do? or is there an alternate .name I can save it as so that MOH:AA can read it and my comp knows what it is?
file type
Posted: Thu Apr 01, 2004 10:50 pm
by tltrude
Under "File Type" in Windows you can change what program is used to open .scr files (Notepad or Wordpad). Also in Winzip, you can uncheck the option for automatically installing screensavers.
Posted: Fri Apr 02, 2004 8:00 pm
by HDL_CinC_Dragon
thanx tom
Posted: Sat Apr 03, 2004 3:51 am
by HDL_CinC_Dragon
Shortricci wrote:bridge:
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateyup -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 25
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateydown -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 1
end
um say that my map is called....... uhhh...... "blah"
ok, I open up notepad and I type the stuff I need. I save it as "Blah.scr". How do I tell me map that I want it to play that script when I press the button or pull the lever or whatever? can ya help me out?
Trigger
Posted: Sat Apr 03, 2004 11:47 am
by tltrude
It can be done a number of ways. One way is to put this key value in the properties of the trigger.
Key: setthread
Value: bridge
that will run the thread whenever a player presses the use key at the trigger. But, the bridge will get confused if a player hits the use key again and again before the bridge is finished moving. You can stop that by turning the trigger off in the script, "$bridge_trigger nottriggerable". And, turning it back on when the bridge is done, "$bridge_trigger triggerable".
But there is an easier way. Just have the thread wait for the trigger to be pressed like this.
main:
level waittill prespawn
thread bridge
level waittill spawn
end
bridge:
$bridge_trigger waittill trigger
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateyup -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 25
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateydown -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 1
goto bridge
end
The first orange line starts the thread and the next orange line is where the thread waits for someone to press their use key at the trigger. The third orange line resets the thread to wait again. Of course, your trigger would have to be targetnamed "bridge_trigger".
Hpe that helps!
Posted: Sat Apr 03, 2004 4:38 pm
by HDL_CinC_Dragon
yes it does, thanx. Heresanother question. When im writing the script, do I need all those $'s?
sorry Im botherin you guys with such common questions

$
Posted: Sun Apr 04, 2004 9:08 am
by tltrude
The "$" sign tells the script to look for that targetname in the map.
Posted: Wed Apr 07, 2004 11:55 pm
by HDL_CinC_Dragon
Can someone please write me the script I would need for my
Elivator
Switch:
Key: Targetname
Value:
ES
to activate my
Elivator
Brush
Key: Targetname
Value:
EB
Also, please tell me if I got the Keys and Values right. Thnx.
Screenies:
I want this switch:
to make this elevator bursh:

go here:
to do this, the EB would have to travel 334 world units upwards to get to the top.
I know this may be a bit to ask but im desperate

please help me

Posted: Mon Apr 12, 2004 7:18 pm
by HDL_CinC_Dragon
Ok, for my elevator this is what I did... Please check my work
I put this in for the Trigger>Use
Key: target
Value: E1
Then I put this in the for the elevator brush Script>Object
Key: targetname
Value: E1
And now there is a red line and arrow linking them like it would a teleport. Now for the script I only want it to go up 300 units, wait 5 seconds, and go down 300 units. Now I dont care about sound for now I just want to darn thing to work. please check my script for errors and tell me what I did wrong.
Code: Select all
main:
level waittill prespawn
thread E1
level waittill spawn
end
E1:
$E1 waittill trigger
$E1 loopsound lighthouse_run
$E1 time 10
$E1 movexup 300
$E1 waitmove
$E1 stoploopsound lighthouse_run
wait 5
$E1 loopsound lighthouse_run
$E1 time 10
$E1 movexdown 300
$E1 waitmove
$E1 stoploopsound lighthouse_run
wait 1
goto E1
end
moveup
Posted: Mon Apr 12, 2004 8:54 pm
by tltrude
The elevator must be a different targetname from the trigger.
$EB moveUp 300
$EB waitmove
and
$EB moveDown 300
$EB waitmove
To make the switch animate it is:
$ES anim on
$ES playsound alarm_switch // or click
$ES anim off
$ES playsound alarm_switch // or click
Also, when you put "$EB time 10" it will stay at 10 forever. So, you can put that line in prespawn or in an elevator_prep thread. You need a wait before it starts moving so the player has time to get on, or you can bind the switch and trigger to the elevator, so they move with it.
$ES bind $EB
$E1 bind $EB
Those lines would also go in prespawn or elevator_prep.
Posted: Mon Apr 12, 2004 10:27 pm
by HDL_CinC_Dragon
ya lost me there

Re: Trigger
Posted: Tue Apr 13, 2004 1:40 am
by kai0ty
tltrude wrote:It can be done a number of ways. One way is to put this key value in the properties of the trigger.
Key: setthread
Value: bridge
that will run the thread whenever a player presses the use key at the trigger. But, the bridge will get confused if a player hits the use key again and again before the bridge is finished moving. You can stop that by turning the trigger off in the script, "$bridge_trigger nottriggerable". And, turning it back on when the bridge is done, "$bridge_trigger triggerable".
But there is an easier way. Just have the thread wait for the trigger to be pressed like this.
main:
level waittill prespawn
thread bridge
level waittill spawn
end
bridge:
$bridge_trigger waittill trigger
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateyup -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 25
$mybridge loopsound lighthouse_run
$mybridge time 10
$mybridge rotateydown -65
$mybridge waitmove
$mybridge stoploopsound lighthouse_run
wait 1
goto bridge
end
The first orange line starts the thread and the next orange line is where the thread waits for someone to press their use key at the trigger. The third orange line resets the thread to wait again. Of course, your trigger would have to be targetnamed "bridge_trigger".
Hpe that helps!
use waitthread instead of setthread so the trigger will "turn off" so to speak until the move is done.
names
Posted: Tue Apr 13, 2004 10:00 am
by tltrude
[DL]-[Gen] Dragon - according the script you posted, the trigger_use and the elevator have the same targetname.
$E1 waittill trigger
The above line will hold the script from running until a player hits his use key, while looking at a trigger named "E1".