Page 1 of 1

Script to end game once a trigger is, "triggered"

Posted: October 5th, 2007, 9:02 am
by oppdelta
How would you do that? also once its triggered the allies, and only allies team can score, they get 1000 kills extra on there team.

:?

Posted: October 5th, 2007, 4:44 pm
by Nightmare
Very easy

Code: Select all

trigger waittill("trigger",user);
user.score=1000;
:)

Posted: October 8th, 2007, 12:57 pm
by oppdelta
Ahhh k, were would i place this? :?:

Posted: October 8th, 2007, 9:18 pm
by YaNo
better if you want to keep score:

Code: Select all

trigger waittill("trigger",user); 
endMap();

edit: place it in your gsc ^^

im just trying to create a fun map

Posted: October 10th, 2007, 1:28 pm
by dot
im just trying to create a fun map for like dm and stuff. could i do that for cod2? like place a trigger somewhere and when they step in it have them gain a certain amount of points? and if so how do i make it with trigger? trigger texture then what key and what value

Posted: October 11th, 2007, 2:35 am
by Nightmare
its exactly the same in cod2, key has to be targetname and value can be any name you want (put your mapname in front though to reduce chances of conflicting)

Posted: October 11th, 2007, 9:02 am
by oppdelta
Couldnt you make a king of the hill, like this. The player stays in a spot and say every second the teams points go up by 10 say?

Posted: October 11th, 2007, 8:34 pm
by Nightmare
That is possible
I shall have a go:

Code: Select all

main()
{
	maps\mp\_load::main();

	getent("kingofhill_trigger","targetname") thread kingofhill_trigger();
}

kingofhill_trigger()
{
	while(1)
	{
		self waittill("trigger", other);
		while(other isTouching(self))
		{
			self.score++;
			wait 1;
		}
		wait 0.05;
	}
}
This should work, but this is very simplistic. If you are planning to have two teams, then use Team Deathmatch game type and use this:

Code: Select all

main()
{
	maps\mp\_load::main();

	level.pointNum = 0;

	getent("kingofhill_trigger_axis","targetname") thread kingofhill_trigger_axis();
	getent("kingofhill_trigger_allies","targetname") thread kingofhill_trigger_allies();
}

kingofhill_trigger_axis()
{
	while(1)
	{
		self waittill("trigger", other);
		while(other isTouching(self))
		{
			if(self.pers["team"] == "allies")
			{
				self.score++;
				wait 1;
			}
			else
				self iprintln("This is your base.");
		}
		wait 0.05;
	}
}

kingofhill_trigger_allies()
{
	while(1)
	{
		self waittill("trigger", other);
		while(other isTouching(self))
		{
			if(self.pers["team"] == "axis")
			{
				self.score++;
				wait 1;
			}
			else
				self iprintln("This is your base.");
		}
		wait 0.05;
	}
}
If you have any questions, just ask and I will explain. :)

Posted: October 12th, 2007, 9:21 pm
by Nightmare
So did it work? Any luck?