Jump to content
Sign in to follow this  
macnova1

NOOB struggling with BIS_fnc_taskPatrol

Recommended Posts

Hi Guys I have a random Tank mission on my new server, and i am sorry for asking this but i have read alllllll the things about BIS_fnc_taskpatrrol and Defend but im just not getting it could some one please tell me where i am suppose to but it exactly in my script I have tried waypoints and everything to no success ,

 

the mission spawns however tank just sits there

 

 


_missionVehicles = [


["O_MBT_02_cannon_F"]


];

_group1 = createGroup EAST;
_group1 setCombatMode "RED";

    

{
    _posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
    _vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
    _vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
    [_vehicle,  _posVehicle,100] call bis_fnc_taskPatrol;
    _vehicle setVectorUp surfaceNormal position _vehicle;
    createVehicleCrew _vehicle;

Share this post


Link to post
Share on other sites

The group manning the vehicle does the driving, not the vehicle itself.

_posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
_vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
_vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
_vehicle setVectorUp surfaceNormal position _vehicle;
createVehicleCrew _vehicle;
[group driver _vehicle,  _posVehicle,100] call bis_fnc_taskPatrol;

Share this post


Link to post
Share on other sites

Thank you for the quick reply i will give it a try, could i ask what iam doing wrong for this please,

 


///island units //////
_infantryUnit = [


["O_Soldier_TL_F",[8006.96,24935.3,0.0320721]],
["O_Soldier_AA_F",[7998.11,24942.4,0.0574512]],
["O_Soldier_AA_F",[7993.26,24933.6,0.233511]],
["O_Soldier_AA_F",[7986.47,24931.7,0.0890179]],
["O_Soldier_AA_F",[7987.41,24943.5,-4.3869e-005]],
["O_Soldier_AA_F",[8543.31,25041.5,0.126152]],
["O_Soldier_TL_F",[8538.26,25036.5,0.0498581]],
["O_Soldier_AA_F",[8533.31,25041.6,0.242905]],
["O_Soldier_AA_F",[8528.36,25046.6,0.266487]],
["O_Soldier_AA_F",[8530.85,25032.8,0.266968]],
["O_Soldier_TL_F",[8807.2,25176.7,0.424911]],
["O_Soldier_AA_F",[8809.42,25183.2,1.18515]],
["O_Soldier_AA_F",[8811.65,25190.1,0.767685]],
["O_Soldier_AA_F",[8813.91,25174.5,0.841133]]


];

_group1 = createGroup EAST;
_group1 setCombatMode "YELLOW";


{

_crew1 = creategroup EAST;
_airframe1 = [getMarkerPos "Marker1", 140, "B_Heli_Transport_03_black_F", _crew1] call BIS_fnc_spawnVehicle;
 
_wp1 = _crew1 addWayPoint [(getMarkerPos "Marker5"), 0];
_wp1 setWayPointType "TR UNLOAD";
_wp1 setWayPointSpeed "LIMITED";
_wp1 setWayPointStatements ["this land 'land'"];
 
_wp2 = _crew1 addWayPoint [(getmarkerpos "Marker3"), 0];
_wp2 setWayPointType "MOVE";
_wp2 setWayPointSpeed "LIMITED";
 
_wp3 = _crew1 addWayPoint [(getMarkerpos "Marker1"), 0];
_wp3 setWayPointType "MOVE";
_wp3 setWayPointSpeed "LIMITED";
_wp3 setWayPointStatements ["true", "{deleteVehicle _x;} foreach thisList + [vehicle this];"];
 
_mygroup = [getMarkerPos "Marker1", EAST, 16] call BIS_fnc_spawnGroup;

_group1 =  _mygroup addWayPoint [getMarkerPos "Marker4",0];
_group1 setWayPointType "Move"; 
_group1 setWaypointFormation "LINE";


    _unit = _group1 createUnit [(_x select 0),(_x select 1),[],0,"FORM"];
    [_unit, getpos _wp1] call BIS_fnc_taskDefend;
    _unit allowFleeing 0;

 

i am trying to get units to spawn into the helicopter in the array that did not work , i tried the SPAWGroup that worked but never unloaded and also taskdefend never worked sorry again I appreciate that help

Share this post


Link to post
Share on other sites

Hey kauppapekka tried, still the tank just sits there , the crew however do pop out the turret, do i have to create another waypoint  Sorry to bother you

 

_posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
    _vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
    _vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
    _vehicle setVectorUp surfaceNormal position _vehicle;
    createVehicleCrew _vehicle;
    [group driver _vehicle,  _posVehicle,100] call BIS_fnc_taskPatrol;

Share this post


Link to post
Share on other sites
 _vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];

 

You should post the whole code. Because from what you've posted (_x select 0) makes zero sense.

Share this post


Link to post
Share on other sites


if ((TankMissionCount < 1) && ((random 1) > .5)) then {

_pos = [[14988.9,14495.8,0],0,35000,1,0,5,0] call BIS_fnc_findSafePos;
_marker1 = createMarker ["Marker1", _pos]; 
_marker1 setMarkerType "ExileMissionModerateIcon";
_marker1 setMarkerText "Tank Mission";
_marker1 setMarkerPos _pos;

_missionVehicles = [


["O_MBT_02_cannon_F"]


];

_group1 = createGroup EAST;
_group1 setCombatMode "RED";

    

{
    _posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
    _vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
    _vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
    _vehicle setVectorUp surfaceNormal position _vehicle;
    createVehicleCrew _vehicle;
    [group Crew _vehicle, _pos,100] call BIS_fnc_taskPatrol;
            
    clearMagazineCargoGlobal _vehicle;
    clearWeaponCargoGlobal _vehicle;
    clearItemCargoGlobal _vehicle;

Share this post


Link to post
Share on other sites

fn_quicksilver thanks but that never worked either tank just sits there cmd and gnr and driver are top side but vehicle does not move 

no idea what im doing wrong...should i make another WP?

with that cmd in it

Share this post


Link to post
Share on other sites

If you don't get script errors showing up then from the Arma 3 Launcher go to Parameters -> All Parameters -> Author -> Show Script Errors and tick the box.

 

On 20.10.2017 at 4:16 PM, macnova1 said:

i am trying to get units to spawn into the helicopter in the array that did not work , i tried the SPAWGroup that worked but never unloaded and also taskdefend never worked sorry again I appreciate that help

 

https://community.bistudio.com/wiki/moveInCargo

https://community.bistudio.com/wiki/assignAsCargo

 

TaskDefend takes a group not a unit.

 

 

On 20.10.2017 at 6:04 PM, macnova1 said:

Hey kauppapekka tried, still the tank just sits there , the crew however do pop out the turret, do i have to create another waypoint  Sorry to bother you

 

If I put this into the debug and local exec the tank moves as planned.

tank = createVehicle ["B_MBT_01_TUSK_F",getPos player,[],50,"NONE"];
createVehicleCrew tank;
[group driver tank,getPos tank,100] call bis_fnc_taskPatrol;

 

So you're getting a script error or doing something to the tank or group, as this is still not the whole code regarding the spawning.

{
    _posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
    _vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
    _vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
    _vehicle setVectorUp surfaceNormal position _vehicle;
    createVehicleCrew _vehicle;
    [group Crew _vehicle, _pos,100] call BIS_fnc_taskPatrol;
            
    clearMagazineCargoGlobal _vehicle;
    clearWeaponCargoGlobal _vehicle;
    clearItemCargoGlobal _vehicle; 

Share this post


Link to post
Share on other sites

this is the whole script, i am using steamline to host the server , I get no errors in RPT , 

 

 

 

private ["_pos","_missionUnits","_group1","_missionTanks","_tanksAi","_unit","_marker1"]; 

if ((TankMissionCount < 1) && ((random 1) > .5)) then {

_pos = [[14988.9,14495.8,0],0,35000,1,0,5,0] call BIS_fnc_findSafePos;
_marker1 = createMarker ["Marker1", _pos]; 
_marker1 setMarkerType "ExileMissionModerateIcon";
_marker1 setMarkerText "Tank Mission";
_marker1 setMarkerPos _pos;

_missionVehicles = [


["O_MBT_02_cannon_F"]


];

_group1 = createGroup EAST;
_group1 setCombatMode "RED";

    

{
    _posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
_vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
_vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
_vehicle setVectorUp surfaceNormal position _vehicle;
createVehicleCrew _vehicle;
[group driver _vehicle,  _posVehicle,100] call BIS_fnc_taskPatrol;
    
        {
        [_x] joinSilent _group1;
        
        if ("ToolKit" in items _x) then {
            _x removeItems "ToolKit";
        };
        
        if ("Exile_Item_Knife" in magazines _x) then {
            _x removeMagazines "Exile_Item_Knife";
        };
        
        if ("Medikit" in items _x) then {
            _x removeItems "Medikit";
        };
        
        crew _vehicle addMPEventHandler 
        ["MPKilled",
            {

                private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

                _killed = _this select 0;
                _killer = _this select 2;

                _killingPlayer = _killer call ExileServer_util_getFragKiller;

                Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

                _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
                _amountEarned = 600;
                _newRespect = _currentRespect + _amountEarned;

                _killingPlayer setVariable ["ExileScore", _newRespect];
                //_killSummary = [];
                //_killSummary pushBack ["ENEMY FRAGGED", _amountEarned];
                //[_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
                _newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
                _newKillerFrags = _newKillerFrags + 1;
                _killingPlayer setVariable ["ExileKills", _newKillerFrags];
                format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

                format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
                _killingPlayer call ExileServer_object_player_sendStatsUpdate;

            }
        ];
    } forEach crew _vehicle;
    
    _vehicle addMPEventHandler 
    ["MPKilled",
        {

            private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

            _killed = _this select 0;
            _killer = _this select 2;

            _killingPlayer = _killer call ExileServer_util_getFragKiller;

            Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

            _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
            _amountEarned = 10000;
            _newRespect = _currentRespect + _amountEarned;

            _killingPlayer setVariable ["ExileScore", _newRespect];
            _killSummary = [];
            _killSummary pushBack ["VEHICLE DESTROYED", _amountEarned];
            [_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
            //_newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
            //_newKillerFrags = _newKillerFrags + 1;
            //_killingPlayer setVariable ["ExileKills", _newKillerFrags];
            //format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

            format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
            _killingPlayer call ExileServer_object_player_sendStatsUpdate;

        }
    ];
} forEach _missionVehicles;

    
TankMissionCount = 1;


else {
    diag_log "Tank Mission is already spawned";

Share this post


Link to post
Share on other sites
22 minutes ago, macnova1 said:

 {

        [_x] joinSilent _group1;
        .

        .

        .
 } forEach crew _vehicle;

You're making the units join the group you've created so you need to remove the earlier taskPatrol and put this after the forEach crew _vehicle.

[_group1,_posVehicle,100] call BIS_fnc_taskPatrol;

It might also work where the current taskPatrol line is as I haven't looked into empty groups and creating waypoints to them.

Share this post


Link to post
Share on other sites

this is exactly what i did and nothing happen tank still just sits there, i appreciate the help

 

 

 

private ["_pos","_missionUnits","_group1","_missionTanks","_tanksAi","_unit","_marker1"]; 

if ((TankMissionCount < 1) && ((random 1) > .5)) then {

_pos = [[14988.9,14495.8,0],0,35000,1,0,5,0] call BIS_fnc_findSafePos;
_marker1 = createMarker ["Marker1", _pos]; 
_marker1 setMarkerType "ExileMissionModerateIcon";
_marker1 setMarkerText "Tank Mission";
_marker1 setMarkerPos _pos;

_missionVehicles = [


["O_MBT_02_cannon_F"]


];

_group1 = createGroup EAST;
_group1 setCombatMode "RED";

    

{
    _posVehicle = [_pos,3,20,1,0,5,0] call BIS_fnc_findSafePos;
_vehicle = createVehicle [(_x select 0),_posVehicle,[],50,"NONE"];
_vehicle setPos [(_posVehicle select 0),(_posVehicle select 1), (_posVehicle select 2)];
_vehicle setVectorUp surfaceNormal position _vehicle;
createVehicleCrew _vehicle;

    
        {
        [_x] joinSilent _group1;
        
        if ("ToolKit" in items _x) then {
            _x removeItems "ToolKit";
        };
        
        if ("Exile_Item_Knife" in magazines _x) then {
            _x removeMagazines "Exile_Item_Knife";
        };
        
        if ("Medikit" in items _x) then {
            _x removeItems "Medikit";
        };
        
        crew _vehicle addMPEventHandler 
        ["MPKilled",
            {

                private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

                _killed = _this select 0;
                _killer = _this select 2;

                _killingPlayer = _killer call ExileServer_util_getFragKiller;

                Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

                _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
                _amountEarned = 600;
                _newRespect = _currentRespect + _amountEarned;

                _killingPlayer setVariable ["ExileScore", _newRespect];
                //_killSummary = [];
                //_killSummary pushBack ["ENEMY FRAGGED", _amountEarned];
                //[_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
                _newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
                _newKillerFrags = _newKillerFrags + 1;
                _killingPlayer setVariable ["ExileKills", _newKillerFrags];
                format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

                format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
                _killingPlayer call ExileServer_object_player_sendStatsUpdate;

            }
        ];
    } forEach crew _vehicle;
    [_group1,_posVehicle,100] call BIS_fnc_taskPatrol;
    
    _vehicle addMPEventHandler 
    ["MPKilled",
        {

            private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

            _killed = _this select 0;
            _killer = _this select 2;

            _killingPlayer = _killer call ExileServer_util_getFragKiller;

            Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

            _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
            _amountEarned = 10000;
            _newRespect = _currentRespect + _amountEarned;

            _killingPlayer setVariable ["ExileScore", _newRespect];
            _killSummary = [];
            _killSummary pushBack ["VEHICLE DESTROYED", _amountEarned];
            [_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
            //_newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
            //_newKillerFrags = _newKillerFrags + 1;
            //_killingPlayer setVariable ["ExileKills", _newKillerFrags];
            //format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

            format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
            _killingPlayer call ExileServer_object_player_sendStatsUpdate;

        }
    ];
} forEach _missionVehicles;

    
TankMissionCount = 1;


else {
    diag_log "Tank Mission is already spawned";
};

Share this post


Link to post
Share on other sites

Because you have script error(s) like:

crew _vehicle addMPEventHandler

when it should be

_x addMPEventHandler

There might be more, not starting to go through the whole code.

 

 

https://en.wikipedia.org/wiki/Debugging#Debugging_process

"- - The programmer will try to remove some parts of original test case and check if the problem still exists. - -"

 

So comment

/*
line
line
line
*/

or

//line

all the stuff that is not used in spawning the tank and making it move, and work from there.

Share this post


Link to post
Share on other sites

worked like a charm thanks kauppapekka for the massive help sorry i was a pain!!!

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  

×