weapons with unlimited ammo
Moderator: Core Staff
weapons with unlimited ammo
how can i place a weapon with unlimited ammo, in my jump map i am placing weapons in secret locations, but though i can add the weapon without any problems, when you pick up the weapon,it only has a few rounds in it weapon clip, so how do i make it have unlimited ammo in each weapon.? do i need to build a weapon mod.?? hope not as im no good at scripting?
Re: weapons with unlimited ammo
im not sure unlimited ammo is possible, but all i do is place the weapon where i want it and copy and paste quite a few times then when u pick up the weapon it will also pick up ammo from the copied and pasted weapons. 

Partnered Channel:
http://www.youtube.com/user/RaCeY2k8
Tutorials:
http://www.youtube.com/TheTutGuyHD
Twitter:
http://www.twitter.com/RaCeY2k8
http://www.youtube.com/user/RaCeY2k8
Tutorials:
http://www.youtube.com/TheTutGuyHD
Twitter:
http://www.twitter.com/RaCeY2k8
Re: weapons with unlimited ammo
thats what im using right now, but been on maps where you pick up 1 weapon and it full,unlimited ammo.? thats what i want, save keep placing 50 weapons ect all over the map.lolxrgz wrote:im not sure unlimited ammo is possible, but all i do is place the weapon where i want it and copy and paste quite a few times then when u pick up the weapon it will also pick up ammo from the copied and pasted weapons.
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: weapons with unlimited ammo
To my knowledge the only way of doing that is to change the weapon files.
It's very easy .. give it a try.
It's very easy .. give it a try.
Re: weapons with unlimited ammo
its possable to pick up any weapon, and run a script on that weapon to give it unlimited ammo. you can do this with a trigger or menu activated. what the code does is waits for the weapon to be fired and then resets your ammo to max again ---> infinite ammo. it works nicely for me
just simply place a trigger with a targetname "ammo_trigger" and thread this code in your gsc and your done
however i havnt tested it, i just quickly coded it.
Code: Select all
infinite_ammo()
{
player.nolimit = undefined
trigger = getent("ammo_trigger", "targetname");
while(1)
{
trigger waittill("trigger", player);
{
if(!isdefined( player.nolimit ))
{
player.nolimit = true;
//threaded
player thread infinite_ammo_threaded();
player iprintlnbold("Infinite ammo ^2ON");
}
else if(isdefined( player.nolimit ))
{
player.nolimit = undefined;
player iprintlnbold("Infinite ammo ^1OFF");
}
}
}
}
infinite_ammo_threaded()
{
while(isdefined( self.nolimit ))
{
self waittill( "weapon_fired" );
currentweapon = self GetCurrentWeapon();
wait 0.0001;
self SetWeaponAmmoClip( (currentweapon), 30 );
self SetWeaponAmmoStock( (currentweapon), 300 );
}
}
however i havnt tested it, i just quickly coded it.
Re: weapons with unlimited ammo
Ohh thats good.Stealth wrote:it works nicely for me.
Lol nevermind =/Stealth wrote:however i havnt tested it, i just quickly coded it.
Join my server @ 217.163.22.223:28960
Re: weapons with unlimited ammo
1. that first line is bad in 2 ways: player is undefined, and you dont end the line with a ; You can basically remove the line, and have the same effect, as the var is not defined when a player connects. Maybe you should set it to undefined too when a player spawns.Stealth wrote:Code: Select all
player.nolimit = undefined
Code: Select all
wait 0.0001; self SetWeaponAmmoClip( (currentweapon), 30 ); self SetWeaponAmmoStock( (currentweapon), 300 );
2. The wait is way too short, but it would work. The sv_fps is 20, thus the minimal waitingtime is 0.05 (1/20) seconds. Using anything smaller than that will result in a 0.05 second waittime. Even so when you use wait 0.06, it will wait 0.10 seconds.
3. You can easily set the weapon(clip) ammo to 999, as cod will auto limit the number of bullets in a gun, and then the amount of ammo will be maxed.
4. Add a self endon disconnect to the player thread, as it should stop running when a player disconnects.
Re: weapons with unlimited ammo
Stealth wrote:its possable to pick up any weapon, and run a script on that weapon to give it unlimited ammo. you can do this with a trigger or menu activated. what the code does is waits for the weapon to be fired and then resets your ammo to max again ---> infinite ammo. it works nicely for me
just simply place a trigger with a targetname "ammo_trigger" and thread this code in your gsc and your doneCode: Select all
infinite_ammo() { player.nolimit = undefined trigger = getent("ammo_trigger", "targetname"); while(1) { trigger waittill("trigger", player); { if(!isdefined( player.nolimit )) { player.nolimit = true; //threaded player thread infinite_ammo_threaded(); player iprintlnbold("Infinite ammo ^2ON"); } else if(isdefined( player.nolimit )) { player.nolimit = undefined; player iprintlnbold("Infinite ammo ^1OFF"); } } } } infinite_ammo_threaded() { while(isdefined( self.nolimit )) { self waittill( "weapon_fired" ); currentweapon = self GetCurrentWeapon(); wait 0.0001; self SetWeaponAmmoClip( (currentweapon), 30 ); self SetWeaponAmmoStock( (currentweapon), 300 ); } }
however i havnt tested it, i just quickly coded it.
SORRY, DONT WORK, and messed up my map again, more repair work?
Re: weapons with unlimited ammo
IzNoGoD wrote:1. that first line is bad in 2 ways: player is undefined, and you dont end the line with a ; You can basically remove the line, and have the same effect, as the var is not defined when a player connects. Maybe you should set it to undefined too when a player spawns.Stealth wrote:Code: Select all
player.nolimit = undefined
Code: Select all
wait 0.0001; self SetWeaponAmmoClip( (currentweapon), 30 ); self SetWeaponAmmoStock( (currentweapon), 300 );
2. The wait is way too short, but it would work. The sv_fps is 20, thus the minimal waitingtime is 0.05 (1/20) seconds. Using anything smaller than that will result in a 0.05 second waittime. Even so when you use wait 0.06, it will wait 0.10 seconds.
3. You can easily set the weapon(clip) ammo to 999, as cod will auto limit the number of bullets in a gun, and then the amount of ammo will be maxed.
4. Add a self endon disconnect to the player thread, as it should stop running when a player disconnects.
is this all i need? and do i put it in m main gsc file..??
player.nolimit = undefined
wait 0.0001;
self SetWeaponAmmoClip( (currentweapon), 30 );
self SetWeaponAmmoStock( (currentweapon), 300 );
Who is online
Users browsing this forum: No registered users and 5 guests