• 5
FordDefect

Fixed in latest Exile patch ( > 0.9.35 )

Question

Create a new file in your missions fold called ExileClient_util_gear_repackMagazines.sqf

Copy this contents into it.

/**
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_container","_magazineClassName","_ammoToChange","_ammoPerMagazine","_equippedAmmo","_equippedMagazines","_ammoToRefund","_ammoToRefundThisRound"];
_container = _this select 0;
_magazineClassName = _this select 1;
_ammoToChange = _this select 2;
_ammoPerMagazine = getNumber(configFile >> "CfgMagazines" >> _magazineClassName >> "count");
_equippedAmmo = 0;
_equippedMagazines = magazinesAmmo _container;
if (_ammoPerMagazine > 1) then
{
	{
		if ((_x select 0) isEqualTo _magazineClassName) then
		{
			_equippedAmmo = _equippedAmmo + (_x select 1);
		};
	}
	forEach _equippedMagazines;
	_container removeMagazines _magazineClassName; //the fix
	_ammoToRefund = _equippedAmmo + _ammoToChange;
	while {_ammoToRefund > 0} do
	{
		_ammoToRefundThisRound = _ammoToRefund min _ammoPerMagazine;
		_container addMagazine [_magazineClassName, _ammoToRefundThisRound];
		_ammoToRefund = _ammoToRefund - _ammoToRefundThisRound;
	};
};

 then add the following line to your mission config file

 

class CfgExileCustomCode 
{
	/*
		You can overwrite every single file of our code without touching it.
		To do that, add the function name you want to overwrite plus the 
		path to your custom file here. If you wonder how this works, have a
		look at our bootstrap/fn_preInit.sqf function.

		Simply add the following scheme here:

		<Function Name of Exile> = "<New File Name>";

		Example:

		ExileClient_util_fusRoDah = "myaddon/myfunction.sqf";
	*/
	
	ExileClient_util_gear_repackMagazines = "ExileClient_util_gear_repackMagazines.sqf";
};

 

the bug was just use of the wrong command removeItems rather than removeMagazines.

 

The solution has already been on the forums but nobody had made it explicit.

Edited by FordDefect
Redundant Thread
  • Like 13

Share this post


Link to post
Share on other sites

19 answers to this question

Advertisement
  • 0

sorry to be pedantic but, just thought I would point out the difference in the target file name at the beginning of the instructions due to a small typo.

Just in case anyone is banging their heads... :)

ExieClient_util_gear_repackMagazines.sqf
should be:
ExileClient_util_gear_repackMagazines.sqf

Thanks for the fix :)

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

I cannot for the LIFE of me get this to work NO idea why i created the sqf and added above, Fixed the spelling mistake put it into the mission file and added 

class CfgExileCustomCode 
{
    /*
        You can overwrite every single file of our code without touching it.
        To do that, add the function name you want to overwrite plus the 
        path to your custom file here. If you wonder how this works, have a
        look at our bootstrap/fn_preInit.sqf function.

        Simply add the following scheme here:

        <Function Name of Exile> = "<New File Name>";

        Example:

        ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
    
    */
    // Disable Bomb dropping on safe zone
    ExileClient_object_player_event_onEnterSafezone = "overwrites\exile_server\code\ExileClient_object_player_event_onEnterSafezone.sqf";
    // duping thermal code lock // COMBINE MAGS BUG 
    ExileClient_util_gear_repackMagazines = "ExileClient_util_gear_repackMagazines.sqf";

};

 

what am i missing 

 

 

 

(EDIT)    THIS IS WHAT MESSED ME UP          /** 

 

 

 

 

Edited by Tuna

Share this post


Link to post
Share on other sites
  • 0

I cannot for the LIFE of me get this to work NO idea why i created the sqf and added above, Fixed the spelling mistake put it into the mission file and added 

class CfgExileCustomCode 
{
    /*
        You can overwrite every single file of our code without touching it.
        To do that, add the function name you want to overwrite plus the 
        path to your custom file here. If you wonder how this works, have a
        look at our bootstrap/fn_preInit.sqf function.

        Simply add the following scheme here:

        <Function Name of Exile> = "<New File Name>";

        Example:

        ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
    
    */
    // Disable Bomb dropping on safe zone
    ExileClient_object_player_event_onEnterSafezone = "overwrites\exile_server\code\ExileClient_object_player_event_onEnterSafezone.sqf";
    // duping thermal code lock // COMBINE MAGS BUG 
    ExileClient_util_gear_repackMagazines = "ExileClient_util_gear_repackMagazines.sqf";

};

 

what am i missing 

 

 

 

(EDIT)    THIS IS WHAT MESSED ME UP          /** 

 

 

you must add the new files in to your missionfile, not your serverfiles... 

Share this post


Link to post
Share on other sites
  • 0

for this guys as im confused when you say mission file like in my server root menu i have mpmission and a folder named exile.altis .

Half mp problem is i dont know where things go ,so some could be more specific please

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.