Modme Forums

Buyable ammo trigger for only one weapon

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: XxCAFxX

Could anyone give me a script kind of similar to the ammo matic on MadGaz's map "Fabrik Der Untoten"? The only script I can find gives what is basically a max ammo. I want a script that only gives ammo to your current weapon and not your secondary or other players. If anyone could help out I would really apritiate it. I'll be sure to give credit if i upload the map.


ModmeBot:

Reply By: natesmithzombies

I did not write the Ammo Matic script for FDUT. From my understanding of how the machine works, this should do the same thing. Let me know if you have issues or not so I can mark the topic as answered.

Step 1) Paste this at the bottom of your mapname.gsc

function ammo_matic()
{
	cost = 5000; 
	trigs = GetEntArray( "ammo_matic", "targetname" ); 
	foreach( trig in trigs )
	{
		trig thread ammo_matic_think( cost );
		trig SetCursorHint( "HINT_NOICON" ); 
		trig SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}

function ammo_matic_think( cost )
{
	while(1)
	{
		self waittill( "trigger", player );
		if( player.score >= cost )
		{
			weapon = player GetCurrentWeapon();
			player zm_weapons::weapon_give( weapon ); 
			PlaySoundAtPosition( "zmb_cha_ching", self.origin ); 
			player zm_score::minus_to_player_score( cost ); 
			self SetHintString(""); 
			wait(3); 
		}
		else
		{
			self SetHintString( "You Do Not Have Enough Money" ); 
			wait(3); 
		}
		self SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}



Step 2) Add this to your function main in your mapname.gsc:

ammo_matic();



Step 3) Add this to the top of your mapname.gsc:

#using scripts\zm\_zm_weapons;



Step 4) Insert as many trigger uses in your map as you would like for each of the machines you want. Give it the following KVP:

targetname - ammo_matic

Good luck!


ModmeBot:

Reply By: XxCAFxX

natesmithzombies

I did not write the Ammo Matic script for FDUT. From my understanding of how the machine works, this should do the same thing. Let me know if you have issues or not so I can mark the topic as answered.

Step 1) Paste this at the bottom of your mapname.gsc

function ammo_matic()
{
	cost = 5000; 
	trigs = GetEntArray( "ammo_matic", "targetname" ); 
	foreach( trig in trigs )
	{
		trig thread ammo_matic_think( cost );
		trig SetCursorHint( "HINT_NOICON" ); 
		trig SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}

function ammo_matic_think( cost )
{
	while(1)
	{
		self waitill( "trigger", player );
		if( player.score >= cost )
		{
			weapon = player GetCurrentWeapon();
			zm_weapons::weapon_give( weapon ); 
			player zm_score::minus_to_player_score( cost ); 
			self SetHintString(""); 
			wait(3); 
		}
		else
		{
			self SetHintString( "You Do Not Have Enough Money" ); 
			wait(3); 
		}
		self SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}



Step 2) Add this to your function main in your mapname.gsc:

ammo_matic();



Step 3) Add this to the top of your mapname.gsc:

#using scripts\zm\_zm_weapons;



Step 4) Insert as many trigger uses in your map as you would like for each of the machines you want. Give it the following KVP:

targetname - ammo_matic

Good luck!

Thanks for the reply, I just tested it and got a compiling error.

UNRECOVERABLE ERROR:

^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_town.gsc'

ERR(6E) scripts/zm/zm_town.gsc (165,1) : Compiler Internal Error : Uninitialized local variable 'player'


ModmeBot:

Reply By: XxCAFxX

XxCAFxX
natesmithzombies

I did not write the Ammo Matic script for FDUT. From my understanding of how the machine works, this should do the same thing. Let me know if you have issues or not so I can mark the topic as answered.

Step 1) Paste this at the bottom of your mapname.gsc

function ammo_matic()
{
	cost = 5000; 
	trigs = GetEntArray( "ammo_matic", "targetname" ); 
	foreach( trig in trigs )
	{
		trig thread ammo_matic_think( cost );
		trig SetCursorHint( "HINT_NOICON" ); 
		trig SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}

function ammo_matic_think( cost )
{
	while(1)
	{
		self waitill( "trigger", player );
		if( player.score >= cost )
		{
			weapon = player GetCurrentWeapon();
			zm_weapons::weapon_give( weapon ); 
			player zm_score::minus_to_player_score( cost ); 
			self SetHintString(""); 
			wait(3); 
		}
		else
		{
			self SetHintString( "You Do Not Have Enough Money" ); 
			wait(3); 
		}
		self SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}



Step 2) Add this to your function main in your mapname.gsc:

ammo_matic();



Step 3) Add this to the top of your mapname.gsc:

#using scripts\zm\_zm_weapons;



Step 4) Insert as many trigger uses in your map as you would like for each of the machines you want. Give it the following KVP:

targetname - ammo_matic

Good luck!

Thanks for the reply, I just tested it and got a compiling error.

UNRECOVERABLE ERROR:



^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_town.gsc'



ERR(6E) scripts/zm/zm_town.gsc (165,1) : Compiler Internal Error : Uninitialized local variable 'player'

This is what was on line 165

self waitill( "trigger", player );


ModmeBot:

Reply By: natesmithzombies

XxCAFxX
XxCAFxX
natesmithzombies

I did not write the Ammo Matic script for FDUT. From my understanding of how the machine works, this should do the same thing. Let me know if you have issues or not so I can mark the topic as answered.

Step 1) Paste this at the bottom of your mapname.gsc

function ammo_matic()
{
	cost = 5000; 
	trigs = GetEntArray( "ammo_matic", "targetname" ); 
	foreach( trig in trigs )
	{
		trig thread ammo_matic_think( cost );
		trig SetCursorHint( "HINT_NOICON" ); 
		trig SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}

function ammo_matic_think( cost )
{
	while(1)
	{
		self waitill( "trigger", player );
		if( player.score >= cost )
		{
			weapon = player GetCurrentWeapon();
			zm_weapons::weapon_give( weapon ); 
			player zm_score::minus_to_player_score( cost ); 
			self SetHintString(""); 
			wait(3); 
		}
		else
		{
			self SetHintString( "You Do Not Have Enough Money" ); 
			wait(3); 
		}
		self SetHintString( "Press and Hold ^3&&1^7 to Buy Ammo [Cost: "+cost+"]" ); 
	}
}



Step 2) Add this to your function main in your mapname.gsc:

ammo_matic();



Step 3) Add this to the top of your mapname.gsc:

#using scripts\zm\_zm_weapons;



Step 4) Insert as many trigger uses in your map as you would like for each of the machines you want. Give it the following KVP:

targetname - ammo_matic

Good luck!

Thanks for the reply, I just tested it and got a compiling error.

UNRECOVERABLE ERROR:



^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_town.gsc'



ERR(6E) scripts/zm/zm_town.gsc (165,1) : Compiler Internal Error : Uninitialized local variable 'player'

This is what was on line 165

self waitill( "trigger", player );

lol I spelled waittill wrong. I forgot a 't'. The original code I posted has been updated


ModmeBot:

Reply By: XxCAFxX

alright, it compiled that time but when i purchased the ammo it took the points but didn't give any ammo


ModmeBot:

Reply By: natesmithzombies

XxCAFxX

alright, it compiled that time but when i purchased the ammo it took the points but didn't give any ammo

Man the little stuff always gets me. I am finally home and was able to test the code. Stupid typos get me every time. Code is updated and working perfect. Checked it myself ;)


ModmeBot:

Reply By: XxCAFxX

natesmithzombies
XxCAFxX

alright, it compiled that time but when i purchased the ammo it took the points but didn't give any ammo

Man the little stuff always gets me. I am finally home and was able to test the code. Stupid typos get me every time. Code is updated and working perfect. Checked it myself ;)

Thanks Nate! You're the best!