Havoc302 Posted August 21, 2014 Report Share Posted August 21, 2014 Does anyone know a way to get the maintain area script to use epoch_returnchange so you don't need exact money? Link to comment Share on other sites More sharing options...
0 deadeye Posted August 22, 2014 Report Share Posted August 22, 2014 This works for me (with limited testing): Create a file in your scripts folder called maintain_area.sqf with this code: //Code developed by Axe Cop - Massiv improvments && performance tunes by Skaronator - simplified by Deadeye private ["_textMissing","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_itemText","_option","_objects_filtered"]; if (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; }; DZE_ActionInProgress = true; player removeAction s_player_maintain_area; s_player_maintain_area = 1; player removeAction s_player_maintain_area_preview; s_player_maintain_area_preview = 1; _target = cursorTarget; // Plastic_Pole_EP1_DZ _objectClasses = DZE_maintainClasses; _range = DZE_maintainRange; // set the max range for the maintain area _objects = nearestObjects [_target, _objectClasses, _range]; //filter to only those that have 10% damage _objects_filtered = []; { if (damage _x >= DZE_DamageBeforeMaint) then { _objects_filtered set [count _objects_filtered, _x]; }; } count _objects; _objects = _objects_filtered; // TODO dynamic requirements based on used building parts? _count = count _objects; if (_count == 0) exitWith { cutText [format[(localize "STR_EPOCH_ACTIONS_22"), _count], "PLAIN DOWN"]; DZE_ActionInProgress = false; s_player_maintain_area = -1; s_player_maintain_area_preview = -1; }; _requirements = []; switch true do { case (_count <= 10): {_requirements = ["ItemGoldBar10oz",1]}; case (_count <= 20): {_requirements = ["ItemGoldBar10oz",2]}; case (_count <= 35): {_requirements = ["ItemGoldBar10oz",3]}; case (_count <= 50): {_requirements = ["ItemGoldBar10oz",4]}; case (_count <= 75): {_requirements = ["ItemGoldBar10oz",6]}; case (_count <= 100): {_requirements = ["ItemBriefcase100oz",1]}; case (_count <= 175): {_requirements = ["ItemBriefcase100oz",2]}; case (_count <= 250): {_requirements = ["ItemBriefcase100oz",3]}; case (_count <= 325): {_requirements = ["ItemBriefcase100oz",4]}; case (_count <= 400): {_requirements = ["ItemBriefcase100oz",5]}; case (_count <= 475): {_requirements = ["ItemBriefcase100oz",6]}; case (_count <= 550): {_requirements = ["ItemBriefcase100oz",7]}; case (_count <= 625): {_requirements = ["ItemBriefcase100oz",8]}; case (_count > 625): {_requirements = ["ItemBriefcase100oz",9]}; }; _option = _this select 3; switch _option do { case "maintain": { if !([[_requirements],0] call epoch_returnChange) then { _textMissing = getText(configFile >> "CfgMagazines" >> _requirements select 0 >> "displayName"); cutText [format[(localize "STR_EPOCH_ACTIONS_6"), _requirements select 1, _textMissing], "PLAIN DOWN"]; } else { player playActionNow "Medic"; [player,_range,true,(getPosATL player)] spawn player_alertZombies; cutText [format[(localize "STR_EPOCH_ACTIONS_4"), _count], "PLAIN DOWN", 5]; PVDZE_maintainArea = [player,1,_target]; publicVariableServer "PVDZE_maintainArea"; }; }; case "preview": { //_cost = ""; _itemText = getText(configFile >> "CfgMagazines" >> _requirements select 0 >> "displayName"); _cost = str(_requirements select 1) + " of " + _itemText; cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"]; }; }; DZE_ActionInProgress = false; s_player_maintain_area = -1; s_player_maintain_area_preview = -1;Then in your fn_selfActions.sqf: change s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];to s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "scripts\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "scripts\maintain_area.sqf", "preview", 5, false];If you put it somewhere other than your scripts folder, change it to match the location. Havoc302 1 Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 22, 2014 Author Report Share Posted August 22, 2014 This works for me (with limited testing): Create a file in your scripts folder called maintain_area.sqf with this code: //Code developed by Axe Cop - Massiv improvments && performance tunes by Skaronator - simplified by Deadeye private ["_textMissing","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_itemText","_option","_objects_filtered"]; if (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; }; DZE_ActionInProgress = true; player removeAction s_player_maintain_area; s_player_maintain_area = 1; player removeAction s_player_maintain_area_preview; s_player_maintain_area_preview = 1; _target = cursorTarget; // Plastic_Pole_EP1_DZ _objectClasses = DZE_maintainClasses; _range = DZE_maintainRange; // set the max range for the maintain area _objects = nearestObjects [_target, _objectClasses, _range]; //filter to only those that have 10% damage _objects_filtered = []; { if (damage _x >= DZE_DamageBeforeMaint) then { _objects_filtered set [count _objects_filtered, _x]; }; } count _objects; _objects = _objects_filtered; // TODO dynamic requirements based on used building parts? _count = count _objects; if (_count == 0) exitWith { cutText [format[(localize "STR_EPOCH_ACTIONS_22"), _count], "PLAIN DOWN"]; DZE_ActionInProgress = false; s_player_maintain_area = -1; s_player_maintain_area_preview = -1; }; _requirements = []; switch true do { case (_count <= 10): {_requirements = ["ItemGoldBar10oz",1]}; case (_count <= 20): {_requirements = ["ItemGoldBar10oz",2]}; case (_count <= 35): {_requirements = ["ItemGoldBar10oz",3]}; case (_count <= 50): {_requirements = ["ItemGoldBar10oz",4]}; case (_count <= 75): {_requirements = ["ItemGoldBar10oz",6]}; case (_count <= 100): {_requirements = ["ItemBriefcase100oz",1]}; case (_count <= 175): {_requirements = ["ItemBriefcase100oz",2]}; case (_count <= 250): {_requirements = ["ItemBriefcase100oz",3]}; case (_count <= 325): {_requirements = ["ItemBriefcase100oz",4]}; case (_count <= 400): {_requirements = ["ItemBriefcase100oz",5]}; case (_count <= 475): {_requirements = ["ItemBriefcase100oz",6]}; case (_count <= 550): {_requirements = ["ItemBriefcase100oz",7]}; case (_count <= 625): {_requirements = ["ItemBriefcase100oz",8]}; case (_count > 625): {_requirements = ["ItemBriefcase100oz",9]}; }; _option = _this select 3; switch _option do { case "maintain": { if !([[_requirements],0] call epoch_returnChange) then { _textMissing = getText(configFile >> "CfgMagazines" >> _requirements select 0 >> "displayName"); cutText [format[(localize "STR_EPOCH_ACTIONS_6"), _requirements select 1, _textMissing], "PLAIN DOWN"]; } else { player playActionNow "Medic"; [player,_range,true,(getPosATL player)] spawn player_alertZombies; cutText [format[(localize "STR_EPOCH_ACTIONS_4"), _count], "PLAIN DOWN", 5]; PVDZE_maintainArea = [player,1,_target]; publicVariableServer "PVDZE_maintainArea"; }; }; case "preview": { //_cost = ""; _itemText = getText(configFile >> "CfgMagazines" >> _requirements select 0 >> "displayName"); _cost = str(_requirements select 1) + " of " + _itemText; cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"]; }; }; DZE_ActionInProgress = false; s_player_maintain_area = -1; s_player_maintain_area_preview = -1; Then in your fn_selfActions.sqf: change s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false]; to s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "scripts\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "scripts\maintain_area.sqf", "preview", 5, false]; If you put it somewhere other than your scripts folder, change it to match the location. Awesome, thanks a bunch, I searched the forums but couldn't find anywhere that had this, I hope it becomes standard with the next version of Epoch. Link to comment Share on other sites More sharing options...
0 deadeye Posted August 22, 2014 Report Share Posted August 22, 2014 I hope it becomes standard with the next version of Epoch. I only briefly tested it. Let me know how it works for you and I'll make a pull request. Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 28, 2014 Author Report Share Posted August 28, 2014 Hmm, this doesn't appear to be working, just tested it and the maintain options just disappear and don't come back. Sadly there's nothing in the RPT to tell me why. Link to comment Share on other sites More sharing options...
0 deadeye Posted August 28, 2014 Report Share Posted August 28, 2014 Did you change the lines in your fn_selfActions to point to the correct location? Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 28, 2014 Author Report Share Posted August 28, 2014 You mean like this? s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "custom\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "custom\maintain_area.sqf", "preview", 5, false]; Link to comment Share on other sites More sharing options...
0 deadeye Posted August 28, 2014 Report Share Posted August 28, 2014 Yes, as long as maintain_area.sqf is in your custom folder. The section of your fn_selfActions.sqf should look like this: if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then { if (s_player_maintain_area < 0) then { s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "custom\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "custom\maintain_area.sqf", "preview", 5, false]; }; } else { player removeAction s_player_maintain_area; s_player_maintain_area = -1; player removeAction s_player_maintain_area_preview; s_player_maintain_area_preview = -1; }; Sorry, it has worked flawlessly for me. Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 29, 2014 Author Report Share Posted August 29, 2014 Yep that's what I have too. if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then { if (s_player_maintain_area < 0) then { s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "custom\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "custom\maintain_area.sqf", "preview", 5, false]; }; } else { player removeAction s_player_maintain_area; s_player_maintain_area = -1; player removeAction s_player_maintain_area_preview; s_player_maintain_area_preview = -1; }; I'll test it out on my test server again, see if I can get it working. Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 30, 2014 Author Report Share Posted August 30, 2014 Yep doesn't work for me, I do have Plot for Life as well but it doesn't interact with the maintain_area script so I have no idea why it's not working. Link to comment Share on other sites More sharing options...
0 deadeye Posted August 30, 2014 Report Share Posted August 30, 2014 Not directly but it includes its own copy of selfActions. Is that the one you modified? I know you mentioned you didn't see any errors in the RPT, is that in both server and client RPT files? Link to comment Share on other sites More sharing options...
0 Havoc302 Posted August 30, 2014 Author Report Share Posted August 30, 2014 I have a custom fn_selfActions which has about 4 mods merged into it, all other mods are working perfectly so I guess I've addressed the right one ;) Link to comment Share on other sites More sharing options...
Question
Havoc302
Does anyone know a way to get the maintain area script to use epoch_returnchange so you don't need exact money?
Link to comment
Share on other sites
11 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now