Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 80 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty
Category: CoDUO Mapping
CoD United Offensive mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Scripting question
majgas
General Member
Since: Jan 28, 2006
Posts: 59
Last: Mar 30, 2014
[view latest posts]
Level 3
Category: CoDUO Mapping
Posted: Saturday, Apr. 3, 2010 07:51 am
I had a question about scripting,my map has a gallows in it,which i made to kill a player if he or she steps where the rope and noose is,and it prints a message on screen.My question is - is there a way to print the players name that stepped into the trigger show on screen ?I have it working so it prints an on screen message,but would like it to say the players name that triggers it.Here is the working gsc file that i am useing,thanks in advance for your help!

Code:
main()
{
	thread message2();							// Thread to setup and respond to trigger
}



message2() 
{ 
	messagetrig = getent ("executed","targetname"); 		// Set messagetrig to point to the trigger entity
	messagetrig waittill ("trigger"); 					// Have the thread wait until the trigger is activated
	iprintlnbold (""); 	// Print on the user interface

	alert = getent ("grimreaper", "targetname");			// Set alert to point to the script_model which sets the origin for the sound
	alert playsound("farley");						// Play a non-looping sound with the alias runaway - defined in the soundaliases .CSV file	

	iprintlnbold ("^4A player has been sentenced to die at the gallows,may they rest in peace!"); 		// Print on the user interface

	wait (20);									// Pause for 20 seconds

	thread message2(); 							// Kick of the thread again - re-enables the trigger

} 
[thumbs_up][thumbs_up]
Share |
Uzumakibro93
General Member
Since: Sep 6, 2009
Posts: 118
Last: Jul 5, 2011
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Saturday, Apr. 3, 2010 09:28 am
Yeah, no problem. Make a function that is true for the player if they step in the trigger, then announce the player's name that is now true for the function. Don't forget to have a "wait 1;" then "self.intrigger = false;" to make sure that they don't get announced again, and only one person will be announced at a time. The script for saying their name would be as follows:

Code:
iprintlnbold ("^4" + self.name + " has been sentenced to die at the gallows, may they rest in peace!"); 		// Print on the user interface


Try this as your entire function:

Code:
main()
{
	thread message2();							// Thread to setup and respond to trigger
}



message2() 
{ 
	messagetrig = getent ("executed","targetname"); 		// Set messagetrig to point to the trigger entity
	messagetrig waittill ("trigger"); 					// Have the thread wait until the trigger is activated

	alert = getent ("grimreaper", "targetname");			// Set alert to point to the script_model which sets the origin for the sound
	alert playsound("farley");						// Play a non-looping sound with the alias runaway - defined in the soundaliases .CSV file	

	iprintlnbold ("^4" + self.name + " has been sentenced to die at the gallows, may they rest in peace!"); 		// Print on the user interface

	wait (20);									// Pause for 20 seconds

	thread message2(); 							// Kick of the thread again - re-enables the trigger

} 


If that doesn't work, add me on XFire (uzumakibro93) or email me (uzumakibro93 at gmail dot com) and tell me, and I'll work on it.

P.S. By any chance, would you mind if we were to use this in our clan's map as well? We would add your name in the credits, etc, if you would map this for us!
Share |
majgas
General Member
Since: Jan 28, 2006
Posts: 59
Last: Mar 30, 2014
[view latest posts]
Level 3
Category: CoDUO Mapping
Posted: Saturday, Apr. 3, 2010 08:11 pm
Thanks for the reply Uzumakibro93!I tried that but it just printed that whole line,didnt print the players name.Thanks again for the reply!

Quote:
P.S. By any chance, would you mind if we were to use this in our clan's map as well? We would add your name in the credits, etc, if you would map this for us

Sure,no worries!
Share |
Uzumakibro93
General Member
Since: Sep 6, 2009
Posts: 118
Last: Jul 5, 2011
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Sunday, Apr. 4, 2010 03:56 am
Hmm...It isn't recognizing what "self.name" is. Maybe it thinks it's a bit of text instead of a player's name...? I guess I'll come up with a script to define who is "self.pers".

Quote:
Quote:

P.S. By any chance, would you mind if we were to use this in our clan's map as well? We would add your name in the credits, etc, if you would map this for us


Sure,no worries!


Thanks man. I'll send it as soon as we are done messing with the main brushes. It will be all caulk and there are no models yet, I do everything in order (I.E. Skybox/settings, brushes (in caulk), entities, models, textures, scripts). ;) Cheers, Uzumakibro93
Share |
s4ntiago
General Member
Since: Dec 18, 2006
Posts: 151
Last: Feb 10, 2011
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Thursday, Apr. 8, 2010 06:17 am
Try this:

Code:

messagetrig waittill ("trigger", user);
iprintlnbold ( user.name + "insert message here");

Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDUO Mapping
Posted: Thursday, Apr. 8, 2010 11:07 am
Use this:

Code:
main()
{
	noose = GetEnt( "executed", "targetname");
	noose thread NooseTrigger();
}

NooseTrigger() // This will work everytime a player touches the trigger
{
	while(1)
	{
		self waittill( "trigger", player );
		
		self PlayLocalSound( "farley" ); // Lets keep the sound local, since others don't need to hear it	
		iPrintLnBold( "^2" + player.name + "^3 has been sentenced to die at the gallows, may they rest in peace!" );
	}
}


edited on Apr. 8, 2010 07:08 am by Xylozi
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty : CoDUO Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»