connecting documents to a certain player

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
simsalabim
Lance Corporal
Posts: 17
Joined: Wed Jan 18, 2006 6:58 pm

connecting documents to a certain player

Post by simsalabim »

Hi Guys,

ive got a problem here and i hope u can help me.

What i want:
I want, that 1 allied player gathers some documents - and hes the only one, that can bring em to a certain place.


What i have sofar:

Code: Select all

	$sniper_barb notsolid
	//$funker_trigger loopsound sand_radio
	$funker_trigger nottriggerable
	$alarm_trigger nottriggerable

	thread ziele

level waittill roundstart

level waittill axiswin

end


door_locked:
	$door_trigger playsound door_metal_locked
end


wasser:
	$wasser volumedamage 20
end


barb_oben:
	$barb_oben volumedamage 10
end


alarm:
	if(parm.other.dmteam == allies)
	{
		$alarm_trigger nottriggerable
		wait .5
		
		$funker model "animate/pulse_military_radio.tik"
		$documents playsound sand_switch
		wait .4
		$documents loopsound sand_alarm
	}		
end


ziele:
	while(1)
	{
		$documents_trigger waittill trigger
		if(parm.other.dmteam == allies)
		{
			local.player = local.documentscarrier
			$documents playsound sand_documents
			$documents remove
			wait .4

			iprintlnbold_noloc "The Allies have got the documents!"
			$funker_trigger triggerable
			$alarm_trigger triggerable

			
			break
		}

		waitframe
	}


	while(1)
	{
		$funker_trigger waittill trigger
		if(local.player == local.documentscarrier)
		{
			$radiosound loopsound sand_radio
			$funker model "animate/military_radio.tik"
			//$alarm_sound stopsound
			wait .8
			iprintlnbold_noloc "The documents have sent, Allies win!"

			break
		}

		waitframe
	}

	teamwin allies
end
Problem/Error:
All Players (incl. Axis) can solve the objective.


Thank you in advance.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Re: connecting documents to a certain player

Post by Rookie One.pl »

I've found a couple of problems, here's a version with my fixes (explanations in comments):

Code: Select all

ziele:
	while(1)
	{
		$documents_trigger waittill trigger
		local.player = parm.other	// it's safer to save off the parm.other entity in another variable just in case
		if(local.player.dmteam == allies)
		{
			local.documentscarrier = local.player	// you had this assignation the other way around
			$documents playsound sand_documents
			$documents remove
			wait .4

			iprintlnbold_noloc "The Allies have got the documents!"
			$funker_trigger triggerable
			$alarm_trigger triggerable

			
			break
		}

		waitframe
	}


	while(1)
	{
		$funker_trigger waittill trigger
		local.player = parm.other	// you need to do this again, it's a different trigger
		if(local.player == local.documentscarrier)
		{
			$radiosound loopsound sand_radio
			$funker model "animate/military_radio.tik"
			//$alarm_sound stopsound
			wait .8
			iprintlnbold_noloc "The documents have sent, Allies win!"

			break
		}

		waitframe
	}

	teamwin allies
end
Hope this helps. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
simsalabim
Lance Corporal
Posts: 17
Joined: Wed Jan 18, 2006 6:58 pm

Post by simsalabim »

Thank you very much m8! It works! :)
Post Reply