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

Members Online

»
0 Active | 111 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: World at War
Category: CoDWW Zombie/Co-Op Mapping
CoD: World at War co-op mapping and level design. Zombie maps and other co-op mapping help.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: [Tutorial] Buyable Ammo
Sgt.Rampage
General Member
Since: Dec 18, 2005
Posts: 297
Last: Aug 21, 2009
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoDWW Zombie/Co-Op Mapping
Posted: Wednesday, May. 20, 2009 06:59 pm
Information
This will show you how to put buyable ammo in your map, allowing players to buy ammo for any weapon they are holding.

Radiant
Open your map in Radiant and put a trigger_use where you want to have the buyable ammo at. Then, give it these KVPs:

Code:
"targetname" "give_ammo"
"zombie_cost" "1500"
"hintstring" "Press [Use] to buy ammo [Cost: 1500]"


NOTE: You may also set the cost to what you want. Just be sure to modify the hint string.

Save the map and close Radiant.

GSC
Open yourmap.gsc (raw\maps) and put this in the init_nazi_zombie_ver_ex() function:

Code:
ammo_trigs = getentarray("give_ammo","targetname");
array_thread(ammo_trigs,::give_ammo);


Then, create a new function:

Code:
give_ammo()
{
	while(1)
	{
		wait(0.05);

		// variables
		who = undefined;

		self SetCursorHint( "HINT_ACTIVATE" );
		self UseTriggerRequireLookAt();
		self waittill("trigger", who);

		weapon = who GetCurrentWeapon();
		ammocount = who getammocount(weapon);
		clipcount = who getweaponammoclip(weapon);
		maxammo = weaponmaxammo(weapon);
      
		if( !is_player_valid( who ) || maxammo <= ammocount + clipcount) continue;
   
		give = 0;

		if ( weapon != "fraggrenade" && weapon!= "stielhandgranate" && weapon != "molotov" && weapon != "mine_bouncing_betty")
		{
			if( who.score > self.zombie_cost )
			{
				give = 1;
			}
			else
			{
				give = 0;
			}
		}

		if( give > 0 )
		{
			who givemaxammo( who GetCurrentWeapon() );
			who maps\_zombiemode_score::minus_to_player_score( self.zombie_cost );
			who playsound( "cha_ching" );
		}      
		else
		{
			who playsound( "no_cha_ching" );
		}
	}   
}


Save and close.

Credits
[HOG]Rampage
Jacmac
customcod.com
modsonline.com
[SSG]Titan*BK*




edited on May. 20, 2009 03:01 pm by Sgt.Rampage

edited on May. 20, 2009 03:02 pm by Sgt.Rampage
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoDWW Zombie/Co-Op Mapping
Posted: Wednesday, May. 20, 2009 10:43 pm
I have made something just like this. However, mine would give you ammo, just as if you got a max ammo, but just for you. I also had it randomly give it a new cost each time it was used. Nice job :)
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty: World at War : CoDWW Zombie/Co-Op 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

»