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

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
oppdelta
CJ Fan
CJ Fan
Posts: 107
Joined: June 3rd, 2007, 2:24 pm

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

Post by oppdelta » October 5th, 2007, 9:02 am

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.

:?

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 5th, 2007, 4:44 pm

Very easy

Code: Select all

trigger waittill("trigger",user);
user.score=1000;
:)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
oppdelta
CJ Fan
CJ Fan
Posts: 107
Joined: June 3rd, 2007, 2:24 pm

Post by oppdelta » October 8th, 2007, 12:57 pm

Ahhh k, were would i place this? :?:

User avatar
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Post by YaNo » October 8th, 2007, 9:18 pm

better if you want to keep score:

Code: Select all

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

edit: place it in your gsc ^^

dot
CJ Wannabe
CJ Wannabe
Posts: 17
Joined: September 30th, 2007, 10:11 pm

im just trying to create a fun map

Post by dot » October 10th, 2007, 1:28 pm

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

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 11th, 2007, 2:35 am

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)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
oppdelta
CJ Fan
CJ Fan
Posts: 107
Joined: June 3rd, 2007, 2:24 pm

Post by oppdelta » October 11th, 2007, 9:02 am

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?

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 11th, 2007, 8:34 pm

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. :)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 12th, 2007, 9:21 pm

So did it work? Any luck?
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests