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

Members Online

»
0 Active | 74 Guests
Online:

LATEST FORUM THREADS

»
run artillery on maps
CoD+UO Map + Mod Releases
Call of DutyŽ: WWII
CoD WW2 General

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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: give ammo script
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2725
Last: May 17, 2016
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 10:51 am
hi, i have no idea how to do this script but i am sure some of you will.

what i need is a script that gives ammo IF your allied if your axis it doesnt give anything.

Im not pro in scripting so.. if any1 could help me would be very thankful =)

Thanks, Ukdjaj[thumbs_up]
Share |
hyper1234
General Member
Since: Mar 17, 2009
Posts: 358
Last: Apr 13, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 11:35 am
It depends on how you want to give the player ammo.

If you want it so that when you press a button on a trigger (white hand), you need to put a trigger_use_touch in your map and tgive it a key of: targetname and value of: trig_ammo

If you want it to happen by them walking into a trigger, you need to use a trigger_multiple but give same keys/values

Thats the radiant part.

For the gsc script:

Code:
main()
{
thread giveAmmo();
}

giveAmmo()
{
	trig = getent( "trig_ammo","targetname" );
	
	for( ;; )
	{
		trig waittill( "trigger", player );
		
		if( isPlayer( player ) && player isTouching( trig ) && isAlive( player ) && self.pers["team"] == "allies")
		{
			firstSlot = player getweaponslotweapon("primary");
			secondSlot = player getweaponslotweapon("primaryb");
					
			player GiveMaxAmmo( firstSlot );
			player GiveMaxAmmo( secondSlot );
		}
		else
		{
			// Axis won't recieve any ammo
			// Could add messages here?
		}
	}
}



Hope this works for you.
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2725
Last: May 17, 2016
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 11:49 am
thanks mate will try now =)
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2725
Last: May 17, 2016
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 11:58 am
hi mate problem - its works to well =) it gives ammos to allies but also axis =/ idk how would edit the script can someone help me please?
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 12:43 pm
I see a misspelling there [biggrin]:

Instead
self.pers["team"] == "allies"

type:
player.pers["team"] == "allies"

It should do the trick [duh] Cheers
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2725
Last: May 17, 2016
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 12:44 pm
thx
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 12:46 pm
Code:
main()
{
	thread giveAmmo();
}

giveAmmo()
{
	trig = getent( "trig_ammo", "targetname" );
	
	for( ;; )
	{
		trig waittill( "trigger", player );
		
		if( isPlayer( player ) && player isTouching( trig ) && isAlive( player ) )
		{
			if( player.pers["team"] == "allies" )
			{
				player GiveMaxAmmo( player getweaponslotweapon("primary") );
				player GiveMaxAmmo( player getweaponslotweapon("primaryb") );
			}
		}
	}
}
Share |
hyper1234
General Member
Since: Mar 17, 2009
Posts: 358
Last: Apr 13, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 01:33 pm
Oops, just noticed my mistake.

Yeah, self should be player ;)

Demonseed's will work aswell but their both as good as each other.
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 01:36 pm
Because practically they're the same. Oups, sorry, conditions arrangement is different. Was there a point of posting the same code once again? Suppose not.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Jul. 23, 2010 01:46 pm
tomalla writes...
Quote:
Because practically they're the same. Oups, sorry, conditions arrangement is different. Was there a point of posting the same code once again? Suppose not.


I posted mine at the same time you posted your correction and they overlapped.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»