joikd
Member-
Content Count
14 -
Joined
-
Last visited
-
Medals
-
Medals
-
Community Reputation
10 GoodAbout joikd
-
Rank
Private First Class
-
battleWarden.net - RCon for ArmA & DayZ!
joikd replied to soner's topic in ARMA 2 & OA - Servers & Administration
Any idea why I can see some player's group or direct chat (when typed), but not other players'? I have tested this, and confirmed it, but can't figure out how to fix it. -
Array of Items x Array of % Chances = Array of Items that Beat the Roll --How to do?
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I don't plan on using 1 in 1,000,000--just wanted to know the limit just in case. Thanks again! -
Array of Items x Array of % Chances = Array of Items that Beat the Roll --How to do?
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks, Muzzleflash! How many decimal points can "random 1" go out to? Can it be used to roll 1 in 1,000,000? -
If I have two arrays: _myItemsArray = [gun, knife, grenade, rocket]; _myItemsChanceArray = [.2, .7, .03, .005]; how can I build a new array based on the % chance for each item using individual rolls for each item (yes, that last one is a 5 in 1000 chance)? I want a new array that possibly contains any/all/none of those items. Something like this if both gun & grenade made their rolls, but knife and rocket did not: _newArray = [gun, grenade]; By the way, the first two arrays might be very large (close to 100 items). Any help would be greatly appreciated.
-
nearestObjects--filter results by distance?
joikd posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
nearestObjects [player, ["Car","Tank"], 1000] Is there a way to run the above just once, but filter out objects based on distance rather than running it again? For example, could I get the objects from 200 to 1000, the objects from 200 to 800, and so on from the above? I don't want to run it multiple times for different ranges--it's just too demanding for higher ranges with many objects. -
Script optimization help--super bloat
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
It looks like "building" includes many more non-spawning buildings than I would have thought. I see now how important it is to filter those out with (from above): _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { The in-game result of this, though, is that the spawn range is greatly reduced near industrial areas because of the many non-spawning "building"s (cargo containers maybe?). This can be overcome by raising the amount of "building"s checked per range, but then it is too demanding in non-industrial areas. Is there are way to pre-filter the "buildings"s that actually spawn, or not count those that are found that do not spawn? I tried replacing "building" with "CfgBuildingLoot", but that did not work. Maybe there is a way to replace "building" with all of the "CfgBuildingLoot" individual subclasses, or group those subclasses into something that can be used with nearObjects? Once again, any assistance would be greatly appreciated. -
Instead of nearObjects how to get all objects
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks a million, gents. I will give these a try. Only using once upon server start, so should be okay CPU-wise I think. -
Instead of nearObjects how to get all objects
joikd posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Vanilla working code is this: _position = getPosATL player; _nearby = _position nearObjects ["building",200]; So, this appears to get the position of the player, then all of the "building"s within 200 of that player's position. How would I get all of the "building"s that are on the map (every single one--not just within 200) in a similar format as nearObjects without having a player's position to use as a reference point? Any help would be greatly appreciated. -
Script optimization help--super bloat
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Wow, gc8!!! That works perfectly! Thank you so much! I have wasted so many hours on just this one little script. I can't believe how much you chopped off. This gives me a lot of hope that almost anything that I can think of can be done. But, it is also very discouraging as I am not anywhere near the level to do this kind of stuff, which is very frustrating since I have so many ideas. In case anyone doesn't know what this does--it fixes a huge flaw (at least I think) in DayZ where vanilla DayZ spawns zombies only out to 200 no matter what. I know one of the reasons was because a higher range was too much for the game to handle (too much spawning at once). Well, this allows the range to be larger, but will scale it back if there is too many spawn points. This takes care of one of the major flaws with zombies. I will now move on to the next one. I know DayZ might not be the most popular topic around here, but thank you for sharing your expertise. I appreciate the time and effort. -
Script optimization help--super bloat
joikd posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
After struggling to get this to work using nested if-then-else, switch, breakout, breakto, exitwith, and while do, I made it the long way using basic techniques that I know (I am very new at this). This long way does work, but it is very bloated. Most of the code is repeated over and over. There must be a more efficient way. I think someone who actually knows what they are doing could condense it fairly quickly. Any assistance would be greatly appreciated! private ["_nearby","_nearby5","_nearby4","_nearby3","_nearby2","_dis","_bPos","_zombiesNum","_type","_config","_canLoot","_inVehicle","_fastRun","_position","_counter"]; _inVehicle = vehicle player isKindOf "player"; _fastRun = _this select 0; _position = getPosATL player; _counter = 0; _nearby5 = count (_position nearObjects ["building",500]); if ((_nearby5 > 0) and (_nearby5 < 11)) then { _nearby = _position nearObjects ["building",500]; _counter = 1; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; }; if (_counter != 0) then { _counter = 0; } else { _nearby4 = count (_position nearObjects ["building",400]); if ((_nearby4 > 0) and (_nearby4 < 11)) then { _nearby = _position nearObjects ["building",400]; _counter = 1; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; }; }; if (_counter != 0) then { _counter = 0; } else { _nearby3 = count (_position nearObjects ["building",300]); if ((_nearby3 > 0) and (_nearby3 < 11)) then { _nearby = _position nearObjects ["building",300]; _counter = 1; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; }; }; if (_counter != 0) then { _counter = 0; } else { _nearby2 = count (_position nearObjects ["building",200]); if ((_nearby2 > 0) and (_nearby2 < 1000)) then { _nearby = _position nearObjects ["building",200]; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; }; }; -
Scripting Issue--four days without success--please help!
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks for the replies. @JSF I'm not getting any errors (assuming you mean when using the command line switch). This code is from DayZ--not mine. I'm just trying to edit the already working code. @tryteyker How does switch work if more than one case is true? For my code above, there may be less than 11 buildings in the first three cases, which would make them all true. That's why I placed the 500 check first. If true, assign _nearby, but STOP. It keeps going all the way to the end like the "else" has no meaning, and was "and" instead, so I end up with the 200 _nearby. The preceding are ignored, or passed on. Doesn't the order matter? -
Scripting Issue--four days without success--please help!
joikd replied to joikd's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The problem seems to be the use of if-then-else. This does not work: private ["_position","_nearby"]; _inVehicle = vehicle player isKindOf "player"; _fastRun = _this select 0; _position = getPosATL player; /*if (count (_position nearObjects ["building",500]) > 0) then { _nearby = _position nearObjects ["building",500]; };*/ [color="#FF0000"]if (count (_position nearObjects ["building",500]) < 11) then { _nearby = _position nearObjects ["building",500]; } else { if (count (_position nearObjects ["building",400]) < 11) then { _nearby = _position nearObjects ["building",400]; } else { if (count (_position nearObjects ["building",300]) < 11) then { _nearby = _position nearObjects ["building",300]; } else { _nearby = _position nearObjects ["building",200]; }; }; };[/color] /*switch (true) do { case ({_x} count nearestObjects [_position, ["building"], 500] < 11 : { _nearby = _position nearObjects ["building",500]; }; case ({_x} count nearestObjects [_position, ["building"], 400] < 11 : { _nearby = _position nearObjects ["building",400]; }; case ({_x} count nearestObjects [_position, ["building"], 300] < 11 : { _nearby = _position nearObjects ["building",300]; }; default { _nearby = _position nearObjects ["building",200]; }; };*/ { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; But, this does: private ["_position","_nearby"]; _inVehicle = vehicle player isKindOf "player"; _fastRun = _this select 0; _position = getPosATL player; [color="#FF0000"]if (count (_position nearObjects ["building",500]) > 0) then { _nearby = _position nearObjects ["building",500]; };[/color] /*if (count (_position nearObjects ["building",500]) < 11) then { _nearby = _position nearObjects ["building",500]; } else { if (count (_position nearObjects ["building",400]) < 11) then { _nearby = _position nearObjects ["building",400]; } else { if (count (_position nearObjects ["building",300]) < 11) then { _nearby = _position nearObjects ["building",300]; } else { _nearby = _position nearObjects ["building",200]; }; }; };*/ /*switch (true) do { case ({_x} count nearestObjects [_position, ["building"], 500] < 11 : { _nearby = _position nearObjects ["building",500]; }; case ({_x} count nearestObjects [_position, ["building"], 400] < 11 : { _nearby = _position nearObjects ["building",400]; }; case ({_x} count nearestObjects [_position, ["building"], 300] < 11 : { _nearby = _position nearObjects ["building",300]; }; default { _nearby = _position nearObjects ["building",200]; }; };*/ { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; Any ideas? -
Scripting Issue--four days without success--please help!
joikd posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Here is the original (working) code: _isAir = vehicle player iskindof "Air"; _inVehicle = (vehicle player != player); _fastRun = _this select 0; _dateNow = (DateToNumber date); _age = -1; if (!_inVehicle) then { _position = getPosATL player; //waitUntil{_position nearObjectsReady 200}; _nearby = _position nearObjects ["building",200]; //nearestObjects [player, ["building"], 200]; _tooManyZs = {alive _x} count (_position nearEntities ["zZombie_Base",400]) > dayz_maxLocalZombies; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; if ((_dis < 120) and (_dis > 30)) then { _looted = (_x getVariable ["looted",-0.1]); _cleared = (_x getVariable ["cleared",true]); /* if(isServer) then { _dateNow = (DateToNumber date); _age = (_dateNow - _looted) * 525948; } else { _dateNow = serverTime; _age = (_dateNow * 60) - _looted; }; */ _dateNow = (DateToNumber date); _age = (_dateNow - _looted) * 525948; //diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" ); if ((_age > 10) and (!_cleared) and !_inVehicle) then { _nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)]; {deleteVehicle _x} forEach _nearByObj; _x setVariable ["cleared",true,true]; _x setVariable ["looted",_dateNow,true]; }; if ((_age > 10) and (_cleared) and !_inVehicle) then { //Register _x setVariable ["looted",_dateNow,true]; //cleanup _handle = [_x,_fastRun] spawn building_spawnLoot; waitUntil{scriptDone _handle}; }; }; if ((time - dayz_spawnWait) > dayz_spawnDelay) then { if (dayz_spawnZombies < dayz_maxLocalZombies) then { if (!_tooManyZs) then { private["_zombied"]; _zombied = (_x getVariable ["zombieSpawn",-0.1]); _dateNow = (DateToNumber date); _age = (_dateNow - _zombied) * 525948; if (_age > 5) then { _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { //Randomize Zombies _x setVariable ["zombieSpawn",_dateNow,true]; _handle = [_x,_fastRun] spawn building_spawnZombies; waitUntil{scriptDone _handle}; //} else { //_x setVariable ["zombieSpawn",_dateNow,true]; }; }; }; } else { dayz_spawnWait = time; dayz_spawnZombies = 0; }; }; }; if (!_fastRun) then { sleep 0.1; }; } forEach _nearby; }; I want it to first check the range at 500 (if not true), then 400 (if not true), and so on. So, I have tried many, many variations of the code below without success (other than sometimes only 200 will work). Any help would be greatly appreciated! private ["_position";"_nearby"]; _inVehicle = vehicle player isKindOf "player"; _fastRun = _this select 0; _position = getPosATL player; _500m = count (_position nearObjects ["building",500]) < 11; _400m = count (_position nearObjects ["building",400]) < 11; _300m = count (_position nearObjects ["building",300]) < 11; if (_500m) then { _nearby = _position nearObjects ["building",500]; } else { if (_400m) then { _nearby = _position nearObjects ["building",400]; } else { if (_300m) then { _nearby = _position nearObjects ["building",300]; } else { _nearby = _position nearObjects ["building",200]; }; }; }; { _type = typeOf _x; _config = configFile >> "CfgBuildingLoot" >> _type; _canLoot = isClass (_config); if (_canLoot) then { _dis = _x distance player; _bPos = getPosATL _x; _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { [_x,_fastRun] call building_spawnZombies; }; }; } forEach _nearby; -
Would the 100mbps unmetered ever dip below 10mbps? They cost pretty much the same. This will be for a single DayZ server for now, but I may switch to an ArmA OA mission at some point. Also, would a 1gbps port help with either of these connections? I would be using a colocation service for the server. Server specs: 3570K @ 4+GHZ; SSD; 32GB 2133 RAM (RAMdrive as much as possible).
