Jump to content
  • 0

Epoch 1051 WAI Error.


Voltan

Question

Hey guys, (@salival hoping you can assist here buddy)

I will preface this by saying that I am using Epoch 1.0.5.1 and server files provided by @Ultima_weapon

I am getting this error in my console from WAI:

Spoiler

23:44:49 Error in expression <{_aiweapon};

_magazine     = _weapon     call find_suitable_ammunition;

};

 

call {

if(>

23:44:49   Error position: <find_suitable_ammunition;

};

 

call {

if(>

23:44:49   Error Undefined variable in expression: find_suitable_ammunition

23:44:49 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 84
23:44:50 Error in expression < from 1 to _mags do {

_unit addMagazine _magazine;

};

_unit addweapon _weapon;

_>

23:44:50   Error position: <_magazine;

};

_unit addweapon _weapon;

_>

23:44:50   Error Undefined variable in expression: _magazine

23:44:50 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 147

23:44:50 "WAI: Spawned a group of 3 AI (Hero) at [8197.29,1853.48,0]"

23:44:50 Error in expression <selectRandom;

_magazine     = _weapon call find_suitable_ammunition;

 

call {

if(typ>

23:44:50   Error position: <find_suitable_ammunition;

 

call {

if(typ>

23:44:50   Error Undefined variable in expression: find_suitable_ammunition

23:44:50 File z\addons\dayz_server\WAI\compile\spawn_static.sqf, line 102

I found something related here on page 7 here:

https://epochmod.com/forum/topic/43666-release-wicked-ai-223-106/page/7/

But this did not fix my issue.

Here is the spawn_group.sqf:

Spoiler

/*
    Modified by Ultima-weapon
    Ultima-Weapon's Universe [UwU]
   http://ultima-weapons-universe.enjin.com/
*/

if (isServer) then {

    private ["_rocket","_launcher","_pos_x","_pos_y","_pos_z","_aiskin","_unarmed","_current_time","_gain","_mission","_ainum","_aitype","_mission","_aipack","_aicskill","_position","_unitnumber","_skill","_gun","_mags","_backpack","_skin","_gear","_aiweapon","_aigear","_aiskin","_skillarray","_unitGroup","_weapon","_magazine","_gearmagazines","_geartools","_unit","_cash"];

    _position             = _this select 0;
    _pos_x             = _position select 0;
    _pos_y             = _position select 1;
    _pos_z             = _position select 2;
    _unitnumber         = _this select 1;
    _skill                 = _this select 2;
    _gun                 = _this select 3;
    _mags                 = _this select 4;
    _backpack             = _this select 5;
    _skin                 = _this select 6;
    _gear                 = _this select 7;
    _aitype                = _this select 8;
    
    if (typeName _gun == "ARRAY") then {
        _launcher        = _gun select 1;
        _gun            = _gun select 0;
    };

    if (typeName _aitype == "ARRAY") then {
        _gain             = _aitype select 1;
        _aitype         = _aitype select 0;
    };
    
    if (count _this > 9) then {
        _mission = _this select 9;
    } else {
        _mission = nil;
    };

    _aiweapon             = [];
    _aigear             = [];
    _aiskin             = "";
    _aicskill             = [];
    _aipack             = "";
    _current_time        = time;
    _unarmed            = false;

    if(_aitype == "Hero") then {
        _unitGroup    = createGroup RESISTANCE;
    } else {
        _unitGroup    = createGroup EAST;
    };

    if(_pos_z == 0) then {
        if(floor(random 2) == 1) then {
            _pos_x = _pos_x - (5 + random(25));
        } else {
            _pos_x = _pos_x + (5 + random(25));
        };            

        if(floor(random 2) == 1) then {
            _pos_y = _pos_y - (5 + random(25));
        } else {
            _pos_y = _pos_y + (5 + random(25));
        };
    };

    for "_x" from 1 to _unitnumber do {

        call {
            if(typeName(_gun) == "SCALAR") then {
                if(_gun == 0)             exitWith { _aiweapon = ai_wep_assault; };
                if(_gun == 1)             exitWith { _aiweapon = ai_wep_machine; };
                if(_gun == 2)             exitWith { _aiweapon = ai_wep_sniper; };
            } else {
                if(_gun == "random")     exitWith { _aiweapon = ai_wep_random call BIS_fnc_selectRandom; };
                if(_gun == "unarmed")     exitWith { _unarmed = true; };
                _aiweapon = _gun;
            }
        };

        if (!_unarmed) then {
            _weapon     = if (typeName (_aiweapon) == "ARRAY") then {_aiweapon call BIS_fnc_selectRandom} else {_aiweapon};
            _magazine     = _weapon     call find_suitable_ammunition;
        };

        call {
            if(typeName(_gear) == "SCALAR") then {
                if(_gear == 0)             exitWith { _aigear = ai_gear0; };
                if(_gear == 1)             exitWith { _aigear = ai_gear1; };
            } else {
                if(_gear == "random")     exitWith { _aigear = ai_gear_random call BIS_fnc_selectRandom; };
            };
        };
        
        _gearmagazines     = _aigear select 0;
        _geartools         = _aigear select 1;

        call {
            if(_skin == "random")     exitWith { _aiskin = ai_all_skin         call BIS_fnc_selectRandom; };
            if(_skin == "hero")     exitWith { _aiskin = ai_hero_skin         call BIS_fnc_selectRandom; };
            if(_skin == "bandit")     exitWith { _aiskin = ai_bandit_skin     call BIS_fnc_selectRandom; };
            if(_skin == "special")     exitWith { _aiskin = ai_special_skin     call BIS_fnc_selectRandom; };
            _aiskin = _skin;
        };

        if(typeName _aiskin == "ARRAY") then {
            _aiskin = _aiskin call BIS_fnc_selectRandom;
        };

        _unit = _unitGroup createUnit [_aiskin,[_pos_x,_pos_y,_pos_z],[],0,"CAN COLLIDE"];
        [_unit] joinSilent _unitGroup;

        call {
            if(_aitype == "hero")         exitWith { _unit setVariable ["Hero",true]; _unit setVariable ["humanity", ai_remove_humanity]; };
            if(_aitype == "bandit")     exitWith { _unit setVariable ["Bandit",true]; _unit setVariable ["humanity", ai_add_humanity]; };
            if(_aitype == "special")     exitWith { _unit setVariable ["Special",true]; _unit setVariable ["humanity", ai_special_humanity]; };
        };

        if (!isNil "_gain") then { _unit setVariable ["humanity", _gain]; };

        call {
            if(_backpack == "random")     exitWith { _aipack = ai_packs call BIS_fnc_selectRandom; };
            if(_backpack == "none")     exitWith { };
            _aipack = _backpack;
        };
        
        if (isNil "_mission") then {
        
            _unit enableAI "TARGET";
            _unit enableAI "AUTOTARGET";
            _unit enableAI "MOVE";
            _unit enableAI "ANIM";
            _unit enableAI "FSM";
        
        };

        removeAllWeapons _unit;
        removeAllItems _unit;

        if (sunOrMoon != 1) then {
            _unit addweapon "NVGoggles";
        };

        if (!_unarmed) then {
            for "_i" from 1 to _mags do {
                _unit addMagazine _magazine;
            };
            _unit addweapon _weapon;
            _unit selectWeapon _weapon;
        };

        if(_backpack != "none") then {
            _unit addBackpack _aipack;
        };

        {
            _unit addMagazine _x
        } count _gearmagazines;

        {
            _unit addweapon _x
        } count _geartools;
        
        //Single Currency
        _cash = round(random 20) * 1000; // number between 0 and 20 000
        _unit setVariable["CashMoney",_cash ,true];
        
        call {
            if(_skill == "supereasy")     exitWith { _aicskill = ai_skill_supereasy; };
            if(_skill == "easy")         exitWith { _aicskill = ai_skill_easy; };
            if(_skill == "medium")         exitWith { _aicskill = ai_skill_medium; };
            if(_skill == "hard")         exitWith { _aicskill = ai_skill_hard; };
            if(_skill == "extreme")     exitWith { _aicskill = ai_skill_extreme; };
            if(_skill == "random")         exitWith { _aicskill = ai_skill_random call BIS_fnc_selectRandom; };
            _aicskill = ai_skill_random call BIS_fnc_selectRandom;
        };

        {
            _unit setSkill [(_x select 0),(_x select 1)]
        } count _aicskill;
        
        ai_ground_units = (ai_ground_units + 1);

        _unit addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}];

        if (!isNil "_mission") then {
            wai_mission_data select _mission set [0, (((wai_mission_data select _mission) select 0) + 1)];
            _unit setVariable ["missionclean", "ground"];
            _unit setVariable ["mission", _mission, true];
        };

    };

    if (!isNil "_launcher" && wai_use_launchers) then {
        call {
            //if (_launcher == "Random") exitWith { _launcher = (ai_launchers_AT + ai_launchers_AA) call BIS_fnc_selectRandom; };
            if (_launcher == "at") exitWith { _launcher = ai_wep_launchers_AT call BIS_fnc_selectRandom; };
            if (_launcher == "aa") exitWith { _launcher = ai_wep_launchers_AA call BIS_fnc_selectRandom; };
        };
        _rocket = _launcher call find_suitable_ammunition;
        _unit addMagazine _rocket;
        _unit addMagazine _rocket;
        _unit addWeapon _launcher;
    };

    _unitGroup setFormation "ECH LEFT";
    _unitGroup selectLeader ((units _unitGroup) select 0);

    if(_aitype == "Hero") then {
        if (!isNil "_mission") then {
            [_unitGroup, _mission] spawn hero_behaviour;
        } else {
            [_unitGroup] spawn hero_behaviour;
        };
    } else {
        if (!isNil "_mission") then {
            [_unitGroup, _mission] spawn bandit_behaviour;
        } else {
            [_unitGroup] spawn bandit_behaviour;
        };
    };

    if(_pos_z == 0) then {
        [_unitGroup,[_pos_x,_pos_y,_pos_z],_skill] spawn group_waypoints;
    };

    diag_log format ["WAI: Spawned a group of %1 AI (%3) at %2",_unitnumber,_position,_aitype];
    
    _unitGroup
};

and the spawn_static.sqf:

Spoiler

/*
    Modified by Ultima-weapon
    Ultima-Weapon's Universe [UwU]
   http://ultima-weapons-universe.enjin.com/
*/

if (isServer) then {

    private ["_ainum","_unarmed","_aicskill","_aitype","_mission","_aipack","_class","_position2","_static","_position","_unitnumber","_skill","_gun","_mags","_backpack","_skin","_gear","_aiweapon","_aigear","_aiskin","_skillarray","_unitGroup","_weapon","_magazine","_gearmagazines","_geartools","_unit"];

    _position             = _this select 0;
    _class                 = _this select 1;
    _skill                 = _this select 2;
    _skin                 = _this select 3;
    _aitype                = _this select 4;

    if (ai_static_useweapon) then {
        _gun             = _this select 5;
        _mags             = _this select 6;
        _backpack         = _this select 7;
        _gear             = _this select 8;
    };
    
    if ((count _this == 10) OR (count _this == 6)) then {
        if (count _this == 10)     then { _mission = _this select 9; };
        if (count _this == 6)     then { _mission = _this select 5; };
    } else {
        _mission = nil;
    };

    _position2         = [];
    _aiweapon         = [];
    _aigear         = [];
    _aiskin         = "";
    _aipack         = "";
    _unitnumber     = count _position;

    if(_aitype == "Hero") then {
        _unitGroup    = createGroup RESISTANCE;
    } else {
        _unitGroup    = createGroup EAST;
    };
    
    if (!isServer) exitWith {};

    {
        _position2 = _x;

        call {
            if(_skin == "random")     exitWith { _aiskin = ai_all_skin call BIS_fnc_selectRandom; };
            if(_skin == "hero")     exitWith { _aiskin = ai_hero_skin call BIS_fnc_selectRandom; };
            if(_skin == "bandit")     exitWith { _aiskin = ai_bandit_skin call BIS_fnc_selectRandom; };
            if(_skin == "special")     exitWith { _aiskin = ai_special_skin call BIS_fnc_selectRandom; };
            _aiskin = _skin;
        };
        
        if(typeName _aiskin == "ARRAY") then {
            _aiskin = _aiskin call BIS_fnc_selectRandom;
        };

        call {
            if (_class == "Random") exitWith { _class = ai_static_weapons call BIS_fnc_selectRandom; };
        };

        _unit = _unitGroup createUnit [_aiskin, [0,0,0], [], 10, "PRIVATE"];
        
        _static = createVehicle [_class, [(_position2 select 0),(_position2 select 1),(_position2 select 2)], [], 0, "CAN_COLLIDE"];
        _static setDir round(random 360);
        _static setPos [(_position2 select 0),(_position2 select 1),(_position2 select 2)];
        
        [_unit] joinSilent _unitGroup;

        call {
            if(_aitype == "hero")         exitWith { _unit setVariable ["Hero",true,true]; };
            if(_aitype == "bandit")     exitWith { _unit setVariable ["Bandit",true,true]; };
            if(_aitype == "special")     exitWith { _unit setVariable ["Special",true,true]; };
        };
        
        _unit enableAI "TARGET";
        _unit enableAI "AUTOTARGET";
        _unit enableAI "MOVE";
        _unit enableAI "ANIM";
        _unit enableAI "FSM";
        
        removeAllWeapons _unit;
        removeAllItems _unit;
        
        if (ai_static_useweapon) then {
        
            call {
                if(typeName(_gun) == "SCALAR") then {
                    if(_gun == 0)             exitWith { _aiweapon = ai_wep_assault; };
                    if(_gun == 1)             exitWith { _aiweapon = ai_wep_machine; };
                    if(_gun == 2)             exitWith { _aiweapon = ai_wep_sniper; };
                } else {
                    if(_gun == "random")     exitWith { _aiweapon = ai_wep_random call BIS_fnc_selectRandom; };
                    if(_gun == "unarmed")     exitWith { _unarmed = true; };
                };
            };

            _weapon     = _aiweapon call BIS_fnc_selectRandom;
            _magazine     = _weapon call find_suitable_ammunition;
            
            call {
                if(typeName(_gear) == "SCALAR") then {
                    if(_gear == 0)             exitWith { _aigear = ai_gear0; };
                    if(_gear == 1)             exitWith { _aigear = ai_gear1; };
                } else {
                    if(_gear == "random")     exitWith { _aigear = ai_gear_random call BIS_fnc_selectRandom; };
                };
            };

            call {
                if(_backpack == "random")     exitWith { _aipack = ai_packs call BIS_fnc_selectRandom; };
                if(_backpack == "none")     exitWith { };
                _aipack = _backpack;
            };

            _gearmagazines         = _aigear select 0;
            _geartools             = _aigear select 1;
            _unit                 addweapon _weapon;

            for "_i" from 1 to _mags do {
                _unit addMagazine _magazine;
            };

            if(_backpack != "none") then {
                _unit addBackpack _aipack;
            };

            {
                _unit addMagazine _x
            } count _gearmagazines;

            {
                _unit addweapon _x
            } count _geartools;
        };
        
        if (ai_static_skills) then {

            {
                _unit setSkill [(_x select 0),(_x select 1)]
            } count ai_static_array;

        } else {

            call {
                if(_skill == "supereasy")     exitWith { _aicskill = ai_skill_supereasy; };
                if(_skill == "easy")         exitWith { _aicskill = ai_skill_easy; };
                if(_skill == "medium")         exitWith { _aicskill = ai_skill_medium; };
                if(_skill == "hard")         exitWith { _aicskill = ai_skill_hard; };
                if(_skill == "extreme")     exitWith { _aicskill = ai_skill_extreme; };
                if(_skill == "random")         exitWith { _aicskill = ai_skill_random call BIS_fnc_selectRandom; };
                _aicskill = ai_skill_random call BIS_fnc_selectRandom;
            };

            {
                _unit setSkill [(_x select 0),(_x select 1)]
            } count _aicskill;
        };
        
        ai_emplacement_units = (ai_emplacement_units + 1);
        _unit addEventHandler ["Killed",{[_this select 0, _this select 1, "static"] call on_kill;}];
        _static addEventHandler ["GetOut",{(_this select 0) setDamage 1;}];
        PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_static];
            
        if (sunOrMoon != 1) then {
            _unit addweapon "NVGoggles";
        };
        
        _unit moveingunner _static;

        if (!isNil "_mission") then {
            _ainum = (wai_mission_data select _mission) select 0;
            wai_mission_data select _mission set [0, (_ainum + 1)];
            _static setVariable ["missionclean","static"];
            _static setVariable ["mission",_mission];
            _unit setVariable ["mission",_mission];
        };

        [_static] spawn vehicle_monitor;

    } forEach _position;

    _unitGroup selectLeader ((units _unitGroup) select 0);

    if(_aitype == "Hero") then {
        if (!isNil "_mission") then {
            [_unitGroup, _mission] spawn hero_behaviour;
        } else {
            [_unitGroup] spawn hero_behaviour;
        };
    } else {
        if (!isNil "_mission") then {
            [_unitGroup, _mission] spawn bandit_behaviour;
        } else {
            [_unitGroup] spawn bandit_behaviour;
        };
    };

    diag_log format ["WAI: Spawned in %1 %2",_unitnumber,_class];

    _unitGroup
};

Anyone know what could cause this?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...