Jump to content

Recommended Posts

I wonder if anyone can tell me syntax I should look for in the weapons.cfg to work out the reload time of a weapon (specifically infantry weapons) ? Or where to find the variables that affect the reload time etc.

 

I've done a search and there doesn't seem to be any info. especially when a lot of weapons say 0 in the weapons.cfg - so I guess it's tied to the reload animation? Is there anywhere to find the times of those? Or if some scripting god can explain what variables, in which files I need to look at to calculate the reload (switching mags) time for every weapon.

Share this post


Link to post
Share on other sites

Put this to debug console in editor and exec, it should give you (hint) weapon class name and reload duration when you reload any weapon.

	//loop to detect 'reload' keypress
	[] spawn 
	{
		while {alive player} do {

		waitUntil {inputAction "reloadMagazine" > 0};
		
			goko_var_t1 = time;
			hint "calculating reload time...";

		waitUntil {inputAction "reloadMagazine" == 0};
		
		};
	};
	
	//EH to detect when reloaded and calculate time difference to find weapon's reload time
	player addeventhandler ["reloaded", {
		params ["", "_weapon", "_muzzle", "_newmag", ["_oldmag", ["","","",""]]];
		
		_t2 = time;
		_t1 = goko_var_t1;
		_calc = _t2 - _t1;

		hint format ["This weapon's config name is:\n %1\n	and it takes %2 seconds to reload", _weapon, _calc];
	}];

 

  • Thanks 1

Share this post


Link to post
Share on other sites

What can I say that is simply awesome! Thanks a bunch! Didn't want to put anyone to any trouble but that is bloody brilliant!!!  Will credit you for the help on my little YT channel if that's ok with you?

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×