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

Members Online

»
0 Active | 84 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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Chambered round while reloading?
Cnopicilin
General Member
Since: Dec 15, 2009
Posts: 94
Last: Jul 6, 2011
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Wednesday, Feb. 2, 2011 06:22 pm
Hi!

I'd love to know how to edit the weapons so that when you reload with half-trough mag you will get 31 bullets and when you reload an empty mag you'd get 30 bullets. The 31st bullet is in the chamber while you reload. Segmented reload did not work.

Thanks!
Share |
Samuel033
General Member
Since: Dec 10, 2009
Posts: 484
Last: Dec 25, 2015
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Thursday, Feb. 3, 2011 12:49 am
As far as I know the max is whatever the clip can hold. There is no 'one in the chamber' in addition to the clip possible. However if you want to write a script I suppose you can have a watcher that waits until weapon reload (waittill 'reload_weapon') I think or something like that, sets a 'full clip' flag of some sort, then waits until the weapon is fired the first time. Then add one to the current clip.
Share |
Cnopicilin
General Member
Since: Dec 15, 2009
Posts: 94
Last: Jul 6, 2011
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Feb. 3, 2011 06:01 am
Samuel033 writes...
Quote:
As far as I know the max is whatever the clip can hold. There is no 'one in the chamber' in addition to the clip possible. However if you want to write a script I suppose you can have a watcher that waits until weapon reload (waittill 'reload_weapon') I think or something like that, sets a 'full clip' flag of some sort, then waits until the weapon is fired the first time. Then add one to the current clip.
ltSpeir has made it, too bad he is out of reach.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Saturday, Mar. 5, 2011 01:43 pm
Try using this: (its written with cod2 in mind, so you might have to change a few things):
Code:

watchreload()
{
	self endon("disconnect");
	self endon("spawned");
	self endon("killed");
	self endon("killed_player");
	self.weapon["primary"]["name"]=self getweaponslotweapon("primary");
	self.weapon["primary"]["ammo"]=self getweaponslotammo("primary");
	self.weapon["primary"]["clip"]=self getweaponslotclipammo("primary");
	self.weapon["primaryb"]["name"]=self getweaponslotweapon("primaryb");
	self.weapon["primaryb"]["ammo"]=self getweaponslotammo("primaryb");
	self.weapon["primaryb"]["clip"]=self getweaponslotclipammo("primaryb");
	for(;;)
	{
		slot=self getcurrentweaponslot();
		if(self.weapon[slot]["name"]==self getweaponslotweapon(slot)&&slot!="none")
		{
			//player hasnt picked up a new weapon
			if(self.weapon[slot]["clip"]<self getweaponslotclipammo(slot));
			{
				//player has reloaded the weapon
				if(self.weapon[slot]["clip"]==0)
				{
					//player has reloaded an empty weapon
					self setweaponslotammo(slot,self getweaponslotammo(slot)+1); //add one bullet to the non-clip ammo
					self setweaponslotclipammo(slot,self getweaponslotclipammo(slot)-1); //substract one from the clip ammo
				}
			}
		}
		else if(slot!="none")
		{
			//player picked up a new weapon
			self.weapon[slot]["name"]=self getweaponslotweapon(slot);
		}
		self.weapon["primary"]["ammo"]=self getweaponslotammo("primary");
		self.weapon["primary"]["clip"]=self getweaponslotclipammo("primary");
		self.weapon["primaryb"]["ammo"]=self getweaponslotammo("primaryb");
		self.weapon["primaryb"]["clip"]=self getweaponslotclipammo("primaryb");
		wait 0.05;
	
	}
}

getcurrentweaponslot()
{
	if(!isdefined(self getcurrentweapon()))
		return "none";
	else if(self getcurrentweapon()=="none")
		return "none";
	else if(self getcurrentweapon()==self getweaponslotweapon("primary"))
		return "primary";
	else if(self getcurrentweapon()==self getweaponslotweapon("primaryb"))
		return "primaryb";
	else
		return "none";
}

untested code, use @ own risk
Share |
Cnopicilin
General Member
Since: Dec 15, 2009
Posts: 94
Last: Jul 6, 2011
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Saturday, Mar. 5, 2011 02:02 pm
I already figured it out, thanks anyways!
Share |
Zaphax
General Member
Since: Jun 17, 2008
Posts: 251
Last: Dec 29, 2013
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Saturday, Mar. 5, 2011 02:05 pm
There are some .gsc files with the weapon stats and all that you can modify with notepad then save it and use it in your mod but what you want works only with the sub-machine guns ex. Thompson, MP44, Sten if you want it for rifles you should need to use script.
Share |
Samuel033
General Member
Since: Dec 10, 2009
Posts: 484
Last: Dec 25, 2015
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Saturday, Mar. 5, 2011 07:02 pm
Cnopicilin writes...
Quote:
I already figured it out, thanks anyways!


What did you end up doing?
Share |
Cnopicilin
General Member
Since: Dec 15, 2009
Posts: 94
Last: Jul 6, 2011
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Saturday, Mar. 5, 2011 09:28 pm
Playing around with the reload controls in assett manager
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»