Page 1 of 1

King of noobs!

Posted: Sat Feb 17, 2007 12:49 am
by Merc
Hey Guys, I've spent countless hrs. here trying to learn even basic scripting with no such luck. I've looked at every subject titled noob and found them to be way above my head. lol Wondering if somebody here would be so kind as to help me with this? I want a kill trigger placed in the west entrance mg room of omaha beach, when touched would tell the player he is touching a kill trigger and has only a few seconds to move or they will die! I could use the whole code and told exactly where it needs to be placed. thanks in advance. Merc

Posted: Sat Feb 17, 2007 7:15 am
by bdbodger
Well try this as a guide


Q: Where is the trigger going to be located ?

first you need to find the "coord" or coordinates to do that run the map . It helps if you have logging enabled maybe use a shortcut to start the game like this one

"C:\Program Files\EA GAMES\MOHAA\MOHAA.exe" +set thereisnomonkey 1 +set developer 1 +set cheats 1 +logfile 2 +set ui_console 1

the +set logfile 2 will create a log file called qconsole.log in the main directory that you can open later . To find the "coords" you open the console and type coord then press enter that will show the point that you are standing and your view angles . It will also print that to the log so you can find it later from there too or write it down .

Q: Where in my script do I put the scripting ?

Well when any script is read it is read from the top to the first occurance of the word "end" .It can branch to other parts of the script called "threads" by having the word "thread" at the top before the "main" thread ends and by naming the thread to branch to . Threads run along side of the main thread and any other threads that are running .

Q: So where in my script do I put the scripting ?

There are 2 places to do it at the top or in a thread . The trigger can be spawned from the "main" thread but any thing the trigger does when triggered should be done in a thread . It can also be spawned inside of the thread .There is a second way other than useing the word thread in the main thread to start a thread and that is by giving your trigger a "key" and "value" .The key is the word "setthread" and the value is the thread you want to start when the trigger is triggered . Here is an example

local.trigger = spawn trigger_multiple origin ( 123 456 789)
local.trigger setthread mythread


That will start the thread "mythread" when the trigger is triggered . The trigger would already have to be spawned for it to exist and for players to be able to trigger it so most probably it would be spawned in the "main" thread but not nessesaraly it can be spawned in any thread that is run but you have to make sure that that thread is run to spawn the trigger so it can run the "mythread" thread when triggered .

Q: How big will the trigger be ?

That is the next "key" , "value" pair that you have to think about . The "key" is setsize and "value" is 2 opposite points front and back , top and bottom each is an offset from the "coords" . For example

local.trigger setsize ( -20 -20 0 )( 20 20 100 )

The first point is back , -20 from the "coords" and -20 to the side . The third value is 0 because when you type "coord" into the console it gives you a point that is at your feet where you are standing . The second point is 20 units in front of the coords and 20 units to the opposite side and 100 points above . With those 2 points the game can make a box shape and that box will be the size of your trigger .

local.trigger = spawn trigger_multiple origin ( 123 456 789)
local.trigger setthread mythread
local.trigger setsize ( -20 -20 0 )( 20 20 100 )


And there you have it , where , size and thread to run .That can be placed in the "main" thread to create the trigger .

Q: How do I tell the player he is touching a kill trigger?

There are 2 ways to do that the first way is to use a "key" , "value" pair . "key" message "value" your message .

local.trigger = spawn trigger_multiple origin ( 123 456 789)
local.trigger setthread mythread
local.trigger setsize ( -20 -20 0 )( 20 20 100 )
local.trigger message "my message"


The problem with that is the trigger will keep fireing and displaying the message but in this case we will be shutting the trigger off after is is triggered ( more about that later ) . The second way is to send a message to the player when the "mythread" starts .

mythread:

local.player = parm.other
local.player iprint "my message"


parm.other is the last player to trigger a trigger . You have to save that because another player in a different part of the map may trigger another trigger and ruin your thread so the way to save it when this thread starts is to assign the value of parm.other to a local variable that only has meaning inside of this thread . That is why they call it a local variable .

Q: So what do I put in my kill thread you called "mythread"?

In the "mythread" thread the trigger that called the thread to start using the setthread key will be known as "self" when done this way . The next step is to run a loop that checks if the player is touching the trigger and counts how long he is touching it for . The best way to do that is to do it inside of a "while" loop . A while loop runs as long as what the expression or condition you give it is true or 1 ( 1 being true and 0 being false )

while(local.player istouching self)

the loop starts with that and executes what is inside of the start brace "{" and end brace "}" as long as the expression is true or 1 . To create a timer all you need to do is to put a wait inside of the braces .

while(local.player istouching self)
{
wait 1
}

Now we have a loop that keeps looping every second as long as the player is touching the trigger .

Q: So how do we use that as a timer

What you do is to create a local.variable and add to it every time the "while" loop loops you do that before the loop starts

local.timer = 0

while(local.player istouching self)
{
local.timer++
wait 1
}


The ++ is just a faster way of adding 1 to the timer each time through the loop . The next thing you would want to do is to kill the player after a set amount of time . Easy enough to do just check the value of local.timer


while(local.player istouching self)
{

if(local.timer == 6)
{
radiusdamage local.player.origin 4000 256
break
}

local.timer++
wait 1
}


== is does not mean equal it is a comparison of 2 values and returns true or false . "break" ends the while loop . Now you can just kill the player or you can do an explosion that kills the player an easy way to do that is with a script called the global/model.scr . I know it does not sound like an explosion script but it is . All you have to give it is where .

while(local.player istouching self)
{

if(local.timer == 6)
{
exec global/model.scr local.player.origin
radiusdamage local.player.origin 4000 256
end
}

local.timer++
wait 1
}


With setthread the trigger keeps firing and starting new threads so we have to shut it off while the player is touching it . To do that use this command

self nottriggerable

to turn it back on use this command

self triggerable

so this the the whole script starting from the "main" thread

main:

local.trigger = spawn trigger_multiple origin ( 123 456 789)
local.trigger setthread mythread
local.trigger setsize ( -20 -20 0 )( 20 20 100 )

end

mythread:

local.player = parm.other
local.player iprint "my message"

self nottriggerable

while(local.player istouching self)
{

if(local.timer == 6)
{
exec global/model.scr local.player.origin
radiusdamage local.player.origin 4000 256
break
}

local.timer++
wait 1
}

self triggerable

end



So there you have it but that is not the only way there is also the global/minefield.scr which may be easier to use but will only give you a second before you die . To use it create trigger_multiples and give all of them the targetname "minefield" then execute this line in your script

exec global/minefield.sc::minefield_setup

example :

main:

local.trigger1 = spawn trigger_multiple origin ( 123 456 789)
local.trigger1 setsize ( -50 -50 0 )( 50 50 100 )
local.trigger1 targetname "minefield"

local.trigger2 = spawn trigger_multiple origin ( 987 654 321 )
local.trigger2 setsize ( -50 -50 0 )( 50 50 100 )
local.trigger2 targetname "minefield"

exec global/minefield.sc::minefield_setup

end


So it is up to you what way you want to do it .

King of noobs!

Posted: Sat Feb 17, 2007 9:44 pm
by Merc
Hey bdbodger, Thanks alot! very detailed. just what I needed! I believe I felt a couple brain cells move. Haven't had a chance to play around with it yet. I'll be on it soon. I'll keep this going incase a hit a snag. Thanks again!

King of noobs!

Posted: Mon Feb 19, 2007 9:55 pm
by Merc
I decided to use the first trigger method just so the player would have the option to either move or die. I'm getting a script error in logfile that states Script Error: Command 'istouching' applied to NULL listener. The trigger seems to be working. The warning message is appearing, but the player won't die. The King of noobs could use more help Thanks!

local.player

Posted: Mon Feb 19, 2007 10:25 pm
by tltrude
You'll need this line to let the script know who triggered it.

local.player = parm.other

It goes just before the "local.player istouching" line.

local.player

Posted: Mon Feb 19, 2007 11:16 pm
by Merc
Sry, I maybe should have posted the whole script. I did have it in there. Maybe in the wrong sequence? Heres the whole script. I'm starting to like this place! Nice guys, fast replies! I'll have to start bugging you guys more often. lol Thanks!

main:
setcvar "g_obj_alliedtext1" "Omaha Beach"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "objdm5"

switch (waitthread global/libmef/util.scr::get_gametype)
{
case "ctf":
case "ftctf":
case "dem":
case "ftdem":
waitthread setup_bases
break

case "obj":
case "ftobj":
thread objectivethread
break
}

if (level.mef_gametype != "obj" && level.mef_gametype != "ftobj")
{
// remove the bombs in a non-objective game
$88mm_trigger1 remove
$88mm_explosive1 remove
$88mm_trigger2 remove
$88mm_explosive2 remove

$bangalore_left remove
$bangalore_nopulse_left remove
$barbwire_clip_left remove
$barbwire_collision_left remove
$barbwire_left remove

$bangalore_center remove
$bangalore_nopulse_center remove
$barbwire_clip_center remove
$barbwire_collision_center remove
$barbwire_center remove

$bangalore_right remove
$bangalore_nopulse_right remove
$barbwire_clip_right remove
$barbwire_collision_right remove
$barbwire_right remove

$spawn_axis1 enablespawn // cliff edge and bunker
$spawn_axis2 enablespawn // cliff edge, bunker, inside
$spawn_axis3 enablespawn // west cannon
$spawn_axis4 enablespawn // east cannon

$spawn_allied1 enablespawn // shore
$spawn_allied2 enablespawn // wire (protected)
$spawn_allied3 enablespawn // wire (protected)
}

//KILL TRIGGER FOR WEST ENTRANCE MACHINE GUN ROOM

local.trigger = spawn trigger_multiple origin ( 2560.97 -220.87 -571.88 )
local.trigger setthread mythread
local.trigger setsize ( -32 -20 0 )( 32 20 100 )

level waittill prespawn

exec global/DMprecache.scr

thread global/minefield.scr::minefield_setup

$world northyaw 270

$world farplane 7500
$world farplane_color (0.675 0.663 0.651)

level.script = maps/obj/obj_team5.scr
exec global/ambient.scr obj_team5

level waittill spawn
if (level.mef_baseversion == "sh" || level.mef_baseversion == "bt")
{
$world commanddelay 0 farclipoverride -1
}

waitthread global/libmef/util.scr::waittill_roundstart

if (level.mef_gametype != "ft" && level.mef_gametype != "rbm")
{
thread random_explode_setup
}
end


setup_bases:
// remove the cannons
$88mm_weapon1 remove
$88mm_weapon2 remove

waitthread global/libmef/util.scr::read_gametype_settings

// common bases for dem and ctf
waitthread global/libmef/bases.scr::addbasepair "733 -1248 -503.88 -90 Allied Ammo Crate" "1334 1127 64.13 -31 Axis Cable Spool" indycrate cablespool
waitthread global/libmef/bases.scr::addbasepair "-862.58 -3072.64 -427.31 130 East Sherman Tank" "1609 -319 256.13 -90 West Bunker" shermantank cardtable ( 3 130 7 )
waitthread global/libmef/bases.scr::addbasepair "2261.73 -3038.84 -383.32 100 West Sherman Tank" "-1123 -702 256.13 -90 East Bunker" shermantank cardtable ( 0 100 3 )

// deep bases
if ((level.mef_gametype == "dem" || level.mef_gametype == "ftdem") && level.mef_deepbases)
{
waitthread global/libmef/bases.scr::addbasepair "1563 -5070 -480.84 90 West Higgins Boat" "-1110 1575 450 135 East Cannon" higginsboat 15cmcannon
waitthread global/libmef/bases.scr::addbasepair "-113 -5026 -477.99 90 East Higgins Boat" "2432 1365 451 45 West Cannon" higginsboat 15cmcannon
}

// additional bases for ctf only
if (level.mef_gametype == "ctf" || level.mef_gametype == "ftctf")
{
waitthread global/libmef/bases.scr::addbase allies "-1334 -2534 -232.16 -90 Beach East"
waitthread global/libmef/bases.scr::addbase allies "943 -2540 -275.42 -90 Beach Center"
waitthread global/libmef/bases.scr::addbase allies "2578 -2529 -209.46 -90 Beach West"
waitthread global/libmef/bases.scr::addbase axis "-602 241 341.14 -90 Cliff East"
waitthread global/libmef/bases.scr::addbase axis "167 316 314.52 -90 Cliff Center"
waitthread global/libmef/bases.scr::addbase axis "1071 290 298.99 -90 Cliff West"
}
end


objectivethread:

level waittill prespawn

$spawn_allied2 disablespawn
$spawn_allied3 disablespawn

$spawn_axis3 disablespawn
$spawn_axis4 disablespawn

$bangalore_nopulse_left hide
$bangalore_nopulse_center hide
$bangalore_nopulse_right hide

setcvar "g_obj_alliedtext1" "- Breach the shingle"
setcvar "g_obj_alliedtext2" "- Destroy two 15cm"
setcvar "g_obj_alliedtext3" "cannons"
setcvar "g_obj_axistext1" "- Prevent Allies from"
setcvar "g_obj_axistext2" "taking the beach"
setcvar "g_obj_axistext3" ""

level waittill spawn

level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 2

if (level.mef_gametype != "ftobj")
{
level.dmrespawning = 1 // 1 or 0
}

level.dmroundlimit = 10 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

waitthread global/libmef/util.scr::waittill_roundstart

$88mm_explosive1 thread global/libmef/bomb.scr::bomb_thinker
$88mm_explosive2 thread global/libmef/bomb.scr::bomb_thinker

$88mm_explosive1 thread axis_win_timer
thread allies_win_bomb

thread bomb1_exploded $88mm_explosive1
thread bomb2_exploded $88mm_explosive2

thread shingle_setup

end


//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------

axis_win_timer:

level waittill axiswin

end

//*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------

allies_win_bomb:

while(level.targets_destroyed < level.targets_to_destroy)
waitframe

waitthread global/libmef/util.scr::do_teamwin allies
end


//*** --------------------------------------------
//*** "Bomb 1 Exploded"
//*** --------------------------------------------

bomb1_exploded local.bomb1:

while (local.bomb1.exploded != 1)

wait .1

iprintlnbold "Allies have destroyed the Western Cannon!"

$spawn_axis2 disablespawn
$spawn_axis3 enablespawn

end


//*** --------------------------------------------
//*** "Bomb 2 Exploded"
//*** --------------------------------------------

bomb2_exploded local.bomb2:

while (local.bomb2.exploded != 1)

wait .1

iprintlnbold "Allies have destroyed the Eastern Cannon!"

$spawn_axis2 disablespawn
$spawn_axis4 enablespawn

end


//*** --------------------------------------------
//*** "Shingle"
//*** --------------------------------------------

shingle_setup:

thread shingle_left_start
thread shingle_center_start
thread shingle_right_start

end

shingle_left_start:
while ($bangalore_trigger_left != NULL)
{
$bangalore_trigger_left waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_left
end
}
}
end

shingle_left:

$bangalore_left playsound plantbomb1
$bangalore_left remove
$bangalore_nopulse_left show

wait 8

$bangalore_explosion_left1 anim start
$bangalore_explosion_left2 anim start
radiusdamage $bangalore_explosion_left2.origin 640 384
$bangalore_nopulse_left remove
$barbwire_clip_left remove
$barbwire_collision_left remove
$barbwire_left remove
$spawn_axis1 disablespawn

end

shingle_center_start:
while ($bangalore_trigger_center != NULL)
{
$bangalore_trigger_center waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_center
end
}
}
end

shingle_center:

$bangalore_center playsound plantbomb1
$bangalore_center remove
$bangalore_nopulse_center show

wait 8

$bangalore_explosion_center1 anim start
$bangalore_explosion_center2 anim start
radiusdamage $bangalore_nopulse_center.origin 640 384
$bangalore_nopulse_center remove
$barbwire_clip_center remove
$barbwire_collision_center remove
$barbwire_center remove
$spawn_axis1 disablespawn
$spawn_allied1 disablespawn
$spawn_allied2 enablespawn

end

shingle_right_start:
while ($bangalore_trigger_right != NULL)
{
$bangalore_trigger_right waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_right
end
}
}
end

shingle_right:

$bangalore_right playsound plantbomb1
$bangalore_right remove
$bangalore_nopulse_right show

wait 8

$bangalore_explosion_right1 anim start
$bangalore_explosion_right2 anim start
radiusdamage $bangalore_nopulse_right.origin 640 384
$bangalore_nopulse_right remove
$barbwire_clip_right remove
$barbwire_collision_right remove
$barbwire_right remove
$spawn_axis1 disablespawn
$spawn_axis2 enablespawn
$spawn_allied1 disablespawn
$spawn_allied3 enablespawn

end


//*** --------------------------------------------
//*** "Random Beach Explosions"
//*** --------------------------------------------

random_explode_setup:

thread random_explode1
thread random_explode2
thread random_explode3
thread random_explode4
thread random_explode5
thread random_explode6
thread random_explode7

end

random_explode1:

wait (randomfloat 13 + 23)

$random_explode1_origin playsound arty_leadinmp

wait 1

$random_explode1 anim start
radiusdamage $random_explode1_origin 256 384

goto random_explode1

random_explode2:

wait (randomfloat 7 + 20)

$random_explode2_origin playsound arty_leadinmp

wait 1

$random_explode2 anim start
radiusdamage $random_explode2_origin 256 384

goto random_explode2

random_explode3:

wait (randomfloat 9 + 18)

$random_explode3_origin playsound arty_leadinmp

wait 1

$random_explode3 anim start
radiusdamage $random_explode3_origin 256 384

goto random_explode3

random_explode4:

wait (randomfloat 12 + 18)

$random_explode4_origin playsound arty_leadinmp

wait 1

$random_explode4 anim start
radiusdamage $random_explode4_origin 256 384

goto random_explode4

random_explode5:

wait (randomfloat 15 + 22)

$random_explode5_origin playsound arty_leadinmp

wait 1

$random_explode5 anim start
radiusdamage $random_explode5_origin 256 384

goto random_explode5

random_explode6:

wait (randomfloat 8 + 15)

$random_explode6_origin playsound arty_leadinmp

wait 1

$random_explode6 anim start
radiusdamage $random_explode6_origin 256 384

goto random_explode6

random_explode7:

wait (randomfloat 10 + 24)

$random_explode7_origin playsound arty_leadinmp

wait 1

$random_explode7 anim start
radiusdamage $random_explode7_origin 256 384

goto random_explode7

end

mythread:

local.player = parm.other
local.player iprint "You are touching the kill trigger. MOVE OR DIE!"

self nottriggerable

while(local.player istouching self)
{

if(local.timer == 6)
{
exec global/model.scr local.player.origin
radiusdamage local.player.origin 4000 256
break
}

local.timer++
wait 1
}

self triggerable

end

self

Posted: Mon Feb 19, 2007 11:31 pm
by tltrude
Just replace the word "self" with the targetname of the trigger.

while(local.player istouching $kill_trigger)

If that is what it's named.

Re: self

Posted: Mon Feb 19, 2007 11:58 pm
by bdbodger
tltrude wrote:Just replace the word "self" with the targetname of the trigger.

while(local.player istouching $kill_trigger)

If that is what it's named.
you shouldn't have to when using setthread self is the trigger

No luck

Posted: Tue Feb 20, 2007 9:40 pm
by Merc
Hey Guys, I'm not having much luck here. It seems anything I try I keep getting the same script error or I lose the whole mod. I've tried moving it to different places in the script with the same results or worse. lol I'm back to what I posted earlier when I posted my whole script. Thanks.

self

Posted: Wed Feb 21, 2007 1:36 am
by tltrude
Try this version, without the "self" stuff.

Code: Select all

//KILL TRIGGER FOR WEST ENTRANCE MACHINE GUN ROOM 

local.trigger = spawn trigger_multiple origin ( 2561 -221 -572 ) 
local.trigger.targetname = "kill_trigger"
local.trigger setthread mythread 
local.trigger setsize ( -32 -20 0 )( 32 20 100 ) 
//====================================================

mythread: 

	local.player = parm.other 
	local.player iprint "You are touching the kill trigger. MOVE OR DIE!" 

	$kill_trigger nottriggerable
	local.player playsound mine_trigger 

	while(local.player istouching $kill_trigger) 
	{ 
		if(local.timer == 6) 
		{ 
			exec global/model.scr local.player.origin 
			radiusdamage local.player.origin 4000 256 
			local.player iprint "Boom!"  // remove line after debug
			break 
		} 
	local.timer++
	local.player iprint "Timer = " + (local.timer) // remove line after debug  
	wait 1 
	} 

	$kill_trigger triggerable 

end
I added a couple of debug lines -- remove them if it works.

self

Posted: Thu Feb 22, 2007 12:52 am
by Merc
Sry, couldn't seem to get it to work. I lost the message "You are touching the kill trigger. MOVE OR DIE!", All the Allied and Axis objective text, and sound. But no errors in logfile. Strange! Hope you guys aren't loosing to much hair over this. lol

post

Posted: Thu Feb 22, 2007 6:23 am
by tltrude
Can't help without more to go on. You must of messed up your threads. Please post your script again.

Threads

Posted: Thu Feb 22, 2007 7:03 pm
by Merc
That very well could be. Here it is. Thanks Tom.


// OMAHA BEACH OBJECTIVE DM
// BY ADAM "SENN" BELLEFEUIL

// **********************************************************************
// Extended-Gametype Mapscript Version 1.2.1 (05-14-05)
// By Mark Follett (Mefy)
// email: mef123@geocities.com
// web: www.planetmedalofhonor.com/mefy
// You are free to modify and redistribute as long as you keep these
// credits.
// **********************************************************************

main:
setcvar "g_obj_alliedtext1" "Omaha Beach"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "objdm5"

switch (waitthread global/libmef/util.scr::get_gametype)
{
case "ctf":
case "ftctf":
case "dem":
case "ftdem":
waitthread setup_bases
break

case "obj":
case "ftobj":
thread objectivethread
break
}

if (level.mef_gametype != "obj" && level.mef_gametype != "ftobj")
{
// remove the bombs in a non-objective game
$88mm_trigger1 remove
$88mm_explosive1 remove
$88mm_trigger2 remove
$88mm_explosive2 remove

$bangalore_left remove
$bangalore_nopulse_left remove
$barbwire_clip_left remove
$barbwire_collision_left remove
$barbwire_left remove

$bangalore_center remove
$bangalore_nopulse_center remove
$barbwire_clip_center remove
$barbwire_collision_center remove
$barbwire_center remove

$bangalore_right remove
$bangalore_nopulse_right remove
$barbwire_clip_right remove
$barbwire_collision_right remove
$barbwire_right remove

$spawn_axis1 enablespawn // cliff edge and bunker
$spawn_axis2 enablespawn // cliff edge, bunker, inside
$spawn_axis3 enablespawn // west cannon
$spawn_axis4 enablespawn // east cannon

$spawn_allied1 enablespawn // shore
$spawn_allied2 enablespawn // wire (protected)
$spawn_allied3 enablespawn // wire (protected)
}

//KILL TRIGGER FOR WEST ENTRANCE MACHINE GUN ROOM

local.trigger = spawn trigger_multiple origin ( 2561 -221 -572 )
local.trigger.targetname = "kill_trigger"
local.trigger setthread mythread
local.trigger setsize ( -32 -20 0 )( 32 20 100 )

level waittill prespawn

exec global/DMprecache.scr

thread global/minefield.scr::minefield_setup

$world northyaw 270

$world farplane 7500
$world farplane_color (0.675 0.663 0.651)

level.script = maps/obj/obj_team5.scr
exec global/ambient.scr obj_team5

level waittill spawn
if (level.mef_baseversion == "sh" || level.mef_baseversion == "bt")
{
$world commanddelay 0 farclipoverride -1
}

waitthread global/libmef/util.scr::waittill_roundstart

if (level.mef_gametype != "ft" && level.mef_gametype != "rbm")
{
thread random_explode_setup
}
end


setup_bases:
// remove the cannons
$88mm_weapon1 remove
$88mm_weapon2 remove

waitthread global/libmef/util.scr::read_gametype_settings

// common bases for dem and ctf
waitthread global/libmef/bases.scr::addbasepair "733 -1248 -503.88 -90 Allied Ammo Crate" "1334 1127 64.13 -31 Axis Cable Spool" indycrate cablespool
waitthread global/libmef/bases.scr::addbasepair "-862.58 -3072.64 -427.31 130 East Sherman Tank" "1609 -319 256.13 -90 West Bunker" shermantank cardtable ( 3 130 7 )
waitthread global/libmef/bases.scr::addbasepair "2261.73 -3038.84 -383.32 100 West Sherman Tank" "-1123 -702 256.13 -90 East Bunker" shermantank cardtable ( 0 100 3 )

// deep bases
if ((level.mef_gametype == "dem" || level.mef_gametype == "ftdem") && level.mef_deepbases)
{
waitthread global/libmef/bases.scr::addbasepair "1563 -5070 -480.84 90 West Higgins Boat" "-1110 1575 450 135 East Cannon" higginsboat 15cmcannon
waitthread global/libmef/bases.scr::addbasepair "-113 -5026 -477.99 90 East Higgins Boat" "2432 1365 451 45 West Cannon" higginsboat 15cmcannon
}

// additional bases for ctf only
if (level.mef_gametype == "ctf" || level.mef_gametype == "ftctf")
{
waitthread global/libmef/bases.scr::addbase allies "-1334 -2534 -232.16 -90 Beach East"
waitthread global/libmef/bases.scr::addbase allies "943 -2540 -275.42 -90 Beach Center"
waitthread global/libmef/bases.scr::addbase allies "2578 -2529 -209.46 -90 Beach West"
waitthread global/libmef/bases.scr::addbase axis "-602 241 341.14 -90 Cliff East"
waitthread global/libmef/bases.scr::addbase axis "167 316 314.52 -90 Cliff Center"
waitthread global/libmef/bases.scr::addbase axis "1071 290 298.99 -90 Cliff West"
}
end


objectivethread:

level waittill prespawn

$spawn_allied2 disablespawn
$spawn_allied3 disablespawn

$spawn_axis3 disablespawn
$spawn_axis4 disablespawn

$bangalore_nopulse_left hide
$bangalore_nopulse_center hide
$bangalore_nopulse_right hide

setcvar "g_obj_alliedtext1" "- Breach the shingle"
setcvar "g_obj_alliedtext2" "- Destroy two 15cm"
setcvar "g_obj_alliedtext3" "cannons"
setcvar "g_obj_axistext1" "- Prevent Allies from"
setcvar "g_obj_axistext2" "taking the beach"
setcvar "g_obj_axistext3" ""

level waittill spawn

level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 2

if (level.mef_gametype != "ftobj")
{
level.dmrespawning = 1 // 1 or 0
}

level.dmroundlimit = 10 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

waitthread global/libmef/util.scr::waittill_roundstart

$88mm_explosive1 thread global/libmef/bomb.scr::bomb_thinker
$88mm_explosive2 thread global/libmef/bomb.scr::bomb_thinker

$88mm_explosive1 thread axis_win_timer
thread allies_win_bomb

thread bomb1_exploded $88mm_explosive1
thread bomb2_exploded $88mm_explosive2

thread shingle_setup

end


//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------

axis_win_timer:

level waittill axiswin

end

//*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------

allies_win_bomb:

while(level.targets_destroyed < level.targets_to_destroy)
waitframe

waitthread global/libmef/util.scr::do_teamwin allies
end


//*** --------------------------------------------
//*** "Bomb 1 Exploded"
//*** --------------------------------------------

bomb1_exploded local.bomb1:

while (local.bomb1.exploded != 1)

wait .1

iprintlnbold "Allies have destroyed the Western Cannon!"

$spawn_axis2 disablespawn
$spawn_axis3 enablespawn

end


//*** --------------------------------------------
//*** "Bomb 2 Exploded"
//*** --------------------------------------------

bomb2_exploded local.bomb2:

while (local.bomb2.exploded != 1)

wait .1

iprintlnbold "Allies have destroyed the Eastern Cannon!"

$spawn_axis2 disablespawn
$spawn_axis4 enablespawn

end


//*** --------------------------------------------
//*** "Shingle"
//*** --------------------------------------------

shingle_setup:

thread shingle_left_start
thread shingle_center_start
thread shingle_right_start

end

shingle_left_start:
while ($bangalore_trigger_left != NULL)
{
$bangalore_trigger_left waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_left
end
}
}
end

shingle_left:

$bangalore_left playsound plantbomb1
$bangalore_left remove
$bangalore_nopulse_left show

wait 8

$bangalore_explosion_left1 anim start
$bangalore_explosion_left2 anim start
radiusdamage $bangalore_explosion_left2.origin 640 384
$bangalore_nopulse_left remove
$barbwire_clip_left remove
$barbwire_collision_left remove
$barbwire_left remove
$spawn_axis1 disablespawn

end

shingle_center_start:
while ($bangalore_trigger_center != NULL)
{
$bangalore_trigger_center waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_center
end
}
}
end

shingle_center:

$bangalore_center playsound plantbomb1
$bangalore_center remove
$bangalore_nopulse_center show

wait 8

$bangalore_explosion_center1 anim start
$bangalore_explosion_center2 anim start
radiusdamage $bangalore_nopulse_center.origin 640 384
$bangalore_nopulse_center remove
$barbwire_clip_center remove
$barbwire_collision_center remove
$barbwire_center remove
$spawn_axis1 disablespawn
$spawn_allied1 disablespawn
$spawn_allied2 enablespawn

end

shingle_right_start:
while ($bangalore_trigger_right != NULL)
{
$bangalore_trigger_right waittill trigger
local.player = parm.other

if (local.player.dmteam != axis && !local.player.mef_spectator)
{
waitthread shingle_right
end
}
}
end

shingle_right:

$bangalore_right playsound plantbomb1
$bangalore_right remove
$bangalore_nopulse_right show

wait 8

$bangalore_explosion_right1 anim start
$bangalore_explosion_right2 anim start
radiusdamage $bangalore_nopulse_right.origin 640 384
$bangalore_nopulse_right remove
$barbwire_clip_right remove
$barbwire_collision_right remove
$barbwire_right remove
$spawn_axis1 disablespawn
$spawn_axis2 enablespawn
$spawn_allied1 disablespawn
$spawn_allied3 enablespawn

end


//*** --------------------------------------------
//*** "Random Beach Explosions"
//*** --------------------------------------------

random_explode_setup:

thread random_explode1
thread random_explode2
thread random_explode3
thread random_explode4
thread random_explode5
thread random_explode6
thread random_explode7

end

random_explode1:

wait (randomfloat 13 + 23)

$random_explode1_origin playsound arty_leadinmp

wait 1

$random_explode1 anim start
radiusdamage $random_explode1_origin 256 384

goto random_explode1

random_explode2:

wait (randomfloat 7 + 20)

$random_explode2_origin playsound arty_leadinmp

wait 1

$random_explode2 anim start
radiusdamage $random_explode2_origin 256 384

goto random_explode2

random_explode3:

wait (randomfloat 9 + 18)

$random_explode3_origin playsound arty_leadinmp

wait 1

$random_explode3 anim start
radiusdamage $random_explode3_origin 256 384

goto random_explode3

random_explode4:

wait (randomfloat 12 + 18)

$random_explode4_origin playsound arty_leadinmp

wait 1

$random_explode4 anim start
radiusdamage $random_explode4_origin 256 384

goto random_explode4

random_explode5:

wait (randomfloat 15 + 22)

$random_explode5_origin playsound arty_leadinmp

wait 1

$random_explode5 anim start
radiusdamage $random_explode5_origin 256 384

goto random_explode5

random_explode6:

wait (randomfloat 8 + 15)

$random_explode6_origin playsound arty_leadinmp

wait 1

$random_explode6 anim start
radiusdamage $random_explode6_origin 256 384

goto random_explode6

random_explode7:

wait (randomfloat 10 + 24)

$random_explode7_origin playsound arty_leadinmp

wait 1

$random_explode7 anim start
radiusdamage $random_explode7_origin 256 384

goto random_explode7

end

mythread:

local.player = parm.other
local.player iprint "You are touching the kill trigger. MOVE OR DIE!"

$kill_trigger nottriggerable
local.player playsound mine_trigger

while(local.player istouching $kill_trigger)
{
if(local.timer == 6)
{
exec global/model.scr local.player.origin
radiusdamage local.player.origin 4000 256
local.player iprint "Boom!" //remove line after debug
break
}
local.timer++
local.player iprint "Timer = " + (local.timer) //remove line after debug
wait 1
}

$kill_trigger triggerable

end

?

Posted: Sat Mar 03, 2007 7:05 pm
by Merc
Did everyone give up on this?