Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Lemonwired

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About Lemonwired

  • Rank
    Private
  1. Thanks again Grumpy Old Man, Works brilliantly and much more faster. Regards, Lemon
  2. Huge thanks @Grumpy Old Man ! This crazy amount of optimisation was exactly what I was after, I'll test this when I get the chance. By the way, with the script it will hide editor place objects including the player if near a road. So I'll need to throw in something that prevents editor placed units from being deleted, perhaps the following: nearObjects ["Man", _roadRadius]? How could I incorporate that into Grumpy Old Man's code? _EXCLUDE = nearObjects ["Man", _roadRadius]; _centerPos nearRoads _roadRadius apply { getPos _x nearObjects _objectRadius - _EXCLUDE apply {hideObjectGlobal _x}; nearestTerrainObjects [getPos _x, [], _objectRadius] apply {hideObjectGlobal _x}; }; Thanks in advance all! Everyone has been so extremely helpful.
  3. 😭 I was hoping I could get away with it. Thanks again HazJ. Here's the latest script I'll soon test: _pos = _this select 0; _radius = _this select 1; _radius2 = _this select 2; _roadList= getpos _pos nearroads _radius; _notobjects = []; for "_i" from 0 to (count _roadList) do { _arr = getPos (_roadList select _i) nearObjects _radius2 append nearestTerrainObjects [getPos (_roadList select _i), [], _radius2]; _notobjects append _arr; }; {hideobject _x} foreach _notobjects;
  4. Thanks HazJ! I was just looking into using "append" & "For" instead of "_notobjects = _notobjects + _arr;" and "while". Not sure what you meant by "Not all roads can be hidden". The purpose of this is to clear the road of obstacles, which custom terrains like 'Mogadishu' that have to much clutter for AI to navigate around. What I had previously worked but was extremely slow to do all the hiding of objects. I also have the AI dynamically moving to different locations across the entire map (similar to Arma 2's Warfare/CTI), the issue is they get stuck behind a wreck in the middle of the road for example. Right now, I'm not on my gaming desktop to test, but I'm looking to use nearobjects instead of nearestobjects because sorting shouldn't be required. And I'm getting rid of nearestterrainobjects. Also, please note, this will just be for singleplayer. Here's the script I have now (calling it cleanroads.sqf or whatever), I'll test it when I get home: _pos = _this select 0; _radius = _this select 1; _radius2 = _this select 2; _roadList= getpos _pos nearroads _radius; _notobjects = []; for "_i" from 0 to (count _roadList) do { _arr = getPos (_roadList select _i) nearObjects _radius2; _notobjects append _arr; }; {hideobject _x} foreach _notobjects; I'll give feedback once tested for anyone else that wants to use a script to remove road obstacles from their missions.
  5. Just another query on this, I have inputted both nearestObjects & nearestterrainObjects to run on the same road to ensure ALL types of objects are cleared. Does anyone know if this is overkill? For example, can nearestObjects clear terrain objects as well? I'm looking to use this on any terrain. Kind regards, Lemon
  6. Thanks gc8! I'll give this a try 😊
  7. Just the once at mission start would be needed.
  8. Hi All, First time on these forums. I've created a unoptimized script that clears roads of obstacles to make it easier for AI to navigate past the clutter. It works to clear the roads but takes so damn long to execute. Any ideas here? Basically, the script works by looking for all roads within a radius then obtains all the nearest objects on that road and hides them. //0 = [player,1000,10] execvm "clearroad.sqf"; //here's what to put in the init.sqf //item 1 is the object that will be the center e.g. player //item 2 is the radius where all the roads that will be impacted e.g. 1000m around the player //item 3 is the area of the road that will be cleared e.g. 10 meters of road to be cleared _pos = _this select 0; _radius = _this select 1; _radius2 = _this select 2; _roadList= getpos _pos nearroads _radius; _notobjects = []; _i = 1; _arraycount = count _roadList; while {_i < _arraycount} do { _arr = nearestObjects [getpos (_roadList select _i), [], _radius2]; _arr2 = nearestterrainObjects [getpos (_roadList select _i), [], _radius2]; _notobjects = _notobjects + _arr + _arr2; _i = _i + 1; }; {hideobject _x} foreach _notobjects; kind regards, Lemon
×