ARMA 3 - MISSION EDITING & SCRIPTING Arma 3 - BIS_fnc_stalk
Arma 3 - BIS_fnc_stalk
Quelle: Gametwitter.de Forum | views: 2531

Das ist doch mal eine nette Bi-Funktion: BIS_fnc_stalk.

(Siehe auch BIS_fnc_stalk)

Vor allem dann, wenn man einem Ziel, in meinem Fall einem zufällig gewähltem Spieler von der AI verfolgen lassen möchte. Man baut sich hier zu z.B. eine oder diverse Feindgruppen auf, lässt diese spawnen und dann ruft man die Funktion mit der jeweiligen Gruppe und dem Ziel auf.

In diesem Beispiel stelle ich auch sicher, das die Feindeinheit auf ein mögliches Bodenziel geht.

In meinem Beispiel , sieht es wie folgt, in meiner GT_playerHunt.sqf, aus:

Die hier verwendeten GM Einheiten sind natürlich je nach Bedürfnis austauschbar ;)

if (!isServer) exitWith {};

private _randomTarget = selectRandom (allPlayers - entities "HeadlessClient_F");


if ((isTouchingGround _randomTarget) && _randomTarget distance (getMarkerPos "respawn_west") < 500) then{
 _playerPos = getpos _randomTarget;


 _enemyTankGroup =["gm_gc_army_t55a","gm_gc_army_t55am2b","gm_gc_army_pt76b"];
 _enemyCarGroup = ["gm_gc_army_uaz469_spg9","gm_pl_army_uaz469_dshkm"];


_enemyTank = selectRandom ["gm_gc_army_t55a","gm_gc_army_t55am2b","gm_gc_army_pt76b","gm_pl_army_t55ak","gm_pl_army_t55"];
_enemyCar  = selectRandom ["gm_gc_army_uaz469_spg9","gm_pl_army_uaz469_dshkm"];


_condition = selectRandom [1,2,3,4,5,6];


switch (_condition) do {
            case 1: {
                //Tankgroup    
                {                
                    _tank = _x;
                    _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                    _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;
                    
                    _grppatrol = createGroup EAST;
                    _grppatrol = [_position, EAST, [_tank],[],[],[],[],[],180] call BIS_fnc_spawnGroup;

                    _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
                    
                } forEach _enemyTankGroup;
                
            };
            
            case 2: {
                //singleTank
                _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;

                _grppatrol = createGroup EAST;
                _grppatrol = [_position, EAST, [_enemyTank],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
                _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
            };
            case 3: {
                //small infgroup
                _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;
                
                _grppatrol = createGroup EAST;
                _grppatrol = [_position, EAST, ["gm_gc_army_squadleader_mpiak74n_80_str",
                            "gm_gc_army_machinegunner_assistant_mpiak74n_lmgrpk74_80_str",
                            "gm_gc_army_antitank_mpiak74n_rpg7_80_str",
                            "gm_gc_army_antitank_assistant_mpiak74n_rpg7_80_str",                            
                            "gm_gc_army_sf_antitank_mpikms72_rpg7_80_str",                    
                            "gm_gc_bgs_rifleman_mpikm72_80_str",
                            "gm_gc_bgs_rifleman_mpikm72_80_str"]] call BIS_fnc_spawnGroup;
                _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
            };
            case 4: {
                //big infgroup
                _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;
                
                _grppatrol = createGroup EAST;
                _grppatrol = [_position, EAST, ["gm_gc_army_squadleader_mpiak74n_80_str",
                                    "gm_gc_army_rifleman_mpiak74n_80_str",
                                    "gm_gc_army_rifleman_mpiak74n_80_str",
                                    "gm_gc_army_machinegunner_lmgrpk74_80_str",
                                    "gm_gc_army_machinegunner_assistant_mpiak74n_lmgrpk74_80_str",
                                    "gm_gc_army_antitank_mpiak74n_rpg7_80_str",
                                    "gm_gc_army_antitank_assistant_mpiak74n_rpg7_80_str",
                                    "gm_gc_army_rifleman_mpiak74n_80_str",
                                    "gm_gc_army_rifleman_mpiak74n_80_str",
                                    "gm_gc_army_sf_squadleader_mpikms72_80_str",
                                    "gm_gc_army_sf_machinegunner_lmgrpk_80_str",
                                    "gm_gc_army_sf_marksman_svd_80_str",
                                    "gm_gc_army_sf_antitank_mpikms72_rpg7_80_str",
                                    "gm_gc_army_sf_demolition_pm63_80_str",
                                    "gm_gc_army_sf_rifleman_pm63_80_str",
                                    "gm_gc_bgs_rifleman_mpikm72_80_str",
                                    "gm_gc_bgs_rifleman_mpikm72_80_str"]] call BIS_fnc_spawnGroup;
                _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
            };
            case 5: {
                //single car
                _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;

                _grppatrol = createGroup EAST;
                _grppatrol = [_position, EAST, [_enemyCar],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
                _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
            };
            case 6:{
                //multiple cars
                {                
                    _car = _x;
                    _grade = [330,345,0,15,45] call BIS_fnc_selectRandom;
                    _position = [(getpos _randomTarget), (800 + random 250), _grade] call BIS_fnc_relPos;
                    
                    _grppatrol = createGroup EAST;
                    _grppatrol = [_position, EAST, [_car],[],[],[],[],[],180] call BIS_fnc_spawnGroup;

                    _stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;
                    
                } forEach _enemyCarGroup;
            };
            default {
                hint "No Reinforcements"
            };
        };
    
    };   

Wie ihr Eure Feinde auf die Karte bringt natürlich Euer Ding, einsetzten braucht ihr dann nur

_stalking = [_grppatrol, group _randomTarget] spawn BIS_fnc_stalk;

Eine Kommentarfunktion ist in diesem Blog nicht vorgesehen.
Bei Problemen zum Skript bitte im Gametwitter.de Forum registieren und dort die Kommentarfunktion nutzen.