Can someone help me please SCRIPTING (i think)

Chat area specifically for CoDJumper

Moderator: Core Staff

Post Reply
User avatar
scott
CJ Worshipper
CJ Worshipper
Posts: 225
Joined: August 9th, 2010, 10:07 pm

Can someone help me please SCRIPTING (i think)

Post by scott » January 6th, 2011, 5:25 pm

On mp_trial_2 how can i get the script that stops you switching to rpg unless you pick it up? please help me thanks alot CJ <3
Check out my YouTube channel - http://www.youtube.com/user/CodGlitchesHD

User avatar
scott
CJ Worshipper
CJ Worshipper
Posts: 225
Joined: August 9th, 2010, 10:07 pm

Re: Can someone help me please SCRIPTING (i think)

Post by scott » January 6th, 2011, 11:22 pm

Bump someone please try to help me
Check out my YouTube channel - http://www.youtube.com/user/CodGlitchesHD

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Can someone help me please SCRIPTING (i think)

Post by _DanTheMan_ » January 6th, 2011, 11:55 pm

If you want the actual script itself, then:

Code: Select all

	// Add these 2 lines to your main() function
	thread no_rpg(undefined, false); // Use getEnt("no_rpg", "targetname") thread no_rpg(undefined, true); if there is a trigger for no RPG usage in
	getEnt("yes_rpg", "targetname") thread yes_rpg();

no_rpg(p, type)
{
	if(!isDefined(p))
	{
		if(type)
		{
			for(;;)
			{
				self waittill("trigger", p);

				if(!isDefined(p.no_rpg) && !isDefined(p.yes_rpg))
					self thread no_rpg(p, type);
			}
		}
		else
		{
			for(;;)
			{
				level waittill("connected", p);

				thread no_rpg(p, type);
			}
		}
	}

	else
	{
		p endon("disconnect");

		p.no_rpg = true;

		for(;((isDefined(self) && p isTouching(self)) || !type) && !isDefined(p.yes_rpg);)
		{
			if(!p isOnLadder() && !p isMantling() && weaponType(p getCurrentWeapon()) == "projectile")
			{
				p iPrintLn("You cannot use an RPG yet!");
				if(p hasWeapon("beretta_mp"))
					p switchToWeapon("beretta_mp");
				else if(!p hasWeapon("beretta_mp") && p hasWeapon("deserteaglegold_mp"))
					p switchToWeapon("deserteaglegold_mp");
				else if(!p hasWeapon("beretta_mp") && !p hasWeapon("deserteaglegold_mp") && p hasWeapon("colt45_mp"))
					p switchToWeapon("colt45_mp");
				else if(!p hasWeapon("beretta_mp") && !p hasWeapon("deserteaglegold_mp") && !p hasWeapon("colt45_mp") && p hasWeapon("usp_mp"))
					p switchToWeapon("usp_mp");
				else
				{
					p giveWeapon("beretta_mp");
					p switchToWeapon("beretta_mp");
				}

				wait 1;
			}

			wait 0.75;
		}

		p.no_rpg = undefined;
	}
}

yes_rpg()
{
	for(;;)
	{
		self waittill("trigger", p);

		if(!isDefined(p.yes_rpg))
		{
			p iPrintLn("You can now use your RPG");
			p.yes_rpg = true;
		}
	}
}
You'll want to create the trigger yes_rpg where the player can finally use the RPG, and a no_rpg trigger along with editing the code according to the comment in the script if you have a place in which you specifically want the player to have no RPG in, and not elsewhere.
Last edited by _DanTheMan_ on January 7th, 2011, 10:45 pm, edited 1 time in total.
Image

User avatar
scott
CJ Worshipper
CJ Worshipper
Posts: 225
Joined: August 9th, 2010, 10:07 pm

Re: Can someone help me please SCRIPTING (i think)

Post by scott » January 7th, 2011, 2:18 am

Thank You dan <3 im a newb 2 mapping so ya lol
Check out my YouTube channel - http://www.youtube.com/user/CodGlitchesHD

User avatar
scott
CJ Worshipper
CJ Worshipper
Posts: 225
Joined: August 9th, 2010, 10:07 pm

Re: Can someone help me please SCRIPTING (i think)

Post by scott » January 7th, 2011, 8:15 pm

dan how can i use it from a map im making how would i set it out or what ever? i want no rpg all the way till near end
Check out my YouTube channel - http://www.youtube.com/user/CodGlitchesHD

_DanTheMan_
PC Team
PC Team
Posts: 294
Joined: September 6th, 2008, 2:14 am

Re: Can someone help me please SCRIPTING (i think)

Post by _DanTheMan_ » January 7th, 2011, 10:52 pm

_DanTheMan_ wrote:You'll want to create the trigger yes_rpg where the player can finally use the RPG
1)Right click in the grid area in the left side of CoD4Radiant, and go down to trigger>multiple, which should create a trigger.
2)Place it where you want the player to activate his RPG.
3)Making sure the trigger is selected, press N, (which should bring up an Entity pop-up menu) where you will put targetname in the Key box, and yes_rpg in the Value box.
4)Go to your map's .gsc file, and add the two commands at the top of the code I posted at the bottom of your main() function
5)Add the two functions in the code I posted (no_rpg() and yes_rpg()) at the bottom of your map's .gsc file
Image

User avatar
scott
CJ Worshipper
CJ Worshipper
Posts: 225
Joined: August 9th, 2010, 10:07 pm

Re: Can someone help me please SCRIPTING (i think)

Post by scott » January 7th, 2011, 11:33 pm

scott wrote:dan how can i use it from a map im making how would i set it out or what ever? i want no rpg all the way till near end
go on xfire please dan xD im the 1 hu told u CJ#1 Rank Mod with Cheat engine and you wnet to god <3


Edit i get script compile error { line 12
Check out my YouTube channel - http://www.youtube.com/user/CodGlitchesHD

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Can someone help me please SCRIPTING (i think)

Post by Drofder2004 » January 8th, 2011, 2:31 pm

scott wrote:
scott wrote:dan how can i use it from a map im making how would i set it out or what ever? i want no rpg all the way till near end
go on xfire please dan xD im the 1 hu told u CJ#1 Rank Mod with Cheat engine and you wnet to god <3
Thats half a lol.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests