Page 1 of 1

help parm.other.dmteam

Posted: Thu Aug 11, 2005 9:53 pm
by ViPER
whats going on here? every once in a while the wrong team stuff is triggered? can someone tell me exactly how parm.other works/does?

is the wait 2 at the end confusing the dmteam ?

Code: Select all

radardish:

while(1) 
{ 
	// wait for trigger event 
	while(1) 
		{ 
		$radartrigger waittill trigger 
		if(parm.other.dmteam == allies || parm.other.dmteam == axis) 
		break 
		}


	if( level.bRadarControlSwitchUp == 1 )
	{	
		$radarcontrol_origin speed 1.0
		$radarcontrol_origin rotatexdownto 180
		$radarcontrol_origin waitmove
		$radarcontrol_origin playsound switchbox 
		level.bRadarControlSwitchUp = 0
		waitframe
			if(parm.other.dmteam == allies)
				{
				iprintln "The Allies have control of the Radar Station!"
				level.radarcontrol = 1

				$alliedms1 enablespawn
				$axisms1 disablespawn

				wait 1

				if(level.allied_bravo_spawns != 0)
				{
				iprintln "Allies control Bravo Sector spawns!"
				}
	huddraw_virtualsize 208 1
	huddraw_shader 208 ("textures/hud/allies")
	huddraw_align  208 right top
	huddraw_rect   208 -100 130 14 14
	huddraw_alpha  208 1.0

	huddraw_virtualsize 210 1
	huddraw_align  210 right top
	huddraw_font   210 "verdana-12"
	huddraw_rect   210 -80 130 100 14
	huddraw_color  210 0 1 1
	huddraw_alpha  210 1.0
	huddraw_string 210 ("Radar Dish")

				}
			else
				{
				iprintln "The Axis have control of the Radar Station!"
				level.radarcontrol = 0

				$alliedms1 disablespawn
				$axisms1 enablespawn

				wait 1
				if(level.axis_bravo_spawns != 0)
				{
				iprintln "Axis control Bravo Sector spawns!"
				}
	huddraw_virtualsize 208 1
	huddraw_shader 208 ("textures/hud/axis")
	huddraw_align  208 right top
	huddraw_rect   208 -100 130 14 14
	huddraw_alpha  208 1.0

	huddraw_virtualsize 210 1
	huddraw_align  210 right top
	huddraw_font   210 "verdana-12"
	huddraw_rect   210 -80 130 100 14
	huddraw_color  210 1 0 0
	huddraw_alpha  210 1.0
	huddraw_string 210 ("Radar Dish")

				}

	}
	else
	{
		$radarcontrol_origin rotatexupto 0
		$radarcontrol_origin waitmove
		$radarcontrol_origin playsound switchbox 
		level.bRadarControlSwitchUp = 1			
		waitframe
			if(parm.other.dmteam == allies)
				{
				iprintln "The Allies have control of the Radar Station!"
				level.radarcontrol = 1

				$alliedms1 enablespawn
				$axisms1 disablespawn

				wait 1
				if(level.allied_bravo_spawns != 0)
				{
				iprintln "Allies control Bravo Sector spawns!"
				}
	huddraw_virtualsize 208 1
	huddraw_shader 208 ("textures/hud/allies")
	huddraw_align  208 right top
	huddraw_rect   208 -100 130 14 14
	huddraw_alpha  208 1.0

	huddraw_virtualsize 210 1
	huddraw_align  210 right top
	huddraw_font   210 "verdana-12"
	huddraw_rect   210 -80 130 100 14
	huddraw_color  210 0 1 1
	huddraw_alpha  210 1.0
	huddraw_string 210 ("Radar Dish")

				}
			else
				{
				iprintln "The Axis have control of the Radar Station!"
				level.radarcontrol = 0

				$alliedms1 disablespawn
				$axisms1 enablespawn

				wait 1
				if(level.axis_bravo_spawns != 0)
				{
				iprintln "Axis control Bravo Sector spawns!"
				}
	huddraw_virtualsize 208 1
	huddraw_shader 208 ("textures/hud/axis")
	huddraw_align  208 right top
	huddraw_rect   208 -100 130 14 14
	huddraw_alpha  208 1.0

	huddraw_virtualsize 210 1
	huddraw_align  210 right top
	huddraw_font   210 "verdana-12"
	huddraw_rect   210 -80 130 100 14
	huddraw_color  210 1 0 0
	huddraw_alpha  210 1.0
	huddraw_string 210 ("Radar Dish")

				}

	}

wait 2
}
end

Posted: Thu Aug 11, 2005 10:56 pm
by lizardkid
parm.other is the entity that triggered the thread.

so if i made a trigger_multiple with a setthread mythread and ran an actor into it with this thread as mythread...

Code: Select all

mythread:

iprintln parm.other.targetname
end
then whenever an entity hit that trigger it would display their targetname.

in this case, if the Alliance hit the Radar station trigger, then it disables the spawns for the axis there, and enables spawns for allies. a base-oriented mod it would seem.

It's pretty strangely coded to me though, but to each his own.

Posted: Thu Aug 11, 2005 11:31 pm
by ViPER
otherwise you don't see why it might be confusing the parm.other?

it works fine by my self, if others playing i can switch it ten times as should - then it will go the other team a couple times then back again.

Posted: Fri Aug 12, 2005 12:31 am
by Bjarne BZR
Viper wrote:otherwise you don't see why it might be confusing the parm.other?

it works fine by my self, if others playing i can switch it ten times as should - then it will go the other team a couple times then back again.
I think you may have trouble waiting lots of seconds after the triggering has ocurred and then reading it again. The variable may have been overwritten by another trigger by then.

Try this:

Code: Select all

radardish:

	while(1) // Forever
	{
		$radartrigger waittill trigger
		if(parm.other.dmteam == allies || parm.other.dmteam == axis)
		{
			local.current_triggerer = parm.other.dmteam
			if( level.bRadarControlSwitchUp == 1 )
			{	
				$radarcontrol_origin speed 1.0
				$radarcontrol_origin rotatexdownto 180
				$radarcontrol_origin waitmove
				$radarcontrol_origin playsound switchbox
				level.bRadarControlSwitchUp = 0
				waitframe
				if(local.current_triggerer == allies)
				{
					iprintln "The Allies have control of the Radar Station!"
					level.radarcontrol = 1

					$alliedms1 enablespawn
					$axisms1 disablespawn

					wait 1

					if(level.allied_bravo_spawns != 0)
					{
						iprintln "Allies control Bravo Sector spawns!"
					}
					thread draw_dish_status allies
				}
				else
				{
					iprintln "The Axis have control of the Radar Station!"
					level.radarcontrol = 0
					$alliedms1 disablespawn
					$axisms1 enablespawn

					wait 1
					if(level.axis_bravo_spawns != 0)
					{
						iprintln "Axis control Bravo Sector spawns!"
					}
					thread draw_dish_status axis
				}
			}
			else
			{
				$radarcontrol_origin rotatexupto 0
				$radarcontrol_origin waitmove
				$radarcontrol_origin playsound switchbox
				level.bRadarControlSwitchUp = 1			
				waitframe
				if(local.current_triggerer == allies)
				{
					iprintln "The Allies have control of the Radar Station!"
					level.radarcontrol = 1
					$alliedms1 enablespawn
					$axisms1 disablespawn

					wait 1
					if(level.allied_bravo_spawns != 0)
					{
						iprintln "Allies control Bravo Sector spawns!"
					}
					thread draw_dish_status allies
				}
				else
				{
					iprintln "The Axis have control of the Radar Station!"
					level.radarcontrol = 0

					$alliedms1 disablespawn
					$axisms1 enablespawn

					wait 1
					if(level.axis_bravo_spawns != 0)
					{
						iprintln "Axis control Bravo Sector spawns!"
					}
					thread draw_dish_status axis
				}
			}
		}
		wait 2
	}
end

draw_dish_status local.team:
	huddraw_virtualsize 208 1
	huddraw_shader 208 ("textures/hud/" + local.team)
	huddraw_align  208 right top
	huddraw_rect	208 -100 130 14 14
	huddraw_alpha  208 1.0
	huddraw_virtualsize 210 1
	huddraw_align  210 right top
	huddraw_font	210 "verdana-12"
	huddraw_rect	210 -80 130 100 14
	huddraw_color  210 1 0 0
	huddraw_alpha  210 1.0
	huddraw_string 210 ("Radar Dish")
end
...also the repeating of the identical huddraw stuff hurt my eyes, so I ripped it out :)

Posted: Fri Aug 12, 2005 1:08 am
by ViPER
thanks,

there are two other similiar trigger threads that use parm.other.dmteam just like it. they allways seem to work fine though.

should i leave them, or put parm.other.dmteam in a new local.var like local.current_triggerer2?

Posted: Fri Aug 12, 2005 7:25 am
by Bjarne BZR
If they use delays before checking it again, you should store it like I did above.