Axe Cop Posted December 6, 2013 Author Report Share Posted December 6, 2013 Hello Axe, Do you know if the maintain area works with the Y position. I mean the range by default is 50 meters arround the plot pole. But it's 50m in X position or both ? (X,Y) More players on my servers got a floor and ask me if they have to place a plot pole on the ground floor and on the floor. Just imagine a sphere with a 50m radius around the plot pole. (to bad you can't simply draw a sphere in DayZ, i would do that to visualize the area...) Anyway you don't need to download the script anymore as it is included in the current epoch version (as of 1.0.3). :) Link to comment Share on other sites More sharing options...
cen Posted December 6, 2013 Report Share Posted December 6, 2013 Congrats on getting this added to 1.0.3! I saw the code in there while updating my pbos :D Link to comment Share on other sites More sharing options...
SimonSaysRIP Posted February 8, 2014 Report Share Posted February 8, 2014 Hey guys, another script release from me. :P This time area based maintenance for player bases, you know it can be a pain to maintain every single building part in your base, fear no more with this "simple" script. ;) With the default options it works like this: players will get an option to "Maintain Area" if they look at a plot pole (item can be changed but plot poles make sense I guess), then the script will maintain all base building parts within a specified range (default 50m around the plot pole), the same way as you would maintain every single part by hand. Because of the amount of affected parts admins can define other requirements to actually maintain the whole area (like a briefcase for more then 100 building parts or whatever you like there is an example in the script with some requirements for different amounts of building parts). This is just my first release, I had other plans with making the maintain requirements based on the actual building parts in the area. e.g. every part gets a value (similar then it is now but with items you can stack easily like gold), so it would calculate the exact costs like 2 gold for each wooden wall, 5 gold for metal floors etc.. just an idea there might be other problems with that and it may not be easy to implement this with ArmA scripts as far as my knowledge goes at least. So for now the maintain cost is only dependent on the amount of items to maintain, no matter what parts you use. But there can be multiple items defined for each amount, maybe someone of you have a better way of doing this, that's one reason I publish it here for all to use and improve on it (hopefully). There is also a preview option ("Maintain Area Preview") to see how many building parts would be affected and what the exact costs for that would be. This option does nothing and it won't remove anything from your gear, it only displays an information text on the screen. If you use the real "Maintain Area" option the required items will be removed from your gear, if you don't own them you get a message with the missing parts like with the default maintain option. Ok here comes the installation steps, it is pretty easy, similar to including self bloodbag to your server. Step 1: Add this to your fn_selfActions.sqf file right after the line with "_canDo = ..." around line 16 (I assume you already have the file set up for other changes, if not there are many topics with how to do that): // ---------------------------------------Maintain Area Start------------------------------------ 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 ["<t color=""#ffffff"">Maintain Area</t>", "scripts\maintain_area.sqf", "maintain", 5, false]; s_player_maintain_area_preview = player addAction ["<t color=""#ccffffff"">Maintain Area Preview</t>", "scripts\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; }; // ---------------------------------------Maintain Area End------------------------------------ If you want change the item where your players can activate the "Maintain Area" option (default plot pole - "Plastic_Pole_EP1_DZ"). You can also change the color of the menu (default white - #ffffff) and the path where you want to safe the actual script (default "scripts\maintain_area.sqf" in your mission.pbo). Step 2: Here is the complete maintain area script: private ["_missing","_missingQty","_proceed","_itemIn","_countIn","_qty","_num_removed","_removed","_removed_total","_tobe_removed_total","_obj","_objectID","_objectUID","_classname","_location","_dir","_objectCharacterID","_object","_temp_removed_array","_textMissing","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_itemText","_option"]; if (TradeInprogress) exitWith { cutText ["Maintenance already in progress." , "PLAIN DOWN"]; }; TradeInprogress = 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 = ["ModularItems", "DZE_Housebase"]; _range = 50; // set the max range for the maintain area _objects = nearestObjects [_target, _objectClasses, _range]; // TODO dynamic requirements based on used building parts? _count = count _objects; _requirements = []; switch true do { case (_count <= 10): {_requirements = [["ItemGoldBar10oz",1]]}; case (_count <= 50): {_requirements = [["ItemGoldBar10oz",4],["ItemGoldBar",2]]}; // 42 gold case (_count <= 100): {_requirements = [["ItemBriefcase100oz",1]]}; case (_count <= 200): {_requirements = [["ItemBriefcase100oz",2]]}; case (_count <= 300): {_requirements = [["ItemBriefcase100oz",3]]}; case (_count <= 400): {_requirements = [["ItemBriefcase100oz",4]]}; case (_count > 400): {_requirements = [["ItemBriefcase100oz",5]]}; }; _option = _this select 3; switch _option do { case "maintain": { _missing = ""; _missingQty = 0; _proceed = true; { _itemIn = _x select 0; _countIn = _x select 1; _qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player; if (_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; }; } forEach _requirements; if (_proceed) then { player playActionNow "Medic"; [player,_range,true,(getPosATL player)] spawn player_alertZombies; _temp_removed_array = []; _removed_total = 0; _tobe_removed_total = 0; { _removed = 0; _itemIn = _x select 0; _countIn = _x select 1; _tobe_removed_total = _tobe_removed_total + _countIn; { if ((_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then { _num_removed = ([player,_x] call BIS_fnc_invRemove); _removed = _removed + _num_removed; _removed_total = _removed_total + _num_removed; if (_num_removed >= 1) then { _temp_removed_array set [count _temp_removed_array,_x]; }; }; } forEach magazines player; } forEach _requirements; // all required items removed from player gear if (_tobe_removed_total == _removed_total) then { { _obj = _x; // Find objectID _objectID = _obj getVariable ["ObjectID","0"]; // Find objectUID _objectUID = _obj getVariable ["ObjectUID","0"]; if (_objectID == "0" && _objectUID == "0") exitWith { cutText ["At least one building part is not setup yet.", "PLAIN DOWN"];}; // Get classname _classname = typeOf _obj; // Get position _location = _obj getVariable["OEMPos",(getposATL _obj)]; // Get direction _dir = getDir _obj; // Find CharacterID _objectCharacterID = _obj getVariable ["CharacterID","0"]; // Create new object _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; // Set direction _object setDir _dir; // Set location _object setPosATL _location; PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,_objectID,_objectUID]; publicVariableServer "PVDZE_obj_Swap"; player reveal _object; } forEach _objects; cutText [format["You have maintained %1 building parts.", _count], "PLAIN DOWN", 5]; // uncomment the next 2 lines if you want logging of area maintenance to the server report file (Arma2OAserver.RPT) //maintainArea_log = [player, _target, _count]; //publicVariableServer "maintainArea_log"; } else { {player addMagazine _x;} forEach _temp_removed_array; cutText [format["Missing Parts after first check Item: %1 / %2",_removed_total,_tobe_removed_total], "PLAIN DOWN"]; }; } else { _textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName"); cutText [format["Missing %1 more of %2", _missingQty, _textMissing], "PLAIN DOWN"]; }; }; case "preview": { _cost = ""; { _itemIn = _x select 0; _countIn = _x select 1; _itemText = getText(configFile >> "CfgMagazines" >> _itemIn >> "displayName"); if (_cost != "") then { _cost = _cost + " and "; }; _cost = _cost + (str(_countIn) + " of " + _itemText); } forEach _requirements; cutText [format["%1 building parts in range, maintenance would cost %2.", _count, _cost], "PLAIN DOWN"]; }; }; TradeInprogress = false; s_player_maintain_area = -1; s_player_maintain_area_preview = -1; Save it as "scripts\maintain_area.sqf" in your mission.pbo or whatever you have defined in the menu before. Step 3 (optional): change the default options in the script: _range (line 13): sets the maximum range for the maintain area around the plot pole (default 50m). _requirements (line 18+): defines the required items for the amount of affected base building parts, there are some examples just take a look it should be easy to extend/modify. Step 4 (optional): logging of area maintenance to the server report file (Arma2OAserver.RPT): Since the script runs on the client (player computer who starts the maintenance) it can be desirable to log additional info in the server report file to keep track what player did the maintenance at what time and position on the map and how many building parts were affected, to do this the script has to send that info to the server. This can be done with the "publicVariableServer" command, just uncomment (remove the leading //) the 2 lines in the script where it says so for logging (line 110+111). For the server to receive that variable and log the info you have to add an public variable event handler with "addPublicVariableEventHandler", this can be done at any place in the mission.pbo, but usually all event handlers are handled in the file "dayz_code\init\publicEH.sqf", copy that file to your mission.pbo and change the reference to it in the init.sqf if you haven't already and add the following to the "Server only" block (after the line with "PVDZE_plr_DeathB" is fine): "maintainArea_log" addPublicVariableEventHandler { _val = _this select 1; _player = _val select 0; _playerName = name _player; _playerID = getPlayerUID _player; _target = _val select 1; _position = position _target; _count = _val select 2; diag_log format["MAINTAIN_AREA: Player %1 (%2) has maintained %3 building parts at position %4", _playerName, _playerID, _count, _position]; }; This will log a line like this every time a player runs the maintenance script: 14:33:01 "MAINTAIN_AREA: Player Axe Cop (12345678) has maintained 245 building parts at position [4937,9421.44,-0.796936]" If you are lazy your can add the event handler to your init.sqf after the line "_serverMonitor = ... " without changing the file publicEH.sqf :P That's it, should be easy enough to get the script working on your server. ;) One major problem with the whole maintenance thing in Epoch (not this script) is the fact, that you can't visually see if your base needs to be maintained or when it was last maintained, I hope that will be fixed with the next Epoch updates because I don't see any way of even accessing the last maintain date form the script itself. What Epoch does is just set a small damage value to every part to indicate that it needs to be maintained soon, but you can't see that damage in game (yet). For now my script just maintains every single part within range, no matter when it was last maintained. I could change it so it only affects damaged parts like Epoch does when maintenance is needed (just to decrease the maintenance cost for players). Also keep in mind the maintain process replaces the objects rather then just removing the damage and resetting the date, don't ask me why but I guess there is a reason for it so I did it the same way in my script. At last sorry for the long text, as always if you have any questions or ideas to make this script better please tell me or improve the script. :) Edit: logging of area maintenance (see step 4) I've added this to my server correctly, but it's saying there are zero parts in range (I've changed the range to 200 and there are well over 100 parts in that range). Any ideas why? Link to comment Share on other sites More sharing options...
Axe Cop Posted February 8, 2014 Author Report Share Posted February 8, 2014 did you read the previous post or anything? why did you revive this thread dude... this mod is included in the default Epoch client since version 1.0.3, so you don't have to install it yourself anymore. :p anyway what you are describing is a feature and no bug, it only displays parts that need maintenance, not all in range! Link to comment Share on other sites More sharing options...
SimonSaysRIP Posted February 8, 2014 Report Share Posted February 8, 2014 did you read the previous post or anything? why did you revive this thread dude... this mod is included in the default Epoch client since version 1.0.3, so you don't have to install it yourself anymore. :P anyway what you are describing is a feature and no bug, it only displays parts that need maintenance, not all in range! Ahh, my mistake. Link to comment Share on other sites More sharing options...
Blackenfeld Posted March 5, 2014 Report Share Posted March 5, 2014 Hi Axe, how do you cancel the maintain area option if you don't want it on your server ? Thanks in advance Blackenfeld Link to comment Share on other sites More sharing options...
Axe Cop Posted March 5, 2014 Author Report Share Posted March 5, 2014 disable it in the fn_selfActions.sqf maybe? I don't think there is a config option for it. Link to comment Share on other sites More sharing options...
StiflersM0M Posted April 12, 2014 Report Share Posted April 12, 2014 Hey axe, is it normal the every buildable who are affected by the maintain script when you do a maintain get doubled ? if not, can you give me a hint why i get this bug ? i only use it to update the buildables, so that i can distinguish between active player bases and not active player bases. ps. after server restart the doubled items are despawned. if it do a matter, i use infistar AH. my fn_selfaction.sqf my init.sqf Link to comment Share on other sites More sharing options...
Friendly Posted April 18, 2014 Report Share Posted April 18, 2014 That happens to me aswell Stiflers please someone help us! Link to comment Share on other sites More sharing options...
Friendly Posted April 19, 2014 Report Share Posted April 19, 2014 Hey axe, is it normal the every buildable who are affected by the maintain script when you do a maintain get doubled ? if not, can you give me a hint why i get this bug ? i only use it to update the buildables, so that i can distinguish between active player bases and not active player bases. ps. after server restart the doubled items are despawned. if it do a matter, i use infistar AH. my fn_selfaction.sqf my init.sqf Go your your fn_selfaction.sqf and delete 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"], "\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]; }; } 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; }; Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted April 19, 2014 Report Share Posted April 19, 2014 This is built into Epoch now. There's no reason anyone should be putting this into their server now... Link to comment Share on other sites More sharing options...
Axe Cop Posted April 19, 2014 Author Report Share Posted April 19, 2014 yes I believe I've said that multiple times. Please stop reviving this thread unless you have some major question about the base script please. But the current version used in Epoch is a lot different from what I started with, keep that in mind. Link to comment Share on other sites More sharing options...
PPrimezz Posted April 20, 2014 Report Share Posted April 20, 2014 whenever someone maintains a base with this script on my server it doubles all doorsplease help BetterDeadThanZed 1 Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted April 20, 2014 Report Share Posted April 20, 2014 Pprimez, don't use this. It's integrated into Epoch now. Maybe the mods need to delete this thread so people stop trying to use it. Link to comment Share on other sites More sharing options...
jahangir13 Posted April 23, 2014 Report Share Posted April 23, 2014 @AxeCop : Could you not mention it in RED in the initial post that there is no need to implement this again ? First sentence would be helpful, I guess ;) Link to comment Share on other sites More sharing options...
Axe Cop Posted April 23, 2014 Author Report Share Posted April 23, 2014 maybe I should, I thought server admins would know that is already implemented in the default Epoch client, but nobody is reading anything and they don't see it ingame, I hope they will at least the first post :D Link to comment Share on other sites More sharing options...
ZarX Posted April 28, 2014 Report Share Posted April 28, 2014 Do know what the DZE codes are for it? Since its built in? Link to comment Share on other sites More sharing options...
kassquatch Posted April 28, 2014 Report Share Posted April 28, 2014 maybe I should, I thought server admins would know that is already implemented in the default Epoch client, but nobody is reading anything and they don't see it ingame, I hope they will at least the first post :D Sadly, a lot of people who try to run servers are kiddies who just wanna do things their way and don't know how to read. I've come to this conclusion because they ask questions first without looking for an answer. Link to comment Share on other sites More sharing options...
Axe Cop Posted April 28, 2014 Author Report Share Posted April 28, 2014 Do know what the DZE codes are for it? Since its built in? what codes do you mean? the class names of the affected items? you can see those in the script (which has a reference to variables.sqf I guess) :) Sadly, a lot of people who try to run servers are kiddies who just wanna do things their way and don't know how to read. I've come to this conclusion because they ask questions first without looking for an answer. you're right but that is not only a problems with kiddies I think :D Link to comment Share on other sites More sharing options...
fr1nk Posted April 28, 2014 Report Share Posted April 28, 2014 It's the internet. Nobody reads anything :lol: Link to comment Share on other sites More sharing options...
Axe Cop Posted April 28, 2014 Author Report Share Posted April 28, 2014 am I the only one who prefers short text descriptions to long video tutorials? :D in most cases i am no fan of youtube video where someone is just opening a notepad and writing note sin there-.. or clicking around for hours haha :D anyway back to topic? .p Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted April 28, 2014 Report Share Posted April 28, 2014 am I the only one who prefers short text descriptions to long video tutorials? :D in most cases i am no fan of youtube video where someone is just opening a notepad and writing note sin there-.. or clicking around for hours haha :D anyway back to topic? .p Off topic, yes, I prefer written instructions over watching a video. Link to comment Share on other sites More sharing options...
fr1nk Posted April 28, 2014 Report Share Posted April 28, 2014 I prefer text as well. The last video tutorial I watched, the guy spent the opening 5 minutes talking about his desktop.. Link to comment Share on other sites More sharing options...
ZarX Posted April 29, 2014 Report Share Posted April 29, 2014 What I mean is since this is built into Epoch now.. what are the DZE codes I add to my init.sqf? Link to comment Share on other sites More sharing options...
Axe Cop Posted April 29, 2014 Author Report Share Posted April 29, 2014 What I mean is since this is built into Epoch now.. what are the DZE codes I add to my init.sqf? Just look into the script, can't you do anything by yourself.. :D I mean if you want to customize the default behavior you have to know some Arma/Epoch basics, or just leave the values as is. you can look at the script in your Epoch client code or here online (latest version): https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/actions/maintain_area.sqf so you can just use ctrl+F to search for "DZE" and you have your answer. essentially the script only defines one global variable, that is "DZE_maintainRange" (radius for the maintain area from the plot pole) DZE_maintainClasses and DZE_DamageBeforeMaint are defined outside of the script, i think in variables.sqf and are used for manual maintain and area maintain. I hope that helps you. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now