Jump to content

[RELEASE] WAI 2.2.6


JasonTM

Recommended Posts

On 3/29/2020 at 8:47 AM, Schalldampfer said:

Next, I have made a script to let AIs to fire flare at night.

1. Create this file, dayz_server/WAI/compile/flare_fire.sqf

  Reveal hidden contents

private ["_weapon","_magazine","_flareMuz","_flareMag","_mags","_interval","_grp","_unit","_pos","_invT"];

//settings
_weapon = "AK74_GL_DZ"; // Classname of weapon with GP25/M203
_flareMuz = "GP25Muzzle"; // Muzzle name of GP25/M203
_flareMag = ["FlareWhite_GP25","FlareGreen_GP25","FlareRed_GP25","FlareYellow_GP25"] call BIS_fnc_selectRandom; // Classname of flare magazine
_magazine = _weapon call find_suitable_ammunition; // Classname of normal magazine
_mags = 3; // No. of Normal magazines
_interval = 150; //Interval of firing in seconds

//_this = group;
_grp = _this;
_unit = leader _this;
if (wai_debug_mode) then {diag_log format["WAI: Preparing Flare of %1",name _unit];};

//add GP25 weapon & flare
_unit removeMagazines ((primaryWeapon _unit) call find_suitable_ammunition);
_unit removeWeapon (primaryWeapon _unit);
_unit addWeapon _weapon;
for "_i" from 1 to _mags do {
    _unit addMagazine _magazine;
};
_unit addMagazine _flareMag;

//check night and GP25
while {alive _unit} do {
    if (sunOrMoon != 1) then {
        //find target in range
        _targ = _unit;
        {
            if (alive _x && ((_grp knowsAbout _x) > 1.5 || !terrainIntersectASL [aimPos _unit,aimPos _x]) && (_unit distance _targ) < 1300) then {_targ = _x};
        } forEach playableUnits;
        //if found
        if (_targ != _unit) then {
            if (wai_debug_mode) then {diag_log format["WAI: Firing Flare on %1",name _targ];};
            //aim target pos
            _pos = getPos _targ;
            _invT = "HeliHEmpty" createVehicle _pos;
            _invT setPos [(_pos select 0)+(random 20),(_pos select 1)+(random 20),(_unit distance _targ)/10.0];
            sleep 0.5;
            _unit doTarget _invT;
            sleep 0.5;
            //fire
            _unit selectWeapon _flareMuz;
            _unit fire [_flareMuz, _flareMuz, _flareMag];
            deleteVehicle _invT;
            //refill
            _unit addMagazine _flareMag;
        };
    };

    //wait
    sleep _interval;
};

This script will add an AK74/GP25 to the leader of the group, which is the argument of this function.
He'll fire a flare round toward a player close to him at night.

2. add this in dayz_server/WAI/init.sqf

3. Now activate this script in spawn_group.sqf, to make AI to fire flare rounds.
Add this code

just before 

in dayz_server/WAI/compile/spawn_group.sqf

To limit the AI levels and gear type, I put this code instead.

 

Reference:https://forums.bohemia.net/forums/topic/106785-ai-shoots-flares-script-version-13/

I was wondering about this:

if ((_skill in ["extreme","hard","random"]) && (_gun in [0,1,"random"])) then {_unitGroup spawn WAI_flare_fire;};

Not sure what this does or what part of the spawn_group.sqf  it goes.

Does this replace existing code?

 

Thanks.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 2 months later...

Hey there,

I'm having some trouble with my static crate spawns. I'm using my config from 1.0.6.2 for my 1.0.7 server. Sometimes they load in and other times they don't. I get this error in the RPT when they don't"

_crate call wai_crate_setup;
_crate1 call wai_crate_>
16:06:52   Error position: <wai_crate_setup;
_crate1 call wai_crate_>
16:06:52   Error Undefined variable in expression: wai_crate_setup
16:06:52 File z\addons\dayz_server\WAI\static\default.sqf, line 708
16:06:53 Error in expression < + (wai_num_mags select 0))];
};
};

Does anyone know what I'm doing wrong? My crate config is below:

Thanks!

Spoiler

Place your crate spawns under this line
*/
//Skalisky
_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];

_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];

//Dichina
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];

//Devils Castle
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

//Zub Bandit Crate
//_crate5 = createVehicle //["USVehicleBox",[6546.79,5609.04,0.0015564],[],0,"CAN_COLLIDE"];

//Rog Bandit Crate (Bandit Hideout)
//_crate6 = createVehicle //["USVehicleBox",[11249.2,4282.31,0.00170898],[],0,"CAN_COLLIDE"];

//Bandit Camp Crate
//_crate7 = createVehicle //["USVehicleBox",[1633.03,4322.43,0.00134277],[],0,"CAN_COLLIDE"];

//Bandit Hilltop
_crate8 = createVehicle ["USVehicleBox",[10044.3,13380,0.00178528],[],0,"CAN_COLLIDE"];

//Bandit Oil Dump
_crate9 = createVehicle ["USVehicleBox",[2816.38,12063.6,0.00137329],[],0,"CAN_COLLIDE"];
_crate10 = createVehicle ["USVehicleBox",[2809.15,12056.1,0.00135803],[],0,"CAN_COLLIDE"];

_crate call wai_crate_setup;
_crate1 call wai_crate_setup;
_crate2 call wai_crate_setup;
_crate3 call wai_crate_setup;
_crate4 call wai_crate_setup;
//_crate5 call wai_crate_setup;
//_crate6 call wai_crate_setup;
//_crate7 call wai_crate_setup;
_crate8 call wai_crate_setup;
_crate9 call wai_crate_setup;
_crate10 call wai_crate_setup;


[_crate,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate1,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate2,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate3,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate4,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate5,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate6,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate7,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate8,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate9,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate10,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;

 

Link to comment
Share on other sites

On 5/3/2021 at 10:53 AM, Vladick said:

Hey there,

I'm having some trouble with my static crate spawns. I'm using my config from 1.0.6.2 for my 1.0.7 server. Sometimes they load in and other times they don't. I get this error in the RPT when they don't"

_crate call wai_crate_setup;
_crate1 call wai_crate_>
16:06:52   Error position: <wai_crate_setup;
_crate1 call wai_crate_>
16:06:52   Error Undefined variable in expression: wai_crate_setup
16:06:52 File z\addons\dayz_server\WAI\static\default.sqf, line 708
16:06:53 Error in expression < + (wai_num_mags select 0))];
};
};

Does anyone know what I'm doing wrong? My crate config is below:

Thanks!

  Reveal hidden contents

Place your crate spawns under this line
*/
//Skalisky
_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];

_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];

//Dichina
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];

//Devils Castle
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

//Zub Bandit Crate
//_crate5 = createVehicle //["USVehicleBox",[6546.79,5609.04,0.0015564],[],0,"CAN_COLLIDE"];

//Rog Bandit Crate (Bandit Hideout)
//_crate6 = createVehicle //["USVehicleBox",[11249.2,4282.31,0.00170898],[],0,"CAN_COLLIDE"];

//Bandit Camp Crate
//_crate7 = createVehicle //["USVehicleBox",[1633.03,4322.43,0.00134277],[],0,"CAN_COLLIDE"];

//Bandit Hilltop
_crate8 = createVehicle ["USVehicleBox",[10044.3,13380,0.00178528],[],0,"CAN_COLLIDE"];

//Bandit Oil Dump
_crate9 = createVehicle ["USVehicleBox",[2816.38,12063.6,0.00137329],[],0,"CAN_COLLIDE"];
_crate10 = createVehicle ["USVehicleBox",[2809.15,12056.1,0.00135803],[],0,"CAN_COLLIDE"];

_crate call wai_crate_setup;
_crate1 call wai_crate_setup;
_crate2 call wai_crate_setup;
_crate3 call wai_crate_setup;
_crate4 call wai_crate_setup;
//_crate5 call wai_crate_setup;
//_crate6 call wai_crate_setup;
//_crate7 call wai_crate_setup;
_crate8 call wai_crate_setup;
_crate9 call wai_crate_setup;
_crate10 call wai_crate_setup;


[_crate,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate1,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate2,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate3,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate4,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate5,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate6,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate7,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate8,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate9,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate10,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;

 

Your problem is right here:

16:06:52   Error Undefined variable in expression: wai_crate_setup

I see in your spoilered part that your crate config calls on it many times, but where is it defined?

Take a look through your old WAI files and search for wai_crate_setup and find where it was defined. As I don't have your full crate config file, I cannot look through the whole thing, but if it is defined in there, it is being defined late for the script, causing issues so it would need to be defined earlier.

Link to comment
Share on other sites

8 hours ago, Voltan said:

Your problem is right here:


16:06:52   Error Undefined variable in expression: wai_crate_setup

I see in your spoilered part that your crate config calls on it many times, but where is it defined?

Take a look through your old WAI files and search for wai_crate_setup and find where it was defined. As I don't have your full crate config file, I cannot look through the whole thing, but if it is defined in there, it is being defined late for the script, causing issues so it would need to be defined earlier.

Thanks for your help! It appears that that the wai_crate_setup code is missing. I grabbed it from another post:

 wai_crate_setup = {
        private ["_crate"];
        _crate = _this;
        _crate setVariable ["ObjectID","1",true];
        _crate setVariable ["ObjectUID", "1", true];
        _crate setVariable ["permaLoot",true];
        clearWeaponCargoGlobal _crate;
        clearMagazineCargoGlobal _crate;
        dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_crate];
        _crate addEventHandler ["HandleDamage", {}];
        _crate enableSimulation false;
  };

I will place it at the top of the default.sqf and see if that fixes it.

Thanks again!

Link to comment
Share on other sites

11 hours ago, Voltan said:

Your problem is right here:


16:06:52   Error Undefined variable in expression: wai_crate_setup

I see in your spoilered part that your crate config calls on it many times, but where is it defined?

Take a look through your old WAI files and search for wai_crate_setup and find where it was defined. As I don't have your full crate config file, I cannot look through the whole thing, but if it is defined in there, it is being defined late for the script, causing issues so it would need to be defined earlier.

Welp, it looks like that fixed the wai_crate_setup error but I am still getting a bunch of WAI crate errors. Any idea about the ones in the spoiler below?

Should I be using this to spawn crates?

[[
    [_loot,"USVehicleBox",[0,0]], // [loot variable, crate classname, 2d offsets]
    [[0,0,[3,crate_items_crop_raider],0,0],crates_large,[0,0,0]], // [loot variable, crate array, 3d offsets]
    [[0,0,0,0,0],crates_large,[0,0],60] // [loot array, crate array, 2d offsets, optional direction]
],_position] call wai_spawnCrate;

Rather than this?

_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];

_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];

//Dichina
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];

//Devils Castle
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

//Zub Bandit Crate
//_crate5 = createVehicle //["USVehicleBox",[6546.79,5609.04,0.0015564],[],0,"CAN_COLLIDE"];

//Rog Bandit Crate (Bandit Hideout)
//_crate6 = createVehicle //["USVehicleBox",[11249.2,4282.31,0.00170898],[],0,"CAN_COLLIDE"];

//Bandit Camp Crate
//_crate7 = createVehicle //["USVehicleBox",[1633.03,4322.43,0.00134277],[],0,"CAN_COLLIDE"];

//Bandit Hilltop
_crate8 = createVehicle ["USVehicleBox",[10044.3,13380,0.00178528],[],0,"CAN_COLLIDE"];

//Bandit Oil Dump
_crate9 = createVehicle ["USVehicleBox",[2816.38,12063.6,0.00137329],[],0,"CAN_COLLIDE"];
_crate10 = createVehicle ["USVehicleBox",[2809.15,12056.1,0.00135803],[],0,"CAN_COLLIDE"];

_crate call wai_crate_setup;
_crate1 call wai_crate_setup;
_crate2 call wai_crate_setup;
_crate3 call wai_crate_setup;
_crate4 call wai_crate_setup;
//_crate5 call wai_crate_setup;
//_crate6 call wai_crate_setup;
//_crate7 call wai_crate_setup;
_crate8 call wai_crate_setup;
_crate9 call wai_crate_setup;
_crate10 call wai_crate_setup;


[_crate,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate1,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate2,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate3,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate4,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate5,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate6,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate7,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate8,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate9,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate10,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;

If so, what would that look like?

Thanks again for your help.

Vladick

Spoiler

16:07:02 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:02   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:02   Error Undefined variable in expression: _num_backpacks
16:07:02 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:02 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:02   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:02   Error Zero divisor
16:07:02 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:03   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:03   Error Undefined variable in expression: _num_backpacks
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:04 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:04   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:04   Error Undefined variable in expression: _num_pistols
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:04 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:04   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:04   Error Undefined variable in expression: _num_backpacks
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:04 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:04   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:04   Error Zero divisor
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:04 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:04   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:04   Error Undefined variable in expression: _num_pistols
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138

 

Link to comment
Share on other sites

2 hours ago, Vladick said:

Welp, it looks like that fixed the wai_crate_setup error but I am still getting a bunch of WAI crate errors. Any idea about the ones in the spoiler below?

Should I be using this to spawn crates?

[[
    [_loot,"USVehicleBox",[0,0]], // [loot variable, crate classname, 2d offsets]
    [[0,0,[3,crate_items_crop_raider],0,0],crates_large,[0,0,0]], // [loot variable, crate array, 3d offsets]
    [[0,0,0,0,0],crates_large,[0,0],60] // [loot array, crate array, 2d offsets, optional direction]
],_position] call wai_spawnCrate;

Rather than this?

_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];

_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];

//Dichina
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];

//Devils Castle
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

//Zub Bandit Crate
//_crate5 = createVehicle //["USVehicleBox",[6546.79,5609.04,0.0015564],[],0,"CAN_COLLIDE"];

//Rog Bandit Crate (Bandit Hideout)
//_crate6 = createVehicle //["USVehicleBox",[11249.2,4282.31,0.00170898],[],0,"CAN_COLLIDE"];

//Bandit Camp Crate
//_crate7 = createVehicle //["USVehicleBox",[1633.03,4322.43,0.00134277],[],0,"CAN_COLLIDE"];

//Bandit Hilltop
_crate8 = createVehicle ["USVehicleBox",[10044.3,13380,0.00178528],[],0,"CAN_COLLIDE"];

//Bandit Oil Dump
_crate9 = createVehicle ["USVehicleBox",[2816.38,12063.6,0.00137329],[],0,"CAN_COLLIDE"];
_crate10 = createVehicle ["USVehicleBox",[2809.15,12056.1,0.00135803],[],0,"CAN_COLLIDE"];

_crate call wai_crate_setup;
_crate1 call wai_crate_setup;
_crate2 call wai_crate_setup;
_crate3 call wai_crate_setup;
_crate4 call wai_crate_setup;
//_crate5 call wai_crate_setup;
//_crate6 call wai_crate_setup;
//_crate7 call wai_crate_setup;
_crate8 call wai_crate_setup;
_crate9 call wai_crate_setup;
_crate10 call wai_crate_setup;


[_crate,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate1,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate2,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate3,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate4,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate5,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate6,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
//[_crate7,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate8,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;
[_crate9,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate10,[[16,ai_wep_sniper],[8,crate_tools_sniper],[4,crate_items_high_value],[]]] call dynamic_crate;

If so, what would that look like?

Thanks again for your help.

Vladick

  Reveal hidden contents

16:07:02 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:02   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:02   Error Undefined variable in expression: _num_backpacks
16:07:02 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:02 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:02   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:02   Error Zero divisor
16:07:02 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:03   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:03   Error Undefined variable in expression: _num_backpacks
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:03 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:03   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:03   Error Undefined variable in expression: _num_pistols
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:03 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:03   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:03   Error Zero divisor
16:07:03 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:04 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:04   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:04   Error Undefined variable in expression: _num_pistols
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
16:07:04 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
16:07:04   Error position: <_num_backpacks > 0) then {

for "_i" fro>
16:07:04   Error Undefined variable in expression: _num_backpacks
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
16:07:04 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
16:07:04   Error position: <select 1;
} else {
_num_pistols = _loot >
16:07:04   Error Zero divisor
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
16:07:04 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
16:07:04   Error position: <_num_pistols > 0) then {

for "_i" from >
16:07:04   Error Undefined variable in expression: _num_pistols
16:07:04 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138

 

If I was going to spawn crates in 1.0.7, I'd give Salival's crate script a go, and modify it to my needs, changing all the classnames and spawn locations etc.

https://github.com/oiad/lootCrate

Link to comment
Share on other sites

On 5/5/2021 at 7:30 PM, Voltan said:

If I was going to spawn crates in 1.0.7, I'd give Salival's crate script a go, and modify it to my needs, changing all the classnames and spawn locations etc.

https://github.com/oiad/lootCrate

Thanks for this. Although, this looks like it spawns one crate randomly between a choice of positions. I want to spawn 6 crates every restart in the same positions. Would I still use this? If so, what would that look like? Sorry, I'm not a coder. Thanks!

Link to comment
Share on other sites

@JasonTM Hey Jason. After using this on my sever for the past couple of weeks I have some feedback from a couple of players who have noticed that a couple of the new missions fail to complete, including the Bandit MV-22 Air Drop and the C-130 Air Drop. I have confirmed that even when the counter says all the AI are dead the mission fails to complete. The mission map icon remains, the mines remain and the crate does not populate. This is a problem on these missions since you need the key from the crate to unlock the vehicles.

Anyway, just passing along some feedback. Thanks for all of your hard work on this!

Vladick

Link to comment
Share on other sites

hey all i have WAI installed on my 1.0.7 server , now when some1 goes to complete a mission that has a AI armored vehicle it just blows up all the time i have no errors on the RPT. i have disabled mines to see if that sorts it but it doesn't and i also have infistar installed and even on their menu there is no log about killing a hacker etc etc..

 

any suggestions? thanks

Link to comment
Share on other sites

Hey All,

I'm getting multiple WAI errors in my RPT on startup from the dynamic_crate.sqf. Anyone know how I can fix these?

RPT Errors:

Spoiler

12:10:19 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
12:10:19   Error position: <_num_backpacks > 0) then {

for "_i" fro>
12:10:19   Error Undefined variable in expression: _num_backpacks
12:10:19 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
12:10:19 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:19   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:19   Error Zero divisor
12:10:19 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:19 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:19   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:19   Error Undefined variable in expression: _num_pistols
12:10:19 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:20 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
12:10:20   Error position: <_num_backpacks > 0) then {

for "_i" fro>
12:10:20   Error Undefined variable in expression: _num_backpacks
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
12:10:20 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:20   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:20   Error Zero divisor
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:20 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:20   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:20   Error Undefined variable in expression: _num_pistols
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:20 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:20   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:20   Error Zero divisor
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:20 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:20   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:20   Error Undefined variable in expression: _num_pistols
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:20 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:20   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:20   Error Zero divisor
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:20 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:20   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:20   Error Undefined variable in expression: _num_pistols
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:20 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:20   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:20   Error Zero divisor
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:20 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:20   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:20   Error Undefined variable in expression: _num_pistols
12:10:20 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:21 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:21   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:21   Error Zero divisor
12:10:21 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:21 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:21   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:21   Error Undefined variable in expression: _num_pistols
12:10:21 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138
12:10:21 Error in expression < + (wai_num_mags select 0))];
};
};

if(_num_backpacks > 0) then {

for "_i" fro>
12:10:21   Error position: <_num_backpacks > 0) then {

for "_i" fro>
12:10:21   Error Undefined variable in expression: _num_backpacks
12:10:21 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 148
12:10:21 Error in expression <ct 0;
_pistols_array = (_loot select 3) select 1;
} else {
_num_pistols = _loot >
12:10:21   Error position: <select 1;
} else {
_num_pistols = _loot >
12:10:21   Error Zero divisor
12:10:21 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 57
12:10:21 Error in expression <eCargoGlobal [_item,1];
};
};
};
};

if(_num_pistols > 0) then {

for "_i" from >
12:10:21   Error position: <_num_pistols > 0) then {

for "_i" from >
12:10:21   Error Undefined variable in expression: _num_pistols
12:10:21 File z\addons\dayz_server\WAI\compile\dynamic_crate.sqf, line 138

dynamic_crate.sqf:

Spoiler

private ["_multiArrItem","_multiArrWep","_loot","_vehicles","_complete","_marker","_ammo","_tool","_crate","_weapon","_item","_backpack","_num_tools","_num_items","_num_backpacks","_num_weapons","_weapons_array","_tool_array","_item_array","_backpack_array","_num_pistols","_pistols_array","_pistol","_pistolammo"];

_crate = _this select 0;
_loot = _this select 1;
if ((count _this) > 2) then {
    _complete = _this select 2;
};
_multiArrItem = false;
_multiArrWep = false;

if !(isNil "_complete") then {
    if (typeOf _crate in (crates_large + crates_medium + crates_small)) then {
        if (wai_crates_smoke && sunOrMoon == 1) then {
            _marker = "smokeShellPurple" createVehicle getPosATL _crate;
            _marker setPosATL (getPosATL _crate);
            _marker attachTo [_crate,[0,0,0]];
        };
        if (wai_crates_flares && sunOrMoon != 1) then {
            _marker = "RoadFlare" createVehicle getPosATL _crate;
            _marker setPosATL (getPosATL _crate);
            _marker attachTo [_crate, [0,0,0]];
            
            PVDZ_obj_RoadFlare = [_marker,0];
            publicVariable "PVDZ_obj_RoadFlare";
        };
    };
};

if(typeName (_loot select 0) == "ARRAY") then {
    _num_weapons = (_loot select 0) select 0;
    _weapons_array = (_loot select 0) select 1;
} else {
    _num_weapons = _loot select 0;
    _weapons_array = ai_wep_random;
    _multiArrWep = true;
};

if(typeName (_loot select 1) == "ARRAY") then {
    _num_tools = (_loot select 1) select 0;
    _tool_array = (_loot select 1) select 1;
} else {
    _num_tools = _loot select 1;
    _tool_array = crate_tools;
};

if(typeName (_loot select 2) == "ARRAY") then {
    _num_items = (_loot select 2) select 0;
    _item_array    = (_loot select 2) select 1;
} else {
    _num_items = _loot select 2;
    _item_array    = crate_items_random;
    _multiArrItem = true;
};

if(typeName (_loot select 3) == "ARRAY") then {
    _num_pistols = (_loot select 3) select 0;
    _pistols_array = (_loot select 3) select 1;
} else {
    _num_pistols = _loot select 3;
    if (WAI_Overpoch) then {
    _pistols_array = ai_wep_owpistol;
    } else {
    _pistols_array = ai_wep_pistol;
    };
};

if(typeName (_loot select 4) == "ARRAY") then {
    _num_backpacks = (_loot select 4) select 0;
    _backpack_array = (_loot select 4) select 1;
} else {
    _num_backpacks = _loot select 4;
    _backpack_array = crate_backpacks_all;
};

if(_num_weapons > 0) then {
    
    if (_multiArrWep) then {

        for "_i" from 1 to _num_weapons do {
            _weapons_array = ai_wep_random select (floor (random (count ai_wep_random)));
            _weapon = _weapons_array select (floor (random (count _weapons_array)));
            _ammo = _weapon call find_suitable_ammunition;
            _crate addWeaponCargoGlobal [_weapon,1];
            _crate addMagazineCargoGlobal [_ammo, (round(random((wai_num_mags select 1) - (wai_num_mags select 0))) + (wai_num_mags select 0))];
        };
    } else {
        
        for "_i" from 1 to _num_weapons do {
            _weapon = _weapons_array select (floor (random (count _weapons_array)));
            _ammo = _weapon call find_suitable_ammunition;
            _crate addWeaponCargoGlobal [_weapon,1];
            _crate addMagazineCargoGlobal [_ammo, (round(random((wai_num_mags select 1) - (wai_num_mags select 0))) + (wai_num_mags select 0))];
        };
    };
};

if(_num_tools > 0) then {

    for "_i" from 1 to _num_tools do {
        _tool = _tool_array select (floor (random (count _tool_array)));

        if(typeName (_tool) == "ARRAY") then {
            _crate addWeaponCargoGlobal [_tool select 0,_tool select 1];
        } else {
            _crate addWeaponCargoGlobal [_tool,1];
        };
    };
};

if(_num_items > 0) then {
    
    if (_multiArrItem) then {
        
        for "_i" from 1 to _num_items do {
            _item_array = crate_items_random select (floor (random (count crate_items_random)));
            _item = _item_array select (floor (random (count _item_array)));

            if(typeName (_item) == "ARRAY") then {
                _crate addMagazineCargoGlobal [_item select 0,_item select 1];
            } else {
                _crate addMagazineCargoGlobal [_item,1];
            };
        };
    } else {
        
        for "_i" from 1 to _num_items do {
            _item = _item_array select (floor (random (count _item_array)));

            if(typeName (_item) == "ARRAY") then {
                _crate addMagazineCargoGlobal [_item select 0,_item select 1];
            } else {
                _crate addMagazineCargoGlobal [_item,1];
            };
        };
    };
};

if(_num_pistols > 0) then {

    for "_i" from 1 to _num_pistols do {
        _pistol = _pistols_array select (floor (random (count _pistols_array)));
        _pistolammo = _pistol call find_suitable_ammunition;
        _crate addWeaponCargoGlobal [_pistol,1];
        _crate addMagazineCargoGlobal [_pistolammo, (round(random((wai_num_mags select 1) - (wai_num_mags select 0))) + (wai_num_mags select 0))];
    };
};

if(_num_backpacks > 0) then {

    for "_i" from 1 to _num_backpacks do {
        _backpack = _backpack_array select (floor (random (count _backpack_array)));

        if(typeName (_backpack) == "ARRAY") then {
            _crate addBackpackCargoGlobal [_backpack select 0,_backpack select 1];
        } else {
            _crate addBackpackCargoGlobal [_backpack,1];
        };
    };
};

if (wai_high_value_chance > 0) then {

    if(random 100 < wai_high_value_chance) then {
        _item = crate_items_high_value select (floor (random (count crate_items_high_value)));
        _crate addMagazineCargoGlobal [_item,1];
    };
};

if(wai_debug_mode) then {
    diag_log format["WAI: Spawning in a dynamic crate with %1 guns, %2 tools, %3 items and %4 pistols and %5 backpacks",_num_weapons,_num_tools,_num_items,_num_pistols,_num_backpacks];
};
 

Thanks for any help you can give!

Vlad

Link to comment
Share on other sites

On 5/19/2021 at 9:34 PM, houst said:

hey all i have WAI installed on my 1.0.7 server , now when some1 goes to complete a mission that has a AI armored vehicle it just blows up all the time i have no errors on the RPT. i have disabled mines to see if that sorts it but it doesn't and i also have infistar installed and even on their menu there is no log about killing a hacker etc etc..

 

any suggestions? thanks

I also had the issue even in 1.0.6.2.
I added logs to "Killed" EventHandler but there was no valuable logs there

Link to comment
Share on other sites

Hi

I recently installed this on my DZE 1.0.7 server and nothing is happening, i have followed the instructions for installing this on the server and played for a few hours but no missions have spawned and nothing is out put to the web console. as far as i can tell its like the server is ignoring this line "execVM "\z\addons\dayz_server\WAI\init.sqf"; I'm hosting on GTX if that has an impact. it worked on an older server but not since the upgrade.

Thanks for any help

 

Link to comment
Share on other sites

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
  • Advertisement
×
×
  • Create New...