Jump to content
JasonTM

[RELEASE] WAI 2.2.5

Recommended Posts

I'm now testing enemy artillery in my server, and got it working (not balanced yet)

1. Activate artillery module by adding this in dayz_server/WAI/init.sqf

Spoiler

//arty logic
ARTY_LOGIC = createAgent ["BIS_ARTY_Logic",[0,0,0],[],0,"NONE"];
enableEngineArtillery true; 
WAI_arty_fire = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\arty_fire.sqf";

(Because I use this BIS_ARTY_LOGIC for all mortars, we can use only 1 type of mortar in the the server.
I think I'd better create new BIS_ARTY_LOGIC in spawn_static.sqf and use it in arty_fire.sqf .. but I haven't tried this yet)

2. To add brain of artillery to each mortar (which you will spawn by using spawn_static function), add this into dayz_server/WAI/complie/spawn_static.sqf 's Line183 or around - where one of the static weapon is prepared for battle.

Spoiler


if(_static isKindOf "StaticMortar" || _static isKindOf "StaticCannon") exitWith {
    _static spawn WAI_arty_fire;
};

 

3. Now this is the brain of artillery. Create dayz_server/WAI/complie/arty_fire.sqf with this content

Spoiler

private ["_arty","_fmTemplate","_pos","_ammo","_battery","_time","_knowsAbout"];
_arty=_this;

ARTY_LOGIC synchronizeObjectsAdd [_arty];
[_arty] call BIS_ARTY_F_initVehicle;
[ARTY_LOGIC] call BIS_ARTY_F_Firebase;

while {alive _arty} do {
    //interval
    _time = 60 + (random 30);

    //check ammo
    if (needReload _arty == 1) then {
        _arty addMagazine "8Rnd_81mmHE_M252";
        _arty addMagazine "8Rnd_82mmHE_2B14";
        _arty addMagazine "8Rnd_81mmILLUM_M252";
        _arty addMagazine "8Rnd_82mmILLUM_2B14";
    };

    //check players
    _battery = group (gunner _arty);
    {
        //find position
        _pos = getPosASL _x;
        _pos = [(_pos select 0) - 15 + (random 30),(_pos select 1) - 15 + (random 30),_pos select 2];

        //target found or not
        _knowsAbout = _battery knowsAbout _x;
        if (_knowsAbout > 1.5 && !((vehicle _x) isKindOf "Air")) then {
            //ammo selection
            _ammo = "HE";
            if (sunOrMoon != 1 && random 1 < 0.2) then {
                _ammo="ILLUM";
            };
            _fmTemplate = ["IMMEDIATE", _ammo, 10.0/_knowsAbout, round(_knowsAbout)];

            //in range
            if ([ARTY_LOGIC, _pos, _fmTemplate select 1] call BIS_ARTY_F_PosInRange && {!isPlayer _x} count (_x nearEntities ["CAManBase", 40]) < 1) then {
                //fire
                [ARTY_LOGIC, _pos, _fmTemplate] call BIS_ARTY_F_ExecuteTemplateMission;

                sleep (random _time);
            };
        };
    } forEach playableUnits;

    sleep _time;
};

(Most settings are hard-coded here so far, and may be inbalanced)

 

Notes:

To spawn artillery, put this code in the random mission

Spoiler

[[
    [(_position select 0) - 1, (_position select 1) -27, 0]
],"2b14_82mm_GUE","Extreme",_aiType,_aiType,0,2,"Random","Random",_mission] call spawn_static;

If the mortar's group find a player, they will try to bombard him.
I think the mortar unit doesn't have good eye, so I'm combining the group to another static weapons or cars like

Spoiler

_uG1=[[
    [(_position select 0) - 0.01, (_position select 1) + 41, 0],
    [(_position select 0) + 0.1, (_position select 1) - 25, 0]
],"ZU23_CDF","Extreme","CZ_Soldier_SL_DES_EP1_DZ",_aiType,0,2,"Random","Random",_mission] call spawn_static; //This is the group of "another static weapons"
_uG2=[[
    [(_position select 0) - 1, (_position select 1) -27, 0]
],"2b14_82mm_GUE","Extreme","CZ_Soldier_SL_DES_EP1_DZ",_aiType,0,2,"Random","Random",_mission] call spawn_static; //This is artillery
(units _uG2) joinSilent _uG1;//Now 2 groups are combined

 

 

 

Share this post


Link to post
Share on other sites
28 minutes ago, Schalldampfer said:

I'm now testing enemy artillery in my server, and got it working (not balanced yet)

1. Activate artillery module by adding this in dayz_server/WAI/init.sqf

  Hide contents

//arty logic
ARTY_LOGIC = createAgent ["BIS_ARTY_Logic",[0,0,0],[],0,"NONE"];
enableEngineArtillery true; 
WAI_arty_fire = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\arty_fire.sqf";

(Because I use this BIS_ARTY_LOGIC for all mortars, we can use only 1 type of mortar in the the server.
I think I'd better create new BIS_ARTY_LOGIC in spawn_static.sqf and use it in arty_fire.sqf .. but I haven't tried this yet)

2. To add brain of artillery to each mortar (which you will spawn by using spawn_static function), add this into dayz_server/WAI/complie/spawn_static.sqf 's Line183 or around - where one of the static weapon is prepared for battle.

  Hide contents


if(_static isKindOf "StaticMortar" || _static isKindOf "StaticCannon") exitWith {
    _static spawn WAI_arty_fire;
};

 

3. Now this is the brain of artillery. Create dayz_server/WAI/complie/arty_fire.sqf with this content

  Hide contents

private ["_arty","_fmTemplate","_pos","_ammo","_battery","_time","_knowsAbout"];
_arty=_this;

ARTY_LOGIC synchronizeObjectsAdd [_arty];
[_arty] call BIS_ARTY_F_initVehicle;
[ARTY_LOGIC] call BIS_ARTY_F_Firebase;

while {alive _arty} do {
    //interval
    _time = 60 + (random 30);

    //check ammo
    if (needReload _arty == 1) then {
        _arty addMagazine "8Rnd_81mmHE_M252";
        _arty addMagazine "8Rnd_82mmHE_2B14";
        _arty addMagazine "8Rnd_81mmILLUM_M252";
        _arty addMagazine "8Rnd_82mmILLUM_2B14";
    };

    //check players
    _battery = group (gunner _arty);
    {
        //find position
        _pos = getPosASL _x;
        _pos = [(_pos select 0) - 15 + (random 30),(_pos select 1) - 15 + (random 30),_pos select 2];

        //target found or not
        _knowsAbout = _battery knowsAbout _x;
        if (_knowsAbout > 1.5 && !((vehicle _x) isKindOf "Air")) then {
            //ammo selection
            _ammo = "HE";
            if (sunOrMoon != 1 && random 1 < 0.2) then {
                _ammo="ILLUM";
            };
            _fmTemplate = ["IMMEDIATE", _ammo, 10.0/_knowsAbout, round(_knowsAbout)];

            //in range
            if ([ARTY_LOGIC, _pos, _fmTemplate select 1] call BIS_ARTY_F_PosInRange && {!isPlayer _x} count (_x nearEntities ["CAManBase", 40]) < 1) then {
                //fire
                [ARTY_LOGIC, _pos, _fmTemplate] call BIS_ARTY_F_ExecuteTemplateMission;

                sleep (random _time);
            };
        };
    } forEach playableUnits;

    sleep _time;
};

(Most settings are hard-coded here so far, and may be inbalanced)

 

Notes:

To spawn artillery, put this code in the random mission

  Hide contents

[[
    [(_position select 0) - 1, (_position select 1) -27, 0]
],"2b14_82mm_GUE","Extreme",_aiType,_aiType,0,2,"Random","Random",_mission] call spawn_static;

If the mortar's group find a player, they will try to bombard him.
I think the mortar unit doesn't have good eye, so I'm combining the group to another static weapons or cars like

  Hide contents

_uG1=[[
    [(_position select 0) - 0.01, (_position select 1) + 41, 0],
    [(_position select 0) + 0.1, (_position select 1) - 25, 0]
],"ZU23_CDF","Extreme","CZ_Soldier_SL_DES_EP1_DZ",_aiType,0,2,"Random","Random",_mission] call spawn_static; //This is the group of "another static weapons"
_uG2=[[
    [(_position select 0) - 1, (_position select 1) -27, 0]
],"2b14_82mm_GUE","Extreme","CZ_Soldier_SL_DES_EP1_DZ",_aiType,0,2,"Random","Random",_mission] call spawn_static; //This is artillery
(units _uG2) joinSilent _uG1;//Now 2 groups are combined

 

 

 

That's a pretty interesting mod, really like the idea behind it

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...