Page 2 of 2

Posted: Thu Mar 24, 2005 10:01 pm
by wacko
u can set a trigger inactive by

Code: Select all

$allies1 nottriggerable //allies1 is the targetname u gave the trigger
and active again by

Code: Select all

$allies1 triggerable //allies1 is the targetname u gave the trigger
Setting it nottriggerable in the 1st line of ur spawnchange thread would make it execute the thread just once.
On the other hand, what u need might be rather a variable like local.whotriggeredme and execute the spawnchange thread only if this variable has changed

Posted: Thu Mar 24, 2005 10:06 pm
by wacko

Code: Select all

spawnchange1: 
local.player = parm.other 
if ( (local.player.dmteam=="allies" ) && !(level.whotriggeredsp1 == local.player.dmteam))
   { 
   level.alliedprogress++
   level.whotriggeredsp1 = local.player.dmteam
    for (local.i = 1; local.i <= 5; local.i++) 
      { 
      $("allied" + local.i) disablespawn 
      $("allied" + (local.i + 5)) enablespawn 
      $("axis" + local.i) disablespawn 
      $("axis" + (local.i + 5)) enablespawn 
      } 
   wait 1 
   } 
if ( (local.player.dmteam=="axis" )  && !(level.whotriggeredsp1 == local.player.dmteam))

   { 
   level.alliedprogress-- 
   level.whotriggeredsp1 = local.player.dmteam
   for (local.i = 1; local.i <= 5; local.i++) 
      { 
      $("allied" + local.i) enablespawn 
      $("allied" + (local.i + 5)) disablespawn 
      $("axis" + local.i) enablespawn 
      $("axis" + (local.i + 5)) disablespawn 
      } 
   wait 1 
   }  
end 

Posted: Thu Mar 24, 2005 10:48 pm
by Ski
I tried the code you had for the spawn trigger with the variable and it works great for Allies side... it only sets the thread once... but when I switch to the axis team and stand in the trigger it still keeps moving the bar everytime the trigger acts. Do I need split this into two different triggers??

Thank you so much!!! this is so close now I just want to get it done.

Ski

Posted: Thu Mar 24, 2005 10:49 pm
by wacko
ooops, there's a typo :oops: it must be level.whotriggeredsp1 like everywhere else
i changed it now in my last post :wink:

Posted: Fri Mar 25, 2005 5:25 pm
by Ski
Well I used triggerable/nottriggerable to turn the triggers on and off... it seems to be working.. but not the greatest. I think it must be the placement of the spawns.

I would like to use the spawn thread that you recommended but with the way my spawns are numbered I am not sure how it would work. I could send the script your way to take a look at it??

Ski

Posted: Fri Mar 25, 2005 11:40 pm
by wacko
If u had in ur map
7 triggers t1 - t7
and before t1 4 spawnpoints sp1 - sp4 for allies
and after t7 4 spawnpoints sp29 - sp32 for axis
and between the triggers groups of 4 spawnpoints: sp5 - sp8 (allies), sp9 - sp12 (axis), sp13 - sp16 (aliies), sp17 - sp20 (axis), sp21 - sp24 (allies) and sp25 - sp28 (axis)
and following script:

Code: Select all

main:

///Spawn Trigger 1
   local.trig = spawn trigger_multiple "targetname" "t1"
   local.trig.origin = ( -2162 3688 -255 ) // position it
   local.trig setsize ( 0 -5 0) ( 1 50 200) // give it some size
   local.trig setthread spawnchange1
   local.trig wait 1
   local.trig delay 0 // How long before trig acts
   
///Spawn Trigger 2
   local.trig = spawn trigger_multiple "targetname" "t2"
   local.trig.origin = ( -1408 2226 -255 ) // position it
   local.trig setsize ( 0 -250 0) ( 5 250 200) // give it some size
   local.trig setthread spawnchange2
   local.trig wait 1
   local.trig delay 0 // How long before trig acts

///Spawn Trigger 3
   local.trig = spawn trigger_multiple "targetname" "t3"
   local.trig.origin = ( 467 2227 -255 ) // position it
   local.trig setsize ( 0 -250 0) ( 5 250 200) // give it some size
   local.trig setthread spawnchange3
   local.trig wait 1
   local.trig delay 0 // How long before trig acts

///Spawn Trigger 4
   local.trig = spawn trigger_multiple "targetname" "t4"
   local.trig.origin = ( 1851 837 -255 ) // position it
   local.trig setsize ( -50 -5 0) ( 50 50 200) // give it some size
   local.trig setthread spawnchange4
   local.trig wait 1
   local.trig delay 0 // How long before trig acts

///Spawn Trigger 5
   local.trig = spawn trigger_multiple "targetname" "t5"
   local.trig.origin = ( 1216 -211 -255 ) // position it
   local.trig setsize ( 0 -5 0) ( 1 50 200) // give it some size
   local.trig setthread spawnchange5
   local.trig wait 1
   local.trig delay 0 // How long before trig acts

///Spawn Trigger 6 
   local.trig = spawn trigger_multiple "targetname" "t6"
   local.trig.origin = ( 1742 -2138 -255 ) // position it
   local.trig setsize ( -70 -5 0) ( 70 50 200) // give it some size
   local.trig setthread spawnchange6
   local.trig wait 1
   local.trig delay 0 // How long before trig acts   
   
///Spawn Trigger 7
   local.trig = spawn trigger_multiple "targetname" "t7"
   local.trig.origin = ( 2152 -3525 -195 ) // position it
   local.trig setsize ( 0 -5 0) ( 1 50 200) // give it some size
   local.trig setthread spawnchange7
   local.trig wait 1
   local.trig delay 0 // How long before trig acts

thread spawns
level waittill prespawn

level.script = maps/m1l2b.scr

exec global/ambient.scr mohdm3
exec global/DMprecache.scr
exec global/door_locked.scr::lock

thread spawns

level waittill spawn

thread huddraw
end //-------------------------------------------------------------end of main

huddraw:
while (1)
{
	local.viedisplay = level.balance * 10
	local.barlength = 80 + local.viedisplay
	huddraw_alpha 25 1
	huddraw_align 25 left bottom
	huddraw_rect 25 298 -110 180 16
	huddraw_shader 25 "textures/hud/healthmeter"
	huddraw_alpha 26 1
	huddraw_align 26 left bottom
	huddraw_rect 26 298 -110 local.barlength 16
	huddraw_shader 26 "textures/mohmenu/loadingbar"
	huddraw_alpha 27 1
	huddraw_align 27 left bottom
	huddraw_rect 27 296 -110 185 18
	huddraw_shader 27 "textures/mohmenu/loadingbar_border"
	huddraw_alpha 28 1
	huddraw_align 28 center
	huddraw_font 28 "facfont-20"
	huddraw_color 28 0.70 0.60 0.05
	huddraw_rect 28 -95 200 100 20
	huddraw_string 28 "Axis"
	huddraw_alpha 29 1
	huddraw_align 29 center
	huddraw_font 29 "facfont-20"
	huddraw_color 29 0.70 0.60 0.05
	huddraw_rect 29 140 200 100 20
	huddraw_string 29 "Allies"
	huddraw_alpha 30 1
	huddraw_align 30 center
	huddraw_font 30 "facfont-20"
	huddraw_color 30 0 1 0
	huddraw_rect 30 0 180 100 20
	huddraw_string 30 "Push Meter"
	wait 1
}
end

spawns: //-------------------------------------ALL ORIGINS BELOW ARE SET WRONG!!!
//1st set allied spawns - area A
local.allied = spawn info_player_allied  "targetname" "sp1" origin "1056 1551 -255" angle 87 
local.allied = spawn info_player_allied  "targetname" "sp2" origin "2522 2149 -255" angle 175 
local.allied = spawn info_player_allied  "targetname" "sp3" origin "2547 2443 -255" angle -146 
local.allied = spawn info_player_allied  "targetname" "sp4" origin "1366 1395 -255" angle -47 
//2nd set allied spawns - area B
local.allied = spawn info_player_allied  "targetname" "sp5" origin "924 695 -255" angle -30 
local.allied = spawn info_player_allied  "targetname" "sp6" origin "897 8 -255" angle 85 
local.allied = spawn info_player_allied  "targetname" "sp7" origin "2128 764 -255" angle -4 
local.allied = spawn info_player_allied  "targetname" "sp8" origin "1658 -27 -255" angle 88
//4th set of axis spawns - area C
local.axis = spawn info_player_axis  "targetname" "sp9" origin "2666 -4570 -255" angle 65 
local.axis = spawn info_player_axis  "targetname" "sp10" origin "2173 -3350 -255" angle -4 
local.axis = spawn info_player_axis  "targetname" "sp11" origin "2047 -3984 -255" angle -3 
local.axis = spawn info_player_axis  "targetname" "sp12" origin "2124 -4581 -255" angle -8
//3rd set allied spawns - area D
local.allied = spawn info_player_allied  "targetname" "sp13" origin "2136 -214 -255" angle -90 
local.allied = spawn info_player_allied  "targetname" "sp14" origin "1684 -606 -255" angle 179 
local.allied = spawn info_player_allied  "targetname" "sp15" origin "34 -977 -255" angle -2 
local.allied = spawn info_player_allied  "targetname" "sp16" origin "781 -222 -255" angle -92
//3rd set of axis spawns - area E
local.axis = spawn info_player_axis  "targetname" "sp17" origin "1441 -3255 -191" angle 169 
local.axis = spawn info_player_axis  "targetname" "sp18" origin "1900 -2748 -191" angle -138 
local.axis = spawn info_player_axis  "targetname" "sp19" origin "1773 -3041 -191" angle 78 
local.axis = spawn info_player_axis  "targetname" "sp20" origin "1760 -3674 -191" angle 89
//4th set allied spawns - area F
local.allied = spawn info_player_allied  "targetname" "sp21" origin "2077 -2635 -255" angle 179 
local.allied = spawn info_player_allied  "targetname" "sp22" origin "1193 -2611 -191" angle 0 
local.allied = spawn info_player_allied  "targetname" "sp23" origin "1911 -2740 -191" angle -139 
local.allied = spawn info_player_allied  "targetname" "sp24" origin "1446 -3199 -191" angle -94
//2nd set of axis spawns - area G
local.axis = spawn info_player_axis  "targetname" "sp25" origin "103 -1922 -255" angle 0 
local.axis = spawn info_player_axis  "targetname" "sp26" origin "2318 -2635 -255" angle 92 
local.axis = spawn info_player_axis  "targetname" "sp27" origin "1203 -2372 -255" angle 30 
local.axis = spawn info_player_axis  "targetname" "sp28" origin "2078 -2580 -255" angle 88
//1st set of axis spawns - area H
local.axis = spawn info_player_axis  "targetname" "sp29" origin "2209 -603 -255" angle -143 
local.axis = spawn info_player_axis  "targetname" "sp30" origin "791 -210 -255" angle -86 
local.axis = spawn info_player_axis  "targetname" "sp31" origin "201 -244 -255" angle -3 
local.axis = spawn info_player_axis  "targetname" "sp32" origin "67 -1863 -255" angle 0 
//-------------------------------------ALL ORIGINS ABOVE ARE SET WRONG!!
waitthread spawnclear
$sp1 enablespawn
$sp2 enablespawn
$sp3 enablespawn
$sp4 enablespawn
$sp29 enablespawn
$sp30 enablespawn
$sp31 enablespawn
$sp32 enablespawn
level.balance = 0
level.alliesprogress = 1
level.axisprogress = 1
end
//----------------------------------------------------------------------------------------------
spawnclear:
for (local.i=1;local.i<=32;local.i++)
	{
	$("sp" + local(i)) disablespawn
	}
end
//----------------------------------------------------------------------------------------------
spawnchange1:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
	{
	self.triggeredby= "allies"
	level.balance++
	level.alliesprogress = 2
	}
	break
case "axis"
	if !(self.triggeredby =="axis")
	{
	self.triggeredby= "axis"
	level.balance--
	level.axisprogress = 8 
	goto AxisWin  //dunno how to do this stuff
	}
	break
}
end
//----------------------------------------------------------------------------------------------
spawnchange2:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
		{
		self.triggeredby= "allies"
		$sp1 disablespawn
		$sp2 disablespawn
		$sp3 disablespawn
		$sp4 disablespawn
		$sp5 enablespawn
		$sp6 enablespawn
		$sp7 enablespawn
		$sp8 enablespawn
		level.alliesprogress = 3
		level.balance++
		if (level.axisprogress > 5)
			{
			$sp9 disablespawn
			$sp10 disablespawn
			$sp11 disablespawn
			$sp12 disablespawn
			$sp17 enablespawn
			$sp18 enablespawn
			$sp19 enablespawn
			$sp20 enablespawn
			level.axisprogress = 4
			}
		}
	break
case "axis"
	if !(self.triggeredby =="axis")
		{
		self.triggeredby= "axis"
		$sp17 disablespawn
		$sp18 disablespawn
		$sp19 disablespawn
		$sp20 disablespawn
		$sp9 enablespawn
		$sp10 enablespawn
		$sp11 enablespawn
		$sp12 enablespawn
		level.axisprogress = 7
		level.balance--
		if (level.alliesprogress > 1)
			{
			$sp5 disablespawn
			$sp6 disablespawn
			$sp7 disablespawn
			$sp8 disablespawn
			$sp1 enablespawn
			$sp2 enablespawn
			$sp3 enablespawn
			$sp4 enablespawn
			level.alliesprogress = 1
			}
		level.balance--
		}
	break
}
//----------------------------------------------------------------------------------------------
spawnchange3:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
	{
	self.triggeredby= "allies"
	level.balance++
	}
	break
case "axis"
	if !(self.triggeredby =="axis")
	{
	self.triggeredby= "axis"
	level.balance--
	}
	break
}
end
//----------------------------------------------------------------------------------------------
spawnchange4:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
		{
		self.triggeredby= "allies"
		$sp5 disablespawn
		$sp6 disablespawn
		$sp7 disablespawn
		$sp8 disablespawn
		$sp13 enablespawn
		$sp14 enablespawn
		$sp15 enablespawn
		$sp16 enablespawn
		level.alliesprogress = 4
		level.balance++
		if (level.axisprogress > 3)
			{
			$sp17 disablespawn
			$sp18 disablespawn
			$sp19 disablespawn
			$sp20 disablespawn
			$sp25 enablespawn
			$sp26 enablespawn
			$sp27 enablespawn
			$sp28 enablespawn
			level.axisprogress = 2
			}
		}
	break
case "axis"
	if !(self.triggeredby =="axis")
		{
		self.triggeredby= "axis"
		$sp17 disablespawn
		$sp18 disablespawn
		$sp19 disablespawn
		$sp20 disablespawn
		$sp9 enablespawn
		$sp10 enablespawn
		$sp11 enablespawn
		$sp12 enablespawn
		level.axisprogress = 7
		level.balance--
		if (level.alliesprogress > 1)
			{
			$sp5 disablespawn
			$sp6 disablespawn
			$sp7 disablespawn
			$sp8 disablespawn
			$sp1 enablespawn
			$sp2 enablespawn
			$sp3 enablespawn
			$sp4 enablespawn
			level.alliesprogress = 1
			}
		}
	break
}
//----------------------------------------------------------------------------------------------
spawnchange5:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
	{
	self.triggeredby= "allies"
	level.balance++
	}
	break
case "axis"
	if !(self.triggeredby =="axis")
	{
	self.triggeredby= "axis"
	level.balance--
	}
	break
}
end
//----------------------------------------------------------------------------------------------
spawnchange6:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
		{
		self.triggeredby= "allies"
		$sp13 disablespawn
		$sp14 disablespawn
		$sp15 disablespawn
		$sp16 disablespawn
		$sp21 enablespawn
		$sp22 enablespawn
		$sp23 enablespawn
		$sp24 enablespawn
		level.alliesprogress = 6
		level.balance++
		if (level.axisprogress > 1)
			{
			$sp25 disablespawn
			$sp26 disablespawn
			$sp27 disablespawn
			$sp28 disablespawn
			$sp29 enablespawn
			$sp30 enablespawn
			$sp31 enablespawn
			$sp32 enablespawn
			level.axisprogress = 1
			}
		}
	break
case "axis"
	if !(self.triggeredby =="axis")
		{
		self.triggeredby= "axis"
		$sp29 disablespawn
		$sp30 disablespawn
		$sp31 disablespawn
		$sp32 disablespawn
		$sp25 enablespawn
		$sp26 enablespawn
		$sp27 enablespawn
		$sp28 enablespawn
		level.axisprogress = 3
		level.balance--
		if (level.alliesprogress > 5)
			{
			$sp21 disablespawn
			$sp22 disablespawn
			$sp23 disablespawn
			$sp24 disablespawn
			$sp13 enablespawn
			$sp14 enablespawn
			$sp15 enablespawn
			$sp16 enablespawn
			level.alliesprogress = 4
			}
		}
	break
}
//----------------------------------------------------------------------------------------------
spawnchange7:
local.player = parm.other
switch (local.player.dmteam)
{
case "allies"
	if !(self.triggeredby =="allies")
	{
	self.triggeredby= "allies"
	level.balance++
	goto AlliesWin  //dunno how to do this stuff
	}
	break
case "axis"
	if !(self.triggeredby =="axis")
	{
	self.triggeredby= "axis"
	level.balance--
	}
	break
}
end
what would u say (if it did work :wink: )

Posted: Sat Mar 26, 2005 5:13 am
by bdbodger
There are two ways to have a trigger run a thread . One way is by useing setthread to run a thread when the trigger is triggered . That way though the thread is run every time the trigger is triggered you will have multiple copies of the thread running at the same time fighting with each other in some cases . The other way is to make a looping thread like this

mythread:

while(1)
{

$mytrigger waittill trigger

local.player = parm.other

****do stuff here****

while(isalive local.player && local.player istouching $mytrigger)
waitframe
}
end

Doing it that way the trigger can not be triggered untill the player leaves the trigger or is dead and the waittill trigger line is read again and you will have only one thread running

Posted: Sat Mar 26, 2005 5:18 pm
by Ski
Actually what I did was setup all my triggers and gave them a target name like trig1, trig2 and so on... then I threaded a thread the make every trigger after the trig2 nottriggerable like

Triggerset:

$trig3 nottriggerable
$trig4 nottriggerable

This way only the 1st two would act... then In the setthread spawnchanger thread that trig1 initiated I turned on the next set of triggers on and turned off trig1 so it would only act once.

$trig1 nottriggerable
$trig3 triggerable
and so on

If the opposite team pushed back using $trig3... the setthread would change spawns back and turn on $trig1 again...

It is all very confusing... but I think I have it worked out. Need to test it on the server with a bunch of people to be sure it works like I drew it up on paper.


Thanks so much for all your help!!

Ski

Posted: Sat Mar 26, 2005 10:44 pm
by bdbodger
well you can put if statements into a thread like the one I posted . I just think it is better to make sure you only have 1 thread running for each trigger .

Posted: Mon Apr 11, 2005 3:27 pm
by Ski
bdbodger wrote:well you can put if statements into a thread like the one I posted . I just think it is better to make sure you only have 1 thread running for each trigger .
I think I have this almost worked out... but I still have not been able to figure out a good way to reset the meter and start map again with remaining time when a push is one.

The code below is the thread that the last trigger initiates when Axis win the push... the "axiswin" thread just puts up text saying the won... then everyone gets killed... spawns are changed back to beginning of map... and at the end of the thread I have (4) level.alliedprogress-- (which is suppose to put the meter back to center like the start of map) but it doesnt always work out that way... does anyone know of a way that I can have the meter redrawn like the start of the map using this last thread???

Code: Select all

//Axis went thur final door
spawnchange13:
local.player = parm.other
if ( local.player.dmteam=="axis" )
{
$trig13 nottriggerable
thread axiswin
wait 5
thread playerkill
$trig1 triggerable
$trig2 triggerable

$allied1 enablespawn
$allied2 enablespawn
$allied3 enablespawn
$allied4 enablespawn
$allied5 enablespawn

$allied6 disablespawn
$allied7 disablespawn
$allied8 disablespawn
$allied9 disablespawn
$allied10 disablespawn
$allied11 disablespawn
$allied12 disablespawn
$allied13 disablespawn
$allied14 disablespawn
$allied15 disablespawn
$allied16 disablespawn
$allied17 disablespawn
$allied18 disablespawn
$allied19 disablespawn
$allied20 disablespawn
$allied21 disablespawn
$allied22 disablespawn
$allied23 disablespawn
$allied24 disablespawn
$allied25 disablespawn
$allied26 disablespawn
$allied27 disablespawn
$allied28 disablespawn
$allied29 disablespawn

$axis1 enablespawn
$axis2 enablespawn
$axis3 enablespawn
$axis4 enablespawn
$axis5 enablespawn

$axis6 disablespawn
$axis7 disablespawn
$axis8 disablespawn
$axis9 disablespawn
$axis10 disablespawn
$axis11 disablespawn
$axis12 disablespawn
$axis13 disablespawn
$axis14 disablespawn
$axis15 disablespawn
$axis16 disablespawn
$axis17 disablespawn
$axis18 disablespawn
$axis19 disablespawn
$axis20 disablespawn
$axis21 disablespawn
$axis22 disablespawn
$axis23 disablespawn
$axis24 disablespawn
$axis25 disablespawn
$axis26 disablespawn
$axis27 disablespawn
$axis28 disablespawn
$axis29 disablespawn
level.alliedprogress--
wait 1
level.alliedprogress--
wait 1
level.alliedprogress--
wait 1
level.alliedprogress--
}
end
Thanks

Ski

Posted: Mon Apr 11, 2005 3:46 pm
by Ski
Doh!... I think I have this now... thanks everyone!!!!!

Ski