Jump to content

je007

Member
  • Content Count

    3
  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About je007

  • Rank
    Rookie
  1. Thank you for the quick responses! I incorporated some of your suggestions to make the script simpler, however I had to make some changes in order to use the nearestObjects command (as opposed to the nearestObject command I originally used). I realized that the easiest way to search for objects of different classnames was to use nearestObjects. It isn't perfect, but it works plantCrop.sqf _nearestCrops = nearestObjects [_plant, ["put","plant","object","classnames","here"], 2]; _nearestCrop = _nearestCrops select 0; _distance = (getpos _plant) distance (getpos _nearestCrop); if (_distance <= 2 ) then { _plant setPos (_plant getPos [1.8 + random 1, random 360])};
  2. First post here on the BI Forums. Has been a great resource so far, as evidenced by the fact that I haven't had to make a single post looking for help in the four years I've been involved in Arma :P I'm working on a farming script which dynamically creates an object that a player can gather. The issue I am having is that if multiple objects are created without the player moving around, they are all created in the same place as each other. On the wiki page for createVehicle it is stated that "If the exact position is occupied, nearest empty position is used.". For whatever reason this doesn't seem to be working in this case, however the object I am using does throw the following RPT error: No geometry and no visual shape. To fix this, I wrote a script which checks if an object is within a certain radius of another object of the same classname, and if it is then to move the object. For some reason, it doesn't seem to be doing anything. I tested the code using the debug console and it worked perfectly fine, however when I implement it into the mission file it doesn't seem to work. No errors thrown regarding this script from the RPT. There is more code in the SQF, but this is the only segment which is giving me issues. plantCrop.sqf _plantObject = "classname"; //Create the plant _plant = _plantObject createVehicle (getpos player); _plant setVariable ["plantReady", false, true]; //Check if plant is too close to another plant _nearestCrop = nearestObject [(getpos _plant), _plantObject]; _distance = (getpos _plant) distance (getpos _nearestCrop); if (_distance <= 2) then { _random = selectRandom [1,2]; if (_random == 1) then { _plant setPos [(getPos _plant select 0) + 2, getPos _plant select 1]; } else { if (_random == 2) then { _plant setpos [getPos _plant select 0, (getPos _plant select 1) + 2]; }; }; };
  3. I feel like this should be simple, but its giving me some trouble: I'd like to add another map click respawn point. I've added the marker to the map, but it shows up as one of the red unusable ones (like having an undeployed MHQ). How would I go about making it usable?
×