Jump to content
Persian MO

how to terminate bis_taskPatrol

Recommended Posts

I'm looking for a way to stop task patrol for helicopter  and then add a waypoint to it.

Tried  terminate https://community.bistudio.com/wiki/terminateand  bis_fnc_taskPatrol--terminate, no luck.

 

here is my script:

_heliList = [

"O_Heli_Light_02_v2_F",
"O_Heli_Attack_02_black_F",
"RHS_Mi24V_UPK23_vdv",
"RHS_Mi8MTV3_UPK23_vdv",
"RHS_Ka52_vvsc"

] call BIS_fnc_selectRandom;

_heli = createVehicle [_heliList, getpos _startpos, [], 0, "CAN_COLLIDE"];
_heli setdir 241;
_grp = createGroup East;
"rhs_vdv_flora_crew" createUnit [getpos _startpos, _grp, " this MoveinDriver _heli",0.5,"SEARGENT"];


scriptp = [_grp, _patrolpos] execVM "events\gunShipPatrol\patrol.sqf";



sleep 30;

terminate scriptp;

sleep 10;



_wp = _grp addWaypoint [getpos exitArea, 50];
_wp setWaypointSpeed "FULL";
_wp setWaypointType "MOVE"; 
_wp setWaypointBehaviour "CARELESS";

Share this post


Link to post
Share on other sites

Use a variable to control the exit state of patrol.sqf.

Implementation depends on how the patrol.sqf looks like.

No idea why you're referring to bis_fnc_taskPatrol though, doesn't show up anywhere in your script.

 

Cheers

Share this post


Link to post
Share on other sites
"this MoveinDriver _heli"

Is that condition really working?

Share this post


Link to post
Share on other sites

 

"this MoveinDriver _heli"

Is that condition really working?

 

yes.it working.

 

 

Use a variable to control the exit state of patrol.sqf.

Implementation depends on how the patrol.sqf looks like.

No idea why you're referring to bis_fnc_taskPatrol though, doesn't show up anywhere in your script.

 

Cheers

ok.

here is patrol.sqf.i forgot to it. :)

if !(isserver) exitWith {};


private ["_grp","_area","_wp","_pos"];


_grp = _this select 0;
_area = _this select 1;



[_grp, _area, 500] call bis_fnc_taskPatrol;

I read somewhere if i make a script , later i can terminate it with the command but the helicopter will not exit from taskpatrol loop.

Share this post


Link to post
Share on other sites

All bis_fnc_taskPatrol does it to create a few random waypoints.

while {(count (waypoints _group)) > 0} do { deleteWaypoint ((waypoints _group) select 0); };

Should do the trick.

  • Like 1

Share this post


Link to post
Share on other sites

All BIS_fnc_taskPatrol does is add a few waypoints to the group with the last being a CYCLE.

Just grab the groups last waypoint and re-appropriate it.

_heliList = [
	"O_Heli_Light_02_v2_F",
	"O_Heli_Attack_02_black_F",
	"RHS_Mi24V_UPK23_vdv",
	"RHS_Mi8MTV3_UPK23_vdv",
	"RHS_Ka52_vvsc"
] call BIS_fnc_selectRandom;

_heli = createVehicle [_heliList, getPos _startpos, [], 0, "CAN_COLLIDE"];
_heli setDir 241;
_grp = createGroup east;
"rhs_vdv_flora_crew" createUnit [getPos _startpos, _grp, " this MoveinDriver _heli",0.5,"SEARGENT"];


_nul = [_grp, _patrolpos] execVM "events\gunShipPatrol\patrol.sqf";

sleep 30;

_lastWP = waypoints _grp select (( count waypoints _grp ) -1 );

_lastWP setWaypointPosition [getPos exitArea, 50];
_lastWP setWaypointSpeed "FULL";
_lastWP setWaypointType "MOVE"; 
_lastWP setWaypointBehaviour "CARELESS";
As soon as they have finished their current patrol they will follow the new waypoint.

If you need them to exit their patrol immediately then just add a waypoint and set it as their current..

_nul = [_grp, _patrolpos] execVM "events\gunShipPatrol\patrol.sqf";

sleep 30;

_newWP = _grp addWaypoint [ getPos exitArea, 50 ];
_newWP setWaypointSpeed "FULL";
_newWP setWaypointType "MOVE"; 
_newWP setWaypointBehaviour "CARELESS";

_grp setCurrentWaypoint _newWP;
  • Like 2

Share this post


Link to post
Share on other sites

All BIS_fnc_taskPatrol does is add a few waypoints to the group with the last being a CYCLE.

Just grab the groups last waypoint and re-appropriate it.

_heliList = [
	"O_Heli_Light_02_v2_F",
	"O_Heli_Attack_02_black_F",
	"RHS_Mi24V_UPK23_vdv",
	"RHS_Mi8MTV3_UPK23_vdv",
	"RHS_Ka52_vvsc"
] call BIS_fnc_selectRandom;

_heli = createVehicle [_heliList, getPos _startpos, [], 0, "CAN_COLLIDE"];
_heli setDir 241;
_grp = createGroup east;
"rhs_vdv_flora_crew" createUnit [getPos _startpos, _grp, " this MoveinDriver _heli",0.5,"SEARGENT"];


_nul = [_grp, _patrolpos] execVM "events\gunShipPatrol\patrol.sqf";

sleep 30;

_lastWP = waypoints _grp select (( count waypoints _grp ) -1 );

_lastWP setWaypointPosition [getPos exitArea, 50];
_lastWP setWaypointSpeed "FULL";
_lastWP setWaypointType "MOVE"; 
_lastWP setWaypointBehaviour "CARELESS";
As soon as they have finished their current patrol they will follow the new waypoint.

If you need them to exit their patrol immediately then just add a waypoint and set it as their current..

_nul = [_grp, _patrolpos] execVM "events\gunShipPatrol\patrol.sqf";

sleep 30;

_newWP = _grp addWaypoint [ getPos exitArea, 50 ];
_newWP setWaypointSpeed "FULL";
_newWP setWaypointType "MOVE"; 
_newWP setWaypointBehaviour "CARELESS";

_grp setCurrentWaypoint _newWP;

Thanks alot.It working , finally!

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

×