Jump to content
Sign in to follow this  
Fr3eMan

BIS_fnc_taskPatrol

Recommended Posts

I'm working on a quick script for create a unit/vehicle to patrol a specific area delimited by a marker.

So for avoid to use any kind of script I try to use the BIS_fnc_taskPatrol, and working, almost...

Any kind of spawned object (land, sea, air) the group commander receive the waypoint and give the order to move to the driver, but for each unit/vehicle I spawn all receive a waypoint at position [0,0,0].

Sometime do not create any problem, the unit/vehicle simple patrol the area nearest the assigned marker, but some time the ai/vehicle start to move to the position [0,0,0] or more frequently remain freeze for few minutes or completely do not move from starting point.

So I try to use a more big marker, maybe wasn't enough big to permit the function to work properly, but same issue.

I try to spawn outside the marker area the unit/vehicle, and anyway the group commander have a waypoint at [0,0,0].

Last year I had a same problem by using the SHK_patrol script, the ai moves between the waypoint and at the end start to move on position [0,0,0], this is the code I used for spawn the unit/vehicle if anyone can clarify me if I do something wrong or what else, thanks in advance.

 

_unit = ["O_MBT_02_cannon_F","O_APC_Tracked_02_cannon_F","O_APC_Tracked_02_AA_F","O_MBT_02_arty_F","O_MRAP_02_hmg_F","O_APC_Wheeled_02_rcws_F","O_MRAP_02_gmg_F"]; 
_grp = createGroup east;  
_veh = [(getMarkerPos "Marker0"), random (360), (_unit call BIS_fnc_selectRandom), _grp] call bis_fnc_spawnvehicle;
null = [_grp,(getMarkerPos "Marker0"), 35] call BIS_fnc_taskPatrol;

Some pictures here below

 

Share this post


Link to post
Share on other sites

1.Turn on  displaying script errors  in your arma launcher parameters.

2. Have a look at https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle and realize what is returnining by this function.

3.Use selectRandom instead of BIS_fnc_selectRandom.

4. select direct from array to reduce variables count

 

Spoiler

private _veh = selectRandom ["O_MBT_02_cannon_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "O_MBT_02_arty_F", "O_MRAP_02_hmg_F", "O_APC_Wheeled_02_rcws_F", "O_MRAP_02_gmg_F"]; 
_veh = [getMarkerPos "Marker0", random 360, _veh, EAST] call BIS_fnc_spawnVehicle;
null = [_veh select 2, getMarkerPos "Marker0", 35, []] call BIS_fnc_taskPatrol;

 

 

Share this post


Link to post
Share on other sites

Hi Davidoss,

 

also in this way the vehicle have a waypoint at [0,0,0] and random freeze.

I always working with displaying script errors and I also check the rpt file, and with my script and your I don't have any error message.

I was thinking to try open a bug ticket but before I wan to check if anybody know a solution.

Share this post


Link to post
Share on other sites

I try to change terrain, and I choose the virtual world, because I recognise sometime the vehicle when start to move if hit a bush or a stone the driver freeze on this position, and sometime restart to move in a few second, more frequently remain just freeze.

So on the empty virtual world some vehicle haven't create the waypoint at [0,0,0] but remain freeze and the driver complete all waypoint just without moving (see the below video), others vehicle create the waypoint at [0,0,0] and start to move, but when complete all the waypoint around the marker area just stop, driver switch off the  vehicle engine and stand by on this position (second below video).

I try to spawn an helicopter and do the both error, create a waypoint at [0,0,0] and pilot automatically complete the others waypoint without move form original position.

 

 

 

 

Share this post


Link to post
Share on other sites

not sure from the video's if this is your problem but I've had issues with BIS_fnc_taskPatrol if its called with anything under 50m range, units walking to the bottom left corner of the map and other strange behaviour. have you tried something like:

 

Quote

null = [_veh select 2, getMarkerPos "Marker0", 100, []] call BIS_fnc_taskPatrol;

 

Edited by lordfrith
dewrongification
  • Like 1

Share this post


Link to post
Share on other sites
15 minutes ago, lordfrith said:

not sure from the video's if this is your problem but I've had issues with BIS_fnc_patrol if its called with anything under 50m range, units walking to the bottom left corner of the map and other strange behaviour. have you tried something like:

 

 

 

I try also with 100mt but same problem, but I recognise to some class of vehicle do not create waypoint at [0,0,0], but for Ifrit ("O_MRAP_02_hmg_F" or "O_MRAP_02_gmg_F") also if I increase till 500mt range and anyway this vehicle have a waypoint at [0,0,0].

For all in all condition when they arrive at last more nearest waypoint the vehicle do not move from there.

 

So I do another exercise, I increase the marker surface to the same maximum range 500mt, I put by editor on map several different kind of land vehicle, including 3 different Ifrit with range form 49mt till 500mt and no one create a waypoint at [0,0,0], and the only vehicle  immediately freeze wad that have some waypoint complementation area collide with another waypoint complementation area, if range is 49mt but the waypoint complementation area do not collide the vehicle continue the patrol normally, but also in this case I had the Ifrit with 300mt range when arrive at last waypoint remain freeze on this position.

 

All vehicle int where _x is different range from 49mt till 500mt.

[group this, getPos this, _x] call bis_fnc_taskPatrol;

 

Share this post


Link to post
Share on other sites

hmm ok,

 

the waypoints shown in the video are those generated by function?

 

any chance you could share your test mission?

 

maybe the minimum range was 100 i now can't find the forum page that had a useful discussion of this stuff

 

Share this post


Link to post
Share on other sites
2 hours ago, davidoss said:

Looks like this do the job

At this post i made some tests and:

 

1. null = [_veh select 2,  getMarkerPos "Marker0",  35] call BIS_fnc_taskPatrol; 

same problem behaviour described by author

 

2. null = [_veh select 2,  getMarkerPos "Marker0", 100, []] call BIS_fnc_taskPatrol;

no problem at all

 

3. null = [_veh select 2, getMarkerPos "Marker0", 35] call CBA_fnc_taskPatrol;

no problem at all

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, lordfrith said:

the waypoints shown in the video are those generated by function?

 

Yes all waypoints are generated by function.

 

Download link

 

Update, if i try to use the BIS_fnc_taskPatrol on a boat in editor they start to move slowly on the sea to some waypoint created on land position, usually to south-east direction, I suppose this is because the function is original of Arma 2, and when they create it don't take in consideration ASLW position.

 

Boat 1

Boat 2

Share this post


Link to post
Share on other sites
21 hours ago, Fr3eMan said:

Update, if i try to use the BIS_fnc_taskPatrol on a boat in editor they start to move slowly on the sea to some waypoint created on land position

 

Not tried taskPatrol on boats but from what your saying it would seem to be finding waypoints on land (so your tank doesn't drive into the sea) and may not work at all on boats, can't see anything about this in wiki though...

 

had a look at the scenario and tried out the vehicles in various locations. they do work but the tracked vehicles seem to get stuck easily. Am curious to test more but don't have much time till after the festives :D i only used TaskPatrol for basic infantry patrols.

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, lordfrith said:

Am curious to test more but don't have much time till after the festives :D i only used TaskPatrol for basic infantry patrols.

 

Now let's concentrate on festivity :drinking:

We will see on next year...

Share this post


Link to post
Share on other sites
On 29/12/2017 at 4:02 PM, davidoss said:

3. null = [_veh select 2, getMarkerPos "Marker0", 35] call CBA_fnc_taskPatrol;

no problem at all

 

 

Working fine also with unit/vehicle on sea. :thumb:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×