FallingSheep
OpenDayZ Lord!
weed farms random spawnhey so do I have to put in the position I want the weed farm to spawn at? because I have it activated and I cant find them anywhere? clearly im doing something wrong haha, also I looked at the safezone script and is there any way to make it push cars out of the safezone on restart? and any chance you figured out the maintenance? =P sorry got a whole list im trying to check off here at once ha
you can try edit this to make em show up scripts\harvesthemp\randomweedfarm.sqf
try this one
Code:
//Script by HALV
//edit by fallingsheep
if (isServer)then{
private["_blacklistedAreas"];
diag_log "[Random_Weed_Farm]: waiting for BIS_fnc_findSafePos";
waitUntil {(!isNil "BIS_fnc_findSafePos")};
if(isNil "dayz_MapArea")then{dayz_MapArea = 7000};
_WorldName = toLower format ["%1", worldName];
//how many will spawn farms, note that farms can spawn "on top" of eachother (min 1, default 6)
_farms = 6;
//min farms (min 1, default 2)
_farmsmin = 2;
//how many plants per farm (min 1, default 9)
_plants = 9;
//min plants (min 1, default 4)
_plantsmin = 4;
//min dist (in meters) from roads to build farms (default 200m)
_mindist2roads = 200;
//the object to spawn, default "Fiberplant"
_fiberplant = "Fiberplant";
_spawnarea = (dayz_MapArea/2);
switch(_WorldName)do{
case "napf":{
_blacklistedAreas = [
[[8246.3184,15485.867,0], 500],
[[15506.952,13229.368,0], 500],
[[12399.751,5074.5273,0], 500],
[[10398.626,8279.4619,0], 500],
[[5149.9814,4864.1191,0], 500],
[[6633.1538,7254.916,0], 500],
[[13288.313,19590.338,0], 800]
];
};
case "chernarus":{
_blacklistedAreas = [
[[23999.742,2.4571743,0], 500],
[[6325.6772,7807.7412,0], 500],
[[4063.4226,11664.19,0], 500],
[[11447.472,11364.504,0], 500],
[[1606.6443,7803.5156,0], 500],
[[12944.227,12766.889,0], 500],
[[8122.35,13464.5,0], 500] // <-- no comma for last entry
];
};
default{
_blacklistedAreas = [
[[0,0,0], 0]
];
};
};
_fnc_positions_array = {
private ["_posi"];
_pos = _this select 0;
_amnt = _this select 1;
_adjust = _this select 2;
_include = if(count _this > 3)then{_this select 3}else{true};
_positions = [];
_buildDir = 0;
_buildRow = 0;
_Row = 0;
_build = 0;
if(_include)then{_positions set [count _positions,[_pos select 0,_pos select 1,0]];_amnt = _amnt - 1;};
for "_i" from 0 to (_amnt-1) do {
if(_Row > 1)then{_buildRow = _buildRow + 1;_Row = 0;};
if(_buildDir > 3)then{_buildDir = 0;};
for "_i" from 0 to _buildRow do {
switch (_buildDir) do{
case 0:{
_posi = [(_pos select 0),(_pos select 1) + _adjust]; //up
_positions set [count _positions,[_posi select 0,_posi select 1,0]];
};
case 1:{
_posi = [(_pos select 0) + _adjust,(_pos select 1)]; //left
_positions set [count _positions,[_posi select 0,_posi select 1,0]];
};
case 2:{
_posi = [(_pos select 0),(_pos select 1) - _adjust]; //down
_positions set [count _positions,[_posi select 0,_posi select 1,0]];
};
case 3:{
_posi = [(_pos select 0) - _adjust,(_pos select 1)]; //right
_positions set [count _positions,[_posi select 0,_posi select 1,0]];
};
};
_pos = _posi;
_build = _build + 1;
if(_build >= _amnt)exitWith{};
};
_buildDir = _buildDir + 1;
_Row = _Row + 1;
if(_build >= _amnt)exitWith{};
};
// diag_log format["[Random_Weed_Farm]: Debug - _build: '%1' _amnt: '%2' _positions: '%3' %4",_build,_amnt,(count _positions),_positions];
_positions
};
_amnt = round(random _farms);
if(_amnt < _farmsmin)then{_amnt = _farmsmin};
if(_amnt < 1)then{_amnt = 1};
diag_log format["[Random_Weed_Farm]: Function loaded ... Server Building %1 Weed Farm(s)",_amnt];
_locations = [];
for "_i" from 0 to (_amnt-1) do {
private ["_coords"];
while{true}do{
scopeName "posiscope";
_coords = [getMarkerPos 'Center',0,_spawnarea,25,0,2000,0] call BIS_fnc_findSafePos;
_roadlist = _coords nearRoads _mindist2roads;
_IsBlacklisted = false;
{if(_coords distance (_x select 0) < (_x select 1))exitWith{_IsBlacklisted = true};}forEach _blacklistedAreas;
if((count _roadlist < 1) and !_IsBlacklisted)then{breakOut "posiscope"};
};
_locations set [count _locations,[_coords select 0,_coords select 1,0]];
_amnt = round(random _plants);
if(_amnt < _plantsmin)then{_amnt = _plantsmin};
if(_amnt < 1)then{_amnt = 1};
diag_log format["[Random_Weed_Farm]: Found Location for a farm (%1) %2 with %3 plants",mapGridPosition _coords,_coords,_amnt];
//aparently sizeOf has problems sometimes, so we iput this manually - else perhaps use [position, amount, sizeOf "object"]
_plantpositions = [[(_coords select 0),(_coords select 1),0],_amnt,5] call _fnc_positions_array;
{
_plant = createVehicle [_fiberplant, _x, [], 0, "CAN_COLLIDE"];
_plant setPos _x;
_uID = str(round(random 999999));
_plant setVariable ["ObjectID", _uID, true];
_plant setVariable ["ObjectUID", _uID, true];
_plant setVariable ["lastUpdate",time,true];
}forEach _plantpositions;
};
_markersOn = true;
//create markers
if(_markersOn)then{
_nr = 1;
for "_i" from 0 to ((count PV_HALV_Broadcast_weedlocations)-1) do {
_markername = format["WeedFarm_%1",_nr];
_markertext = format["Weed Farm %1",_nr];
_marker = createMarker [_markername, (PV_HALV_Broadcast_weedlocations select _i)];
_marker setMarkerType "Warning";
_marker setMarkerText _markertext;
_marker setMarkerColor "ColorGreen";
diag_log format["[Random_Weed_Farm]: Client created marker %1 ...",_nr];
_nr = _nr + 1;
};
};
diag_log "[Random_Weed_Farm]: Weed Farm(s) Done ... Broadcasting locations for clients";
};
to turn markers off edit _markersOn = true;
safezones not sure about the car thing, you would have to teleport the car to the edge of the zone as they cant be "pushed"
maintenace stuff coming just making sure i got the right files