Jump to content
  • 0

[Farming script WIP] Needing help with this!


Reaper5150

Question

Hello, I'm currently working on a farming script that will include multi animals for tending to at bases based off the plot pole. I'm having an issue trying to get this to work and need some pro help and give you credit upon full release! What I'm trying to get it to do here is a player has say sunflower seeds that will be based off right click, then if they are by their plot pole a command menu will pop up asking where to spawn the chickens and how many with the max being 4. And yes I know the script is a mess right now but I think this will be a great addition for arma once it is completed. Any help would be great!  

 

private["_playerPos","_countplayers","_isBase","_ressource1","_hasitems1","_Create","_Pos","_area","_count"];

 

_playerPos = getPosATL player;

_countplayers = count nearestObjects [player, ["CAManBase"], 1];

_isBase = count nearestObjects ["Plastic_Pole_EP1_DZ"];

_ressource1 = ["FoodSunFlowerSeed",2];

_hasitems1 = [_ressource1] call player_checkItems;

_area = 0;

_count = 0;

 

//-------------------------------Spawn menu------------------------------//

if (_isBase) exitWith {

cutText [format["No plotpole found!"], "PLAIN DOWN"];

_radiusMenu =

[

["",true],

    ["Set Radius:", [-1], "", -5, [["expression", ""]], "1", "0"],

    ["2m STAND WHERE YOU WANT THEM",[],"", -5,[["expression","_area = 5;"]],"1","1"],

    ["", [], "", -5,[["expression", ""]], "1", "0"],

    ["Exit", [20], "", -5, [["expression", "_area = -1;"]], "1", "1"]

];

_amountMenu =

[

["",true],

    ["Chicken ammount:", [-1], "", -5, [["expression", ""]], "1", "0"],

    ["1",[],"", -5,[["expression","_count = 1;"]],"1","1"],

    ["2",[],"", -5,[["expression","_count = 2;"]],"1","1"],

    ["3",[],"", -5,[["expression","_count = 3;"]],"1","1"],

    ["4",[],"", -5,[["expression","_count = 4;"]],"1","1"],

    ["", [], "", -5,[["expression", ""]], "1", "0"],

    ["Exit", [20], "", -5, [["expression", "_count = -1;"]], "1", "1"]

];

showCommandingMenu "#USER:_radiusMenu";

waitUntil{(_area != 0) || (commandingMenu == "")};

if(_area == -1) exitWith{};

showCommandingMenu "#USER:amountMenu";

waitUntil{(_count != 0) || (commandingMenu == "")};

if(_count = -1) exitWith{};

//Failed MSG

if (_countplayers > 1) exitWith {

cutText [format["A player is too close too you, Tell them to go away!"], "PLAIN DOWN"];

};

if !(call {_hasitems1} exitWith {

cutText [format["You need two packs of sunflower seeds to do this!"], "PLAIN DOWN"];

_i = 1;

for "_i" from 1 to _count do {

    _Create = createAgent ["chicken", position player, [], _area, "NONE"];

    _Pos = getPosATL _Create;

    [_Pos,_zCreate] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";

    player removeMagazine "FoodSunFlowerSeed";

    player removeMagazine "FoodSunFlowerSeed";

};

if (_count != 4) then {

exitWith {

cutText [format["DON'T BE GREEDY: You have reached the max ammount!"], "PLAIN DOWN"];

//----------------------------------------------------------------------//

Link to comment
Share on other sites

1 answer 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...