Jump to content

Assomnia

Member
  • Posts

    20
  • Joined

  • Last visited

Posts posted by Assomnia

  1. 9 hours ago, oldmatechoc said:

     

     

    Hello there,

    Thanks for the link. I saw it already actually and made the change. Unfortunately this is a fix for a DB selling with the traders using Gold to exchange. As I'm using the Coins system the DB is not involved anymore. Therefore I have 2 files : trade_items.sqf and trade_items_wo_db.sqf. The fix can be added in the trade_items_wo_db.sqf but I don't find the way I can fix that in the trade_items.sqf.

    Where can I place this fix in the Trade_items.sqf :

    Spoiler
    
    if(InstantTrading) then {
    
    private ["_qty","_buy_o_sell","_playerCash","_needed","_started","_finished","_animState","_isMedic","_abort","_removed","_tradeCounter","_traderID","_total_trades","_activatingPlayer","_finish_trade","_name","_textPart","_price","_emptySlots","_free_magazine_slots"];
    
    if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_103") , "PLAIN DOWN"] };
    
    DZE_ActionInProgress = true;
    
    _buy_o_sell = (_this select 3) select 4;
    _activatingPlayer = player;
    
    if(_buy_o_sell == "buy") then {
    
    	_finish_trade = {
    		{player removeAction _x} forEach s_player_parts;s_player_parts = [];
    		s_player_parts_crtl = -1;
    		DZE_ActionInProgress = false;
    		dayzTradeResult = nil;
    	};
    
    	_name = (_this select 3) select 0;
    	_textPart = (_this select 3) select 6;
    	_price = (_this select 3) select 3;
    	_traderID = (_this select 3) select 7;
    	_emptySlots = [player] call BIS_fnc_invSlotsEmpty;
    	_free_magazine_slots = _emptySlots select 4;
    	_tradeCounter = 0;
    
    	if(_free_magazine_slots < 1) exitWith {
    		cutText [(localize "STR_DAYZ_CODE_2"), "PLAIN DOWN"];
    		DZE_ActionInProgress = false;
    	};
    
    	_playerCash = player getVariable ["cashMoney",0];
    	_total_trades = floor(_playerCash / _price);
    
    	if (_total_trades < 1) exitWith {
    		_needed =  _price - _playerCash;
    		cutText [format[(localize "str_epoch_player_184"),_needed,CurrencyName] , "PLAIN DOWN"];
    		call _finish_trade;
    	};
    
    	if (_total_trades > _free_magazine_slots) then {
    		_total_trades = _free_magazine_slots;
    	};
    
    	_abort = false;
    
    	for "_x" from 1 to _total_trades do {
    
    		_tradeCounter = _tradeCounter + 1;
    
    		if(_total_trades == 1) then { 
    			cutText [(localize "STR_EPOCH_PLAYER_105"), "PLAIN DOWN"];
    		} else {
    			cutText [format[(localize "STR_EPOCH_PLAYER_187"),_tradeCounter,_total_trades], "PLAIN DOWN"];
    		};
    
    		private["_newPosition","_finished","_oldPosition"];
    
    		if(isNil "_oldPosition") then { _oldPosition = position player;};
    		_finished = false;
    		sleep 2;
    		if (player distance _oldPosition <= 1) then {
    			_finished = true;
    		};
    
    		if (!_finished) exitWith {
                DZE_ActionInProgress = false;
                r_autoTrade = false;
                cutText [(localize "str_epoch_player_106") , "PLAIN DOWN"];
    		};
    
    		if (_finished) then {
    			if (_playerCash >= _price) then {
    				_playerCash = player getVariable ["cashMoney",0];
    				player setVariable["cashMoney",(_playerCash - _price),true];
    				player addMagazine _name;
    				_abort = false;
    				cutText [format["Traded %1 %2 for %3",_price,CurrencyName,_textPart], "PLAIN DOWN"];
    				PVDZE_plr_Save = [player,(magazines player),true,true] ;
    				publicVariableServer "PVDZE_plr_Save";
    				if (isNil "_name") then { _name = "Unknown Item"; };
    				if (isNil "inTraderCity") then {
    					inTraderCity = "Unknown Trader"; 
    				} else {
    					if (inTraderCity == "Any") then {
    						inTraderCity = "Unknown Trader"; 
    					};
    				};
    				PVDZE_obj_Trade = [_activatingPlayer,_traderID,0,_name,inTraderCity,CurrencyName,_price];
    				publicVariableServer "PVDZE_obj_Trade";
    			} else {
    				_needed =  _price - _playerCash;
    				cutText [format[(localize "str_epoch_player_184"),_needed,CurrencyName] , "PLAIN DOWN"];
    				_abort = true;
    			};
    		};
    		sleep 1;
    		if(_abort) exitWith {};
    	};
    
    	DZE_ActionInProgress = false;
    
    } else {
    
    	_finish_trade = {
    		{player removeAction _x} forEach s_player_parts;s_player_parts = [];
    		s_player_parts_crtl = -1;
    		DZE_ActionInProgress = false;
    		dayzTradeResult = nil;
    	};
    
    	_name = (_this select 3) select 1;
    	_textPart = (_this select 3) select 5;
    	_price = (_this select 3) select 2;
    	_traderID = (_this select 3) select 7;
    
    	_qty = {_x == _name} count magazines player;
    
    	_removed = 0;
    	_tradeCounter = 0;
    
    	_total_trades = _qty;
    	if (_total_trades < 1) exitWith {
    		cutText [format["You do not have a %1", _textPart], "PLAIN DOWN"];
    		call _finish_trade;
    	};
    
    	_abort = false;
    
    	for "_x" from 1 to _total_trades do {
    		_tradeCounter = _tradeCounter + 1;
    
    		if(_total_trades == 1) then { 
    			cutText [(localize "STR_EPOCH_PLAYER_105"), "PLAIN DOWN"];
    		} else {
    			cutText [format[(localize "STR_EPOCH_PLAYER_187"),_tradeCounter,_total_trades], "PLAIN DOWN"];
    		};
    
    		private["_newPosition","_finished","_oldPosition"];
    
    		if(isNil "_oldPosition") then { _oldPosition = position player;};
    		_finished = false;
    		sleep 2;
    		if (player distance _oldPosition <= 1) then {
    			_finished = true;
    		};
    
    		if (!_finished) exitWith {
                DZE_ActionInProgress = false;
                r_autoTrade = false;
                cutText [(localize "str_epoch_player_106") , "PLAIN DOWN"];
    		};
    
    		if (_finished) then {
    		
    			_removed = ([player,_name,1] call BIS_fnc_invRemove);
    			if (_removed > 0) then {
    				_playerCash = player getVariable ["cashMoney",0];	
    				player setVariable["cashMoney",(_playerCash + _price),true];
    				cutText [format[("Traded %1 for %2 %3"),_textPart,_price,CurrencyName], "PLAIN DOWN"];
    				PVDZE_plr_Save = [player,(magazines player),true,true] ;
    				publicVariableServer "PVDZE_plr_Save";
    				if (isNil "_name") then { _name = "Unknown Item"; };
    				if (isNil "inTraderCity") then {
    					inTraderCity = "Unknown Trader City"; 
    				} else {
    					if (inTraderCity == "Any") then {
    						inTraderCity = "Unknown Trader"; 
    					};
    				};
    				PVDZE_obj_Trade = [_activatingPlayer,_traderID,1,_name,inTraderCity,CurrencyName,_price];
    				publicVariableServer "PVDZE_obj_Trade";
    			} else {
    				cutText [format["Something went wrong. Could not remove %1 from inventory", _name], "PLAIN DOWN"];
    				_abort = true;
    			};
    		};
    		sleep 1;
    		if(_abort) exitWith {};
    	};
    	DZE_ActionInProgress = false;
    };
    
    DZE_ActionInProgress = false;
    
    } else {
    
    private ["_qty","_buy_o_sell","_playerCash","_needed","_started","_finished","_animState","_isMedic","_abort","_removed","_tradeCounter","_traderID","_total_trades","_activatingPlayer","_finish_trade","_name","_textPart","_price","_emptySlots","_free_magazine_slots"];
    
    if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_103") , "PLAIN DOWN"] };
    
    DZE_ActionInProgress = true;
    
    _buy_o_sell = (_this select 3) select 4;
    _activatingPlayer = player;
    
    if(_buy_o_sell == "buy") then {
    
    	_finish_trade = {
    		{player removeAction _x} forEach s_player_parts;s_player_parts = [];
    		s_player_parts_crtl = -1;
    		DZE_ActionInProgress = false;
    		dayzTradeResult = nil;
    	};
    
    	_name = (_this select 3) select 0;
    	_textPart = (_this select 3) select 6;
    	_price = (_this select 3) select 3;
    	_traderID = (_this select 3) select 7;
    	_emptySlots = [player] call BIS_fnc_invSlotsEmpty;
    	_free_magazine_slots = _emptySlots select 4;
    	_tradeCounter = 0;
    
    	if(_free_magazine_slots < 1) exitWith {
    		cutText [(localize "STR_DAYZ_CODE_2"), "PLAIN DOWN"];
    		DZE_ActionInProgress = false;
    	};
    
    	_playerCash = player getVariable ["cashMoney",0];
    	_total_trades = floor(_playerCash / _price);
    
    	if (_total_trades < 1) exitWith {
    		_needed =  _price - _playerCash;
    		cutText [format[(localize "str_epoch_player_184"),_needed,CurrencyName] , "PLAIN DOWN"];
    		call _finish_trade;
    	};
    
    	if (_total_trades > _free_magazine_slots) then {
    		_total_trades = _free_magazine_slots;
    	};
    
    	_abort = false;
    
    	for "_x" from 1 to _total_trades do {
    
    		_tradeCounter = _tradeCounter + 1;
    
    		if(_total_trades == 1) then { 
    			cutText [(localize "STR_EPOCH_PLAYER_105"), "PLAIN DOWN"];
    		} else {
    			cutText [format[(localize "STR_EPOCH_PLAYER_187"),_tradeCounter,_total_trades], "PLAIN DOWN"];
    		};
    
    		player playActionNow "Medic";
    
    		r_interrupt = false;
    		_animState = animationState player;
    		r_doLoop = true;
    		_started = false;
    		_finished = false;
    
    		while {r_doLoop} do {
    			_animState = animationState player;
    			_isMedic = ["medic",_animState] call fnc_inString;
    			if (_isMedic) then {
    				_started = true;
    			};
    			if (_started and !_isMedic) then {
    				r_doLoop = false;
    				_finished = true;
    			};
    			if (r_interrupt) then {
    				r_doLoop = false;
    			};
    			sleep 0.1;
    		};
    
    		r_doLoop = false;
    
    		if (!_finished) exitWith {
    			r_interrupt = false;
    			if (vehicle player == player) then {
    				[objNull, player, rSwitchMove,""] call RE;
    				player playActionNow "stop";
    			};
    			cutText [(localize "str_epoch_player_106") , "PLAIN DOWN"];
    		};
    
    		if (_finished) then {
    			if (_playerCash >= _price) then {
    				_playerCash = player getVariable ["cashMoney",0];
    				player setVariable["cashMoney",(_playerCash - _price),true];
    				player addMagazine _name;
    				_abort = false;
    				cutText [format["Traded %1 %2 for %3",_price,CurrencyName,_textPart], "PLAIN DOWN"];
    				PVDZE_plr_Save = [player,(magazines player),true,true] ;
    				publicVariableServer "PVDZE_plr_Save";
    				if (isNil "_name") then { _name = "Unknown Item"; };
    				if (isNil "inTraderCity") then {
    					inTraderCity = "Unknown Trader"; 
    				} else {
    					if (inTraderCity == "Any") then {
    						inTraderCity = "Unknown Trader"; 
    					};
    				};
    				PVDZE_obj_Trade = [_activatingPlayer,_traderID,0,_name,inTraderCity,CurrencyName,_price];
    				publicVariableServer "PVDZE_obj_Trade";
    			} else {
    				_needed =  _price - _playerCash;
    				cutText [format[(localize "str_epoch_player_184"),_needed,CurrencyName] , "PLAIN DOWN"];
    				_abort = true;
    			};
    		};
    		sleep 1;
    		if(_abort) exitWith {};
    	};
    
    	DZE_ActionInProgress = false;
    
    } else {
    
    	_finish_trade = {
    		{player removeAction _x} forEach s_player_parts;s_player_parts = [];
    		s_player_parts_crtl = -1;
    		DZE_ActionInProgress = false;
    		dayzTradeResult = nil;
    	};
    
    	_name = (_this select 3) select 1;
    	_textPart = (_this select 3) select 5;
    	_price = (_this select 3) select 2;
    	_traderID = (_this select 3) select 7;
    
    	_qty = {_x == _name} count magazines player;
    
    	_removed = 0;
    	_tradeCounter = 0;
    
    	_total_trades = _qty;
    	if (_total_trades < 1) exitWith {
    		cutText [format["You do not have a %1", _textPart], "PLAIN DOWN"];
    		call _finish_trade;
    	};
    
    	_abort = false;
    
    	for "_x" from 1 to _total_trades do {
    		_tradeCounter = _tradeCounter + 1;
    
    		if(_total_trades == 1) then { 
    			cutText [(localize "STR_EPOCH_PLAYER_105"), "PLAIN DOWN"];
    		} else {
    			cutText [format[(localize "STR_EPOCH_PLAYER_187"),_tradeCounter,_total_trades], "PLAIN DOWN"];
    		};
    
    		player playActionNow "Medic";
    
    		r_interrupt = false;
    		_animState = animationState player;
    		r_doLoop = true;
    		_started = false;
    		_finished = false;
    
    		while {r_doLoop} do {
    			_animState = animationState player;
    			_isMedic = ["medic",_animState] call fnc_inString;
    			if (_isMedic) then {
    				_started = true;
    			};
    			if (_started and !_isMedic) then {
    				r_doLoop = false;
    				_finished = true;
    			};
    			if (r_interrupt) then {
    				r_doLoop = false;
    			};
    			sleep 0.1;
    		};
    		r_doLoop = false;
    
    		if (!_finished) exitWith { 
    			r_interrupt = false;
    			if (vehicle player == player) then {
    				[objNull, player, rSwitchMove,""] call RE;
    				player playActionNow "stop";
    			};
    			cutText [(localize "str_epoch_player_106") , "PLAIN DOWN"];
    		};
    
    		if (_finished) then {
    		
    			_removed = ([player,_name,1] call BIS_fnc_invRemove);
    			if (_removed > 0) then {
    				_playerCash = player getVariable ["cashMoney",0];	
    				player setVariable["cashMoney",(_playerCash + _price),true];
    				cutText [format[("Traded %1 for %2 %3"),_textPart,_price,CurrencyName], "PLAIN DOWN"];
    				PVDZE_plr_Save = [player,(magazines player),true,true] ;
    				publicVariableServer "PVDZE_plr_Save";
    				if (isNil "_name") then { _name = "Unknown Item"; };
    				if (isNil "inTraderCity") then {
    					inTraderCity = "Unknown Trader City"; 
    				} else {
    					if (inTraderCity == "Any") then {
    						inTraderCity = "Unknown Trader"; 
    					};
    				};
    				PVDZE_obj_Trade = [_activatingPlayer,_traderID,1,_name,inTraderCity,CurrencyName,_price];
    				publicVariableServer "PVDZE_obj_Trade";
    			} else {
    				cutText [format["Something went wrong. Could not remove %1 from inventory", _name], "PLAIN DOWN"];
    				_abort = true;
    			};
    		};
    		sleep 1;
    		if(_abort) exitWith {};
    	};
    	DZE_ActionInProgress = false;
    };
    
    DZE_ActionInProgress = false;
    
    };

     

     

  2. Hello Juan 

    just for the trial I put the pipebomb without new category in the heroammunition. The problem was the same. Can't sell it from inventory but from backpack ok. The buying is not a problem. Can it come from the fact that the pipebomb is a 2 slots inventory item ?

  3. Plop all !

    new problem .... 

    i want to add the pipebomb to the hero and the bandit traders. Therefore I made a new category banditexplosives.hpp and heroexplosives.sqf

    new number of the category is new and fine  

    I include the new category to the traders

    basically I can see the category in game. I can buy the items via trader or advanced trading. But I can't sell the pipebomb and only this one, from the inventory. I can sell them from the backpack tho... 

    someone can help ?

    i use epoch 1051 and the coins system and advanced trading from @Zupa, who else ?! ;)

    thanks folks

     

  4. Hello all !!!
    I have serious issues with WAI Mission
    I followed the steps from here : https://github.com/f3cuk/WICKED-AI

    and took the files from there as well, but it looks like its a serious fiesta in my RPT because of those lines :

     

    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and Single"
    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and Burst"
    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and FullAuto" 

    I have like 10000 lines from that everytime AI spawn on the map. I suspect the function.sqf where you can find that :

     
     
    if (count _ammoArray > 0) then {
    _result = _ammoArray select 0;
    call {
    if(_result == "20Rnd_556x45_Stanag") exitWith { _result = "30Rnd_556x45_Stanag"; };
    if(_result == "30Rnd_556x45_G36") exitWith { _result = "30Rnd_556x45_Stanag"; };
    if(_result == "30Rnd_556x45_G36SD") exitWith { _result = "30Rnd_556x45_StanagSD"; };
    };
    };
    
    _result

    Can someone help me to fix that ? Any idea ?

    EDIT : Epoch 1.0.5.1 here

  5. Hello all !!!
    I have serious issues with WAI Mission
    I followed the steps from here : https://github.com/f3cuk/WICKED-AI

    and took the files from there as well, but it looks like its a serious fiesta in my RPT because of those lines :

     

    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and Single"
    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and Burst"
    "Duplicate magazine 30Rnd_556x45_Stanag detected (id 2:885) in slots Single and FullAuto" 

    I have like 10000 lines from that everytime AI spawn on the map. I suspect the function.sqf where you can find that :

     
     
    if (count _ammoArray > 0) then {
    _result = _ammoArray select 0;
    call {
    if(_result == "20Rnd_556x45_Stanag") exitWith { _result = "30Rnd_556x45_Stanag"; };
    if(_result == "30Rnd_556x45_G36") exitWith { _result = "30Rnd_556x45_Stanag"; };
    if(_result == "30Rnd_556x45_G36SD") exitWith { _result = "30Rnd_556x45_StanagSD"; };
    };
    };
    
    _result

    Can someone help me to fix that ? Any idea ?

  6. I can try to yes, but as I said i'm very bad with code... all I do is patchwork I would say :/

    If I use what you gave me, how do I match this with the current menu I have (hpp and favorites) ?

    I actually don't even know where he looks for the recipes in this ini....

  7. Hello Juan !
    Thanks for your answer. Unfortunately I'm very bad in coding stuff myself :/. I have to look on your tutorial explaining the base of scripting
    I already have the Deploy anything script.
    In addition to that I just wanted this Craft Menu to work  to save time when assembling all the materials to create something. Skip the animation thing + having the recipe in front of the player to see what's missing. Once build it goes directly in inventory of backpack or vehicle. Its very handy.
    Even tho your workshop looks cool and I will try it out, I'd like this menu to work properly.
    The script somehow don't care if I have the tools or not, can you help me to find the mistake in the code ?
    Also, do you know from where it get's the recipes ? And if we can add or change them ? Dayz_server I assume but not sure
    Thanks
     

  8. Ok I got my thing to work finally.
    No buildable folder needed, and my crafting\init :

     

    Spoiler
    
    Crafting_Items = [];
    _magTypes = ["PartGeneric","PartWoodPile","ItemSandbag","ItemPlotDeed","ItemDocumentRamp","ItemWoodFloorHalf","ItemWoodFloorQuarter","ItemWoodStairs","ItemWoodWall","ItemWoodWallThird","ItemWoodWallDoor","ItemWoodWallWithDoor","ItemWoodWallGarageDoor","ItemWoodWallLg","ItemWoodWallDoorLg","ItemWoodWallWithDoorLg","ItemCanvas","ItemBurlap","ItemLightBulb","ItemCorrugated","ItemPole","ItemFuelBarrelEmpty","metal_panel_kit","desert_net_kit","forest_net_kit","PartPlankPack","CinderBlocks","PartPlywoodPack","PartWoodLumber","PartWoodPlywood","ItemTentOld","ItemTentDomed","ItemTentDomed2","BagFenceRound_DZ_kit","ItemSandbagLarge","ItemSandbagExLarge"];
    
    _actions = ["Crafting"];
    for "_i" from 1 to 7 do { _actions set [count _actions, "Crafting" + str _i]; };
    
        fnc_getName = {
            if (typeName _this == "OBJECT") then { _this = typeOf _this; };
    
            {
                if (isClass (configFile >> _x >> _this)) exitWith { getText (configFile >> _x >> _this >> "displayName") };
                _this
            } forEach ["CfgVehicles","CfgWeapons","CfgMagazines"];
        };
    
    {
        _magCfg = configFile >> "CfgMagazines" >> _x;
        _actionsCfg = _magCfg >> "ItemActions";
    
        for "_i" from 0 to count _actionsCfg - 1 do {
            _actionCfg = _actionsCfg select _i;
            _actionName = configName _actionCfg;
    
            if (isClass _actionCfg && {_actionName in _actions}) then {
                _text = format ["%1 (%2)", _x call fnc_getName, getText (_actionCfg >> "text")];
                Crafting_Items set [count Crafting_Items, [_x, _text, _actionName]];
            };
        };
    
    } count _magTypes;
    
    Crafting_Load = {
        _dialog = _this select 0;
        _listbox = _dialog displayCtrl 1500;
    
        call Crafting_ListboxLoad;
    
        for "_i" from 1 to 10 do { (_dialog displayCtrl 2100) lbAdd str _i; };
        (_dialog displayCtrl 2100) lbSetCurSel 0;
    
        (_dialog displayCtrl 1600) ctrlEnable false;
    };
    
    Crafting_Unload = {
        saveProfileNamespace;
    };
    
    Crafting_LBDblClick = {
        _listbox = _this select 0;
        _index = _this select 1;
    
        _data = call compile (_listbox lbData _index);
        _type = (_data select 0) + "/" + (_data select 2);
        _favourites = profileNamespace getVariable ["CraftingFavourites", []];
    
        if (_data call Crafting_isFavourite) then {
            _listbox lbSetPicture [_index, "custom\crafting\favourite_none.paa"];
            _favourites = _favourites - [_type];
        } else {
            _listbox lbSetPicture [_index, "custom\crafting\favourite.paa"];
            _favourites = _favourites + [_type];
        };
    
        profileNamespace setVariable ["CraftingFavourites", _favourites];
    
        call Crafting_ListboxLoad;
    };
    
    Crafting_LBSelChanged = {
        _listbox = _this select 0;
        _index = _this select 1;
    
        _data = call compile (_listbox lbData _index);
        _type = _data select 0;
        _text = _data select 1;
        _action = _data select 2;
    
        _config = configFile >> "CfgMagazines" >> _type >> "ItemActions" >> _action;
        
        _config2 = configFile >> "CfgMagazines" >> _type >> "ItemActions" >> _action;
        _arrayToText = {
            private ["_output","_type","_quantity"];
            _output = "";
            {
                if (typeName _x == "ARRAY") then {
                    _output = _output + format ["%1 x %2<br/>", _x select 1, (_x select 0) call fnc_getName];
                } else {
                    _output = _output + format ["%1<br/>", _x call fnc_getName];
                };
            } count _this;
            _output
        };
    
        _formatTitle = { parseText format ["<t align='left' size='0.7' color='#00FF40'>%1</t><br/>", _this] };
        _formatText = { parseText format ["<t align='left'>%1</t><br/>", _this] };
    
        /*_needNear = getArray (_config >> "neednearby") - ["sand","sawmill"];*/
        
        _needNear =     getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> _action >> "neednearby") - ["sand","sawmill"];
    
        _text = composeText [
            if (count _needNear > 0) then { "REQUIRED NEARBY:" call _formatTitle } else { parseText "" },
            if (count _needNear > 0) then { (_needNear call _arrayToText) call _formatText } else { parseText "" },
            "REQUIRED TOOLS:" call _formatTitle,
            (getArray (_config >> "requiretools") call _arrayToText) call _formatText,
            "ITEMS INPUT:" call _formatTitle,
            (getArray (_config >> "input") call _arrayToText) call _formatText,
            "ITEMS OUTPUT:" call _formatTitle,
            (getArray (_config >> "output") call _arrayToText) call _formatText
        ];
    
        ((ctrlParent _listbox) displayCtrl 1100) ctrlSetStructuredText _text;
    };
    
    Crafting_ButtonClick = {
        _button = _this select 0;
        _dialog = ctrlParent _button;
        _buttons = [_dialog displayCtrl 1600, _dialog displayCtrl 1601, _dialog displayCtrl 1602];
    
        if (_button in _buttons) exitWith {
            { _x ctrlEnable (_x != _button); } count _buttons;
        };
    
        _listbox = _dialog displayCtrl 1500;
        _index = lbCurSel _listbox;
    
        if (_index < 0) exitWith { systemChat "<Crafting> Select an item to craft."; };
    
        _data = call compile (_listbox lbData _index);
        _config = configFile >> "CfgMagazines" >> _data select 0 >> "ItemActions" >> _data select 2;
    
        _requiredNear = getArray (_config >> "neednearby") - ["sand","sawmill"];
        _requiredTools = getArray (_config >> "requiretools");
        _itemsIn = getArray (_config >> "input");
        _itemsOut = getArray (_config >> "output");
    
        _amount = lbCurSel (_dialog displayCtrl 2100) + 1;
    
        // Inventory
        if (!ctrlEnabled (_buttons select 0)) exitWith {
            _crafted = 0;
    
            for "_i" from 1 to _amount do {
                _mags = magazines player;
    
                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _count = { _x == _item } count _mags;
                    _count >= _quantity
                } count _itemsIn;
    
                if (_gotRequired < count _itemsIn) exitWith {};
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    for "_x" from 1 to _quantity do {
                        player removeMagazine _item;
                    };
                } count _itemsIn;
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    for "_x" from 1 to _quantity do {
                        player addMagazine _item;
                    };
                } count _itemsOut;
    
                _crafted = _crafted + 1;
            };
    
            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in Inventory.", _crafted, (_itemsOut select 0 select 0) call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };
    
        // Backpack
        if (!ctrlEnabled (_buttons select 1)) exitWith {
            _backpack = unitBackpack player;
            if (isNull _backpack) exitWith { systemChat "<Crafting> You are not wearing a backpack."; };
    
            _crafted = 0;
    
            for "_i" from 1 to _amount do {
                _mags = getMagazineCargo _backpack;
    
                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _index = (_mags select 0) find _item;
                    _count = if (_index < 0) then { 0 } else { (_mags select 1) select _index };
                    _count >= _quantity
                } count _itemsIn;
    
                if (_gotRequired < count _itemsIn) exitWith {};
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    ["Magazine", _backpack, _item, _quantity] call fnc_removeCargoGlobal;
                } count _itemsIn;
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _backpack addMagazineCargoGlobal [_item, _quantity];
                } count _itemsOut;
    
                _crafted = _crafted + 1;
            };
    
            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in %3.", _crafted, (_itemsOut select 0 select 0) call fnc_getName, _backpack call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };
    
        // Vehicle
        if (!ctrlEnabled (_buttons select 2)) exitWith {
            _vehicle = vehicle player;
            if (_vehicle == player || {driver _vehicle != player}) exitWith { systemChat "<Crafting> You must be in the driver's seat of a vehicle."; };
    
            _crafted = 0;
    
            for "_i" from 1 to _amount do {
                _mags = getMagazineCargo _vehicle;
    
                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _index = (_mags select 0) find _item;
                    _count = if (_index < 0) then { 0 } else { (_mags select 1) select _index };
                    _count >= _quantity
                } count _itemsIn;
    
                if (_gotRequired < count _itemsIn) exitWith {};
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    ["Magazine", _vehicle, _item, _quantity] call fnc_removeCargoGlobal;
                } count _itemsIn;
    
                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _vehicle addMagazineCargoGlobal [_item, _quantity];
                } count _itemsOut;
    
                _crafted = _crafted + 1;
            };
    
            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in %3.", _crafted, (_itemsOut select 0 select 0) call fnc_getName, _vehicle call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };
    };
    
    Crafting_ListboxLoad = {
        lbClear _listbox;
    
        {
            _index = _listbox lbAdd (_x select 1);
            _listbox lbSetPicture [_index, "custom\crafting\favourite" + (["_none",""] select (_x call Crafting_isFavourite)) + ".paa"];
            _listbox lbSetData [_index, str _x];
        } count Crafting_Items;
    
        lbSort _listbox;
    
        for "_i" from 0 to lbSize _listbox - 1 do {
            _listbox lbSetValue [_i, if ((call compile (_listbox lbData _i)) call Crafting_isFavourite) then { _i - 100 } else { _i }];
        };
    
        lbSortByValue _listbox;
    };
    
    Crafting_isFavourite = {
        private ["_favourites","_type","_action"];
        _favourites = profileNamespace getVariable ["CraftingFavourites", []];
        _type = _this select 0;
        _action = _this select 2;
        (_type + "/" + _action) in _favourites
    };
    

     

    The problem of the correct Tools remain.

    Someone to tell me where is the problem ? I can still craft items without any tools if I want...

    Thanks

  9. Found this piece of code :

     

    	fnc_getName = {
    		if (typeName _this == "OBJECT") then { _this = typeOf _this; };
    
    		{
    			if (isClass (configFile >> _x >> _this)) exitWith { getText (configFile >> _x >> _this >> "displayName") };
    			_this
    		} forEach ["CfgVehicles","CfgWeapons","CfgMagazines"];
    	};

    Where is it going ? ^^

  10. Figure out a few things...

    The buildable folder is actually not necessary as it is mixing the stuff together.
    I think the code in the init is ok but for some reason it wont show up the name from the items...

    Can someone tell me if it's coming from the crafting\init and where ?

     

    Spoiler

    Crafting_Items = [];
    _magTypes = ["PartGeneric","PartWoodPile","ItemSandbag","ItemPlotDeed","ItemDocumentRamp","ItemWoodFloorHalf","ItemWoodFloorQuarter","ItemWoodStairs","ItemWoodWall","ItemWoodWallThird","ItemWoodWallDoor","ItemWoodWallWithDoor","ItemWoodWallGarageDoor","ItemWoodWallLg","ItemWoodWallDoorLg","ItemWoodWallWithDoorLg","ItemCanvas","ItemBurlap","ItemLightBulb","ItemCorrugated","ItemPole","ItemFuelBarrelEmpty","metal_panel_kit","desert_net_kit","forest_net_kit","PartPlankPack","CinderBlocks","PartPlywoodPack","PartWoodLumber","PartWoodPlywood","ItemTentOld","ItemTentDomed","ItemTentDomed2","BagFenceRound_DZ_kit","ItemSandbagLarge","ItemSandbagExLarge"];

    _actions = ["Crafting"];
    for "_i" from 1 to 7 do { _actions set [count _actions, "Crafting" + str _i]; };

    {
        _magCfg = configFile >> "CfgMagazines" >> _x;
        _actionsCfg = _magCfg >> "ItemActions";

        for "_i" from 0 to count _actionsCfg - 1 do {
            _actionCfg = _actionsCfg select _i;
            _actionName = configName _actionCfg;

            if (isClass _actionCfg && {_actionName in _actions}) then {
                _text = format ["%1 (%2)", _x call fnc_getName, getText (_actionCfg >> "text")];
                Crafting_Items set [count Crafting_Items, [_x, _text, _actionName]];
            };
        };

    } count _magTypes;

    Crafting_Load = {
        _dialog = _this select 0;
        _listbox = _dialog displayCtrl 1500;

        call Crafting_ListboxLoad;

        for "_i" from 1 to 10 do { (_dialog displayCtrl 2100) lbAdd str _i; };
        (_dialog displayCtrl 2100) lbSetCurSel 0;

        (_dialog displayCtrl 1600) ctrlEnable false;
    };

    Crafting_Unload = {
        saveProfileNamespace;
    };

    Crafting_LBDblClick = {
        _listbox = _this select 0;
        _index = _this select 1;

        _data = call compile (_listbox lbData _index);
        _type = (_data select 0) + "/" + (_data select 2);
        _favourites = profileNamespace getVariable ["CraftingFavourites", []];

        if (_data call Crafting_isFavourite) then {
            _listbox lbSetPicture [_index, "custom\crafting\favourite_none.paa"];
            _favourites = _favourites - [_type];
        } else {
            _listbox lbSetPicture [_index, "custom\crafting\favourite.paa"];
            _favourites = _favourites + [_type];
        };

        profileNamespace setVariable ["CraftingFavourites", _favourites];

        call Crafting_ListboxLoad;
    };

    Crafting_LBSelChanged = {
        _listbox = _this select 0;
        _index = _this select 1;

        _data = call compile (_listbox lbData _index);
        _type = _data select 0;
        _text = _data select 1;
        _action = _data select 2;

        _config = configFile >> "CfgMagazines" >> _type >> "ItemActions" >> _action;
        
        _config2 = configFile >> "CfgMagazines" >> _type >> "ItemActions" >> _action;
        _arrayToText = {
            private ["_output","_type","_quantity"];
            _output = "";
            {
                if (typeName _x == "ARRAY") then {
                    _output = _output + format ["%1 x %2<br/>", _x select 1, (_x select 0) call fnc_getName];
                } else {
                    _output = _output + format ["%1<br/>", _x call fnc_getName];
                };
            } count _this;
            _output
        };

        _formatTitle = { parseText format ["<t align='left' size='0.7' color='#00FF40'>%1</t><br/>", _this] };
        _formatText = { parseText format ["<t align='left'>%1</t><br/>", _this] };

        /*_needNear = getArray (_config >> "neednearby") - ["sand","sawmill"];*/
        
        _needNear =     getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> _action >> "neednearby") - ["sand","sawmill"];

        _text = composeText [
            if (count _needNear > 0) then { "REQUIRED NEARBY:" call _formatTitle } else { parseText "" },
            if (count _needNear > 0) then { (_needNear call _arrayToText) call _formatText } else { parseText "" },
            "REQUIRED TOOLS:" call _formatTitle,
            (getArray (_config >> "requiretools") call _arrayToText) call _formatText,
            "ITEMS INPUT:" call _formatTitle,
            (getArray (_config >> "input") call _arrayToText) call _formatText,
            "ITEMS OUTPUT:" call _formatTitle,
            (getArray (_config >> "output") call _arrayToText) call _formatText
        ];

        ((ctrlParent _listbox) displayCtrl 1100) ctrlSetStructuredText _text;
    };

    Crafting_ButtonClick = {
        _button = _this select 0;
        _dialog = ctrlParent _button;
        _buttons = [_dialog displayCtrl 1600, _dialog displayCtrl 1601, _dialog displayCtrl 1602];

        if (_button in _buttons) exitWith {
            { _x ctrlEnable (_x != _button); } count _buttons;
        };

        _listbox = _dialog displayCtrl 1500;
        _index = lbCurSel _listbox;

        if (_index < 0) exitWith { systemChat "<Crafting> Select an item to craft."; };

        _data = call compile (_listbox lbData _index);
        _config = configFile >> "CfgMagazines" >> _data select 0 >> "ItemActions" >> _data select 2;

        _requiredNear = getArray (_config >> "neednearby") - ["sand","sawmill"];
        _requiredTools = getArray (_config >> "requiretools");
        _itemsIn = getArray (_config >> "input");
        _itemsOut = getArray (_config >> "output");

        _amount = lbCurSel (_dialog displayCtrl 2100) + 1;

        // Inventory
        if (!ctrlEnabled (_buttons select 0)) exitWith {
            _crafted = 0;

            for "_i" from 1 to _amount do {
                _mags = magazines player;

                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _count = { _x == _item } count _mags;
                    _count >= _quantity
                } count _itemsIn;

                if (_gotRequired < count _itemsIn) exitWith {};

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    for "_x" from 1 to _quantity do {
                        player removeMagazine _item;
                    };
                } count _itemsIn;

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    for "_x" from 1 to _quantity do {
                        player addMagazine _item;
                    };
                } count _itemsOut;

                _crafted = _crafted + 1;
            };

            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in Inventory.", _crafted, (_itemsOut select 0 select 0) call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };

        // Backpack
        if (!ctrlEnabled (_buttons select 1)) exitWith {
            _backpack = unitBackpack player;
            if (isNull _backpack) exitWith { systemChat "<Crafting> You are not wearing a backpack."; };

            _crafted = 0;

            for "_i" from 1 to _amount do {
                _mags = getMagazineCargo _backpack;

                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _index = (_mags select 0) find _item;
                    _count = if (_index < 0) then { 0 } else { (_mags select 1) select _index };
                    _count >= _quantity
                } count _itemsIn;

                if (_gotRequired < count _itemsIn) exitWith {};

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    ["Magazine", _backpack, _item, _quantity] call fnc_removeCargoGlobal;
                } count _itemsIn;

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _backpack addMagazineCargoGlobal [_item, _quantity];
                } count _itemsOut;

                _crafted = _crafted + 1;
            };

            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in %3.", _crafted, (_itemsOut select 0 select 0) call fnc_getName, _backpack call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };

        // Vehicle
        if (!ctrlEnabled (_buttons select 2)) exitWith {
            _vehicle = vehicle player;
            if (_vehicle == player || {driver _vehicle != player}) exitWith { systemChat "<Crafting> You must be in the driver's seat of a vehicle."; };

            _crafted = 0;

            for "_i" from 1 to _amount do {
                _mags = getMagazineCargo _vehicle;

                _gotRequired = {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _index = (_mags select 0) find _item;
                    _count = if (_index < 0) then { 0 } else { (_mags select 1) select _index };
                    _count >= _quantity
                } count _itemsIn;

                if (_gotRequired < count _itemsIn) exitWith {};

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    ["Magazine", _vehicle, _item, _quantity] call fnc_removeCargoGlobal;
                } count _itemsIn;

                {
                    _item = _x select 0;
                    _quantity = _x select 1;
                    _vehicle addMagazineCargoGlobal [_item, _quantity];
                } count _itemsOut;

                _crafted = _crafted + 1;
            };

            if (_crafted > 0) then {
                systemChat format ["<Crafting> Crafted %1 x %2 in %3.", _crafted, (_itemsOut select 0 select 0) call fnc_getName, _vehicle call fnc_getName];
            } else {
                systemChat "<Crafting> Insufficient items.";
            };
        };
    };

    Crafting_ListboxLoad = {
        lbClear _listbox;

        {
            _index = _listbox lbAdd (_x select 1);
            _listbox lbSetPicture [_index, "custom\crafting\favourite" + (["_none",""] select (_x call Crafting_isFavourite)) + ".paa"];
            _listbox lbSetData [_index, str _x];
        } count Crafting_Items;

        lbSort _listbox;

        for "_i" from 0 to lbSize _listbox - 1 do {
            _listbox lbSetValue [_i, if ((call compile (_listbox lbData _i)) call Crafting_isFavourite) then { _i - 100 } else { _i }];
        };

        lbSortByValue _listbox;
    };

    Crafting_isFavourite = {
        private ["_favourites","_type","_action"];
        _favourites = profileNamespace getVariable ["CraftingFavourites", []];
        _type = _this select 0;
        _action = _this select 2;
        (_type + "/" + _action) in _favourites
    };

     

     

  11. Hello everyone !

    I'm seeking for help for a strange problem I have with a Fast Craft Script. Basically it's a script that allows player to craft epoch stuff via GUI.
    It looks like this :

    fastcraft.jpg

    The problem as you can see is that it doesn't show the Items Name, same for the tools needed...
    I followed a (very) old tutorial which is here :

    It looks different I know, but the files are not available anymore on the link provided so I had to find some other files online.

    The craft itself is actually working (without checking for the right tools apparently, even if you don't have the tool required the craft works) but appart from the name and tool everything is OK.

    All my folders regarding this script look like this :

    fastcraft2.jpg

    My Init is looking like that :
     

    //Load in compiled functions
    call compile preprocessFileLineNumbers "custom\Buildables\variables.sqf";
    
    progressLoadingScreen 0.4;
    call compile preprocessFileLineNumbers "custom\Buildables\Crafting_Compiles.sqf";
    
    if (!isDedicated) then {
    call compile preprocessFileLineNumbers "custom\crafting\Init.sqf";



    My Description :
     

    #include "custom\crafting\dialog.hpp"



    My Space_interrupt :
     

    if (_dikCode == 0x24) then {
        ExecVM "custom\crafting\start.sqf";
        _handled = true;
    };
    
    if (_dikCode == 0x02) then {
    AAC_1 = true;
    };
    if (_dikCode == 0x04) then {
    AAC_3 = true;
    };


    Compiles :

     

        player_removeObject =            compile preprocessFileLineNumbers "custom\Buildables\interior\remove.sqf";


    That's it, I forgot something, can someone help me with this ? If you need any other file or stuff tell me, anything that can help I take it !

    Thanks in advance

    The files are here : http://www.filedropper.com/fastcraft

  12. It was a problem since the beginning actually ...
    Everyone including players/admin can see the vehicles

    Problem is that i'm running a server with epoch origins and overwatch all at the same time, so it's difficult to find the problem

  13. I will try that out and I let you know thanks. Yes all the players can see the vehicles unfortunately...

     

    EDIT : I tried and I have less vehicle on the map but still some appear. I have something called DZEdebug = false. You are talking about a DZE_debug any difference ? The variable is in the .ini right ?

  14. Hello everyone,

    I'm posting today because I have a issue on my OverPochIns server.
    I'm running Epoch 1.0.5.1, Origins 1.7.9.5 and Overwatch 0.2.5 + Infistar v1411 and a few scripts.

    I have a problem at each restart of the server, every vehicle on the map appear for all players (see screenshot). I have no idea where it's coming from but it's very bad stuff...

    Can somebody help me with this ? Any idea from where it can come ?

    6w1ZmNJ.jpg


  15. Hey everyone,

    I'm working on a OverPochIns server with a lot of script and stuff. I took a few script from here and there and today I have to write on the forum because I'm really stuck on something.
    I upload the script it self may be easier for u guys.

    As you can see there is password in place for the stronghold where the houses, garage and pyramid don't. (player_build to get the random code and lockunlock to get the pass from db)
    I would like to put password on every each buildings and this is where I'm stuck, how should I manage that ?
    Can somebody help with this ?


    The original files are the one with the _save on it. The other one are the one I try things on.

    https://mega.nz/#!wAISGJRB!PpKWcktC6oya0ZLBlR5nvEdjrnAEtGJy9MtDNy7lga8

     

    I know from a other forum that I should change a lot of things in the files apparently but also in other files which are not included like the selfaction. I'm not really a coder but is it not possible to use the same way from the Stronghold for the houses ?

    Cheers

     

    Asso'

  16. Hey everyone,

    I'm working on a OverPochIns server with a lot of script and stuff. I took a few script from here and there and today I have to write on the forum because I'm really stuck on something.
    I upload the script it self may be easier for u guys.

    As you can see there is password in place for the stronghold where the houses, garage and pyramid don't. (player_build to get the random code and lockunlock to get the pass from db)
    I would like to put password on every each buildings and this is where I'm stuck, how should I manage that ?
    Can somebody help with this ?


    The original files are the one with the _save on it. The other one are the one I try things on.

    https://mega.nz/#!wAISGJRB!PpKWcktC6oya0ZLBlR5nvEdjrnAEtGJy9MtDNy7lga8

     

    I know from a other forum that I should change a lot of things in the files apparently but also in other files which are not included like the selfaction. I'm not really a coder but is it not possible to use the same way from the Stronghold for the houses ?

    Cheers

     

    Asso'

     

    EDIT : Sorry guys i'm in the wrong area, it's for the Arma2 scripting... Sorry about that. Can a Admin or modo delete ? Really sorry

×
×
  • Create New...