dlegion 98 Posted July 15, 2017 hello guys, i'm trying to populate the map for a domination mission i made, and i'm trying everything. Enigma civilian and Enigma traffic are working great for civilian town population, i've scripted some Independent, West and East forces to being created (and deleted/re-created when dead or unable to move), that use "fnc_taskPatrol" to randomly patrol the area, dont seem the most efficient, but it works (seems it still have less performance impact than the good EOS). the problem is on the sea....seems that even boats get waypoints on land, so getting stuck on shores. anyone can help me ? thanks ! Share this post Link to post Share on other sites
7erra 629 Posted July 15, 2017 When evaluating the position for the waypoint you can use surfaceIsWater to check if the position is reachable by boat. Share this post Link to post Share on other sites
dlegion 98 Posted July 15, 2017 thanks man....but i'm using a different way to help performance. to cut it short...i spawn via script my boat, and i dont place waypoint by hand. i was using "fnc_taskPatrol" for ground vehicles, seems to work good for them. do you know where is it hidden in *.pbo? maybe i can unpack it and find a way to invert "waypoint on ground" to "waypoint on water"! thanks anyway!! Share this post Link to post Share on other sites
7erra 629 Posted July 15, 2017 Ah okay so you are using the BIS_fnc_taskPatrol. Here is the rewritten function. I only changed the _newPos parameter to evaluate positions on the sea: /* File: taskPatrol.sqf Author: Joris-Jan van 't Land Description: Create a random patrol of several waypoints around a given position. Parameter(s): _this select 0: the group to which to assign the waypoints (Group) _this select 1: the position on which to base the patrol (Array) _this select 2: the maximum distance between waypoints (Number) _this select 3: (optional) blacklist of areas (Array) Returns: Boolean - success flag */ //Validate parameter count if ((count _this) < 3) exitWith {debugLog "Log: [taskPatrol] Function requires at least 3 parameters!"; false}; private ["_grp", "_pos", "_maxDist", "_blacklist"]; _grp = _this select 0; _pos = _this select 1; _maxDist = _this select 2; _blacklist = []; if ((count _this) > 3) then {_blacklist = _this select 3}; //Validate parameters if ((typeName _grp) != (typeName grpNull)) exitWith {debugLog "Log: [taskPatrol] Group (0) must be a Group!"; false}; if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [taskPatrol] Position (1) must be an Array!"; false}; if ((typeName _maxDist) != (typeName 0)) exitWith {debugLog "Log: [taskPatrol] Maximum distance (2) must be a Number!"; false}; if ((typeName _blacklist) != (typeName [])) exitWith {debugLog "Log: [taskPatrol] Blacklist (3) must be an Array!"; false}; _grp setBehaviour "SAFE"; //Create a string of randomly placed waypoints. private ["_prevPos"]; _prevPos = _pos; for "_i" from 0 to (2 + (floor (random 3))) do { private ["_wp", "_newPos"]; //_newPos = [_prevPos, 50, _maxDist, 1, 0, 60 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos; _newPos = [_prevPos, 50, _maxDist, 1, 2, 60 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos; // Changed watermode parameter from 0 (only land) to 2 (only water) _prevPos = _newPos; _wp = _grp addWaypoint [_newPos, 0]; _wp setWaypointType "MOVE"; _wp setWaypointCompletionRadius 20; //Set the group's speed and formation at the first waypoint. if (_i == 0) then { _wp setWaypointSpeed "LIMITED"; _wp setWaypointFormation "STAG COLUMN"; }; }; //Cycle back to the first position. private ["_wp"]; _wp = _grp addWaypoint [_pos, 0]; _wp setWaypointType "CYCLE"; _wp setWaypointCompletionRadius 20; true Let me know if this worked Share this post Link to post Share on other sites
dlegion 98 Posted July 15, 2017 it works !! huge thanks man...finally sea patrols ! really thanks !!! Share this post Link to post Share on other sites
dlegion 98 Posted July 15, 2017 the object of the topic is already solved, but maybe this is a good place to ask: in your opinion, whats the more "less-impact-on-performance" way (scripts, want stay vanilla) to make map feels more "alive" ? i've found Engima Civilians and Engima Traffic be the best way to do so about civilians. now i use a script to spawn some vehicles (thanks to you now boats too) that born into a place and randomly patrol a big area, to try give the feeling of troops moving around map. this script re-spawn this vehicles when they get destroyed, and thats not bad. But most of time this vehicles patrol empty areas far from players, i feel like wasting resources for that. but i'm sure that for a so common problem, more efficient solutions have already been found...please point me in the right direction, thanks ! Share this post Link to post Share on other sites
das attorney 858 Posted July 15, 2017 Read up on Dynamic Simulation - you can place them as you have been and switch off the simulation when they are x metres away from you/players Share this post Link to post Share on other sites
dlegion 98 Posted July 15, 2017 Good idea. Anyway....isnt there any other solution ? Share this post Link to post Share on other sites
das attorney 858 Posted July 15, 2017 EOS, or some other cache script - have a hunt around on the forums/armaholic/google for them. Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 i made some tests, and dynamic simulation seems to work good...for units placed in editor. the problem is that i spawn my units from scripts, and dont know how make dynamic simulation work with them! (i already tried "enableDynamicSimulation" command, but seems to just not work properly...it does not switch units ON and OFF following attributes>performance set parameters. dunno whats wrong) Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 ...i noticed that the boats sometimes get stuck on the shore while getting near the waypoint. i already tried waypoint completion radius, but boat still go 1 m from the center to complete it, mah! is there any other way to make the boats not get stuck on the shore? worst case scenario i wish to delete the boat if it get stuck , and restart the spawn script....real problem is discriminate the "stuck boat"! Share this post Link to post Share on other sites
das attorney 858 Posted July 16, 2017 Her's the scripting commands for dyn sim: https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation#Script_commands You can add them to scripted groups by editing in the appropriate command when your script spawns new units/groups As for boats - they're a pain in the bum. I've got a random patrol script that makes sure their waypoints are in deep water and at least 100m from the coast but they always seem to beach anyway and the main problem is they can't reverse, so once they're stuck then that's it (unless you write some sort of loop that periodically checks for stuck boats) :( Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 really thanks man !! trying now some dynamic simulation commands :) about boats....got an idea...but dont know how script it : check every 5 minutes is the boat is not moving , if is immobile after 3 more minutes (to prevent activation on a boat randomly stopped for another reason) the script should teleport the boat 20 meters in back direction. Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 ....no luck. tried adding to my spawn script: enableDynamicSimulationSystem true; _Dveh enableDynamicSimulation true; my test vehicle spawned by script is _Dveh, settings are 50m, no multipliers....but it still move away whithout getting "freezed". any idea how do it? EDIT: did more test, put a trigger, and seems that as soon as it spawns, it gets detected with dynamic simulationb OFF, and there's no way to turn it ON. Share this post Link to post Share on other sites
pierremgi 4898 Posted July 16, 2017 You should check for any waypoint 100 or 200 m away from seashore, instead of checking if your boat is stuck on ground, then push it back, and so what? same waypoints, again and again? You should place a bunch of markers at sea and randomize (or not!) on these deep water positions, along with clear patterns. No problem to place a hundred invisible markers, but keep on mind the cleared patterns. Usually, patrol boats can avoid shore between 2 wpts but this could be tricky on mangrove. You can script also to check water free of ground within a range. In all cases, if your patrol tracks are calculated at start, you'll wait a little bit more during the mission launch and no lag after. I don't use the dynamic simulation because it's very poorly implemented. The fact is when a unit is awaken, there is no return on the previous idle status. So, it's a one way ticket simulation. On the other end, the old BI simulation manager module can do that. Enable/disable sim! The "secret" is to avoid some variable name for these units. If named, they are automatically out of sim managing. You can also spawn/delete civilian life along with any player distance from a trigger area. Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 thanks Pierre! for boat...i cannot do this, i wish for a 100% random route covering whole island seas...so i have to find another kind of solution. i'm very interested in your idea about the "old BI simulation manager" ! can you explain better how implement this in script-spawned units? thanks!! Share this post Link to post Share on other sites
das attorney 858 Posted July 16, 2017 On 7/16/2017 at 3:16 PM, pierremgi said: You should check for any waypoint 100 or 200 m away from seashore, instead of checking if your boat is stuck on ground, then push it back, and so what? same waypoints, again and again? You should place a bunch of markers at sea and randomize (or not!) on these deep water positions, along with clear patterns. No problem to place a hundred invisible markers, but keep on mind the cleared patterns. You can script also to check water free of ground within a range. In all cases, if your patrol tracks are calculated at start, you'll wait a little bit more during the mission launch and no lag after. That's what I do already as mentioned in my post, but the problem is that as soon as a boat spots a target, it goes all screwy and deviates from it's waypoints, often running ashore. It doesn't matter what you do with the combat behaviour, they go haywire when enemies are spotted. You could put behaviour to "careless" but then there's no point having them in the mission. Share this post Link to post Share on other sites
johnnyboy 3797 Posted July 16, 2017 Here is my scripted solution, but it may not work well in combat situations. But it was very good at not getting stuck. See the screenshots of their recorded paths. I had 6 boats run for 4 hours without getting stuck. Share this post Link to post Share on other sites
dlegion 98 Posted July 16, 2017 awesome ! thanks man ! Share this post Link to post Share on other sites
pierremgi 4898 Posted July 16, 2017 On 7/16/2017 at 3:27 PM, dlegion said: thanks Pierre! for boat...i cannot do this, i wish for a 100% random route covering whole island seas...so i have to find another kind of solution. i'm very interested in your idea about the "old BI simulation manager" ! can you explain better how implement this in script-spawned units? thanks!! You don't have to do anything. Just place the module anywhere on your map. I don't have any problem with standard waypoints for a patrol boat, vanilla Arma. I set several "8 paths" on Yani islets south of Tanoa main airport. Just make the driver allowfleeing 0 Then the patrol boat can sail through the islets without any problem under fires. (make crew + boat invincible for the test). No real differences between cleaned area and crowded by enemies. checked with: 0 = [] spawn {while {true} do {sleep 4; _mk = createMarker [str(diag_tickTime), getPosASLW p1]; _mk setMarkerType "HD_dot";_mk setMarkerColor "colorRed"}} So, current Arma's engine is no so bad! (tested only with speedboat minigun) Just test it, avoiding fleeing and driver kill. I'm quite sure, the more addons, (the more scripts), the more unwanted behaviors as far as the engine is concerned. Check also skill for Ais. Share this post Link to post Share on other sites