Jump to content

Re-Worked WAI 0.173 - Supported System


Recommended Posts

Dayz Overpoch 1.0.5.1 steam patch 125548

My report is spamming this

Arma2oaserverrpt

if ((_mission) AND (clean_running_mission)) then {
_veh setD>
20:41:25   Error position: <clean_running_mission)) then {
_veh setD>
20:41:25   Error Undefined variable in expression: clean_running_mission
20:41:25 File z\addons\dayz_server\WAI\compile\vehicle_monitor.sqf, line 17
20:41:26 Error in expression <illedat", time];
};


COde as shown in the file



if (!isServer) exitWith {};
private ["_mission","_veh"];
_veh = _this select 0;
if (count _this == 2) then {
    _mission = _this select 1;
} else {
    _mission = false;
};
waitUntil { count crew _veh > 0};
while {(alive _veh) and ({alive _x} count crew _veh > 0)} do {
    _veh setVehicleAmmo 1;
    _veh setFuel 1;
    if ({alive _x} count crew _veh == 0) then {
        _veh setDamage 1;
        _veh setVariable ["killedat", time];
    };
    if ((_mission) AND (clean_running_mission)) then {
        _veh setDamage 1;
        _veh setVariable ["killedat", time];
    };
    sleep 30;
};
_veh setDamage 1;
_veh setVariable ["killedat", time];

Link to comment
Share on other sites

 

General Editing and Common Questions: 

 

Changing time: 

By the way this is pulled straight from the old forum!

Thank you Tarvin!

For mission timing edit the file file -> missionCfg.sqf

// Time between missions (seconds)

wai_mission_timer = 300; // = 300 sec = 5 min; 900 sec = 15 min; it time to start first mission after server start and next mission after start previous

// How long before a mission times out (seconds)

wai_mission_timeout = 1200; // = 1200 sec = 20 min; 1800 sec = 30 min; it's time to clear mission loot after start

The number is calculated in seconds. So to work out something you want you take 60 and multiply by how many minutes you want.

e.g. 60 (seconds) X 20 = 1200 This will produce a 20 minutes timer

Do Note:

A common reason for the server not spawning in a mission at the desired time is that the server is lagging and this causes time to essentially slow down. Fix the lag and the missions will spawn at the right times. You have to find the balance between material in your server (Add ons) and lag.

 

Easy way to find Database Coords/Custom Debug:

In your custom compiles file you want to change your dayz_spaceInterrupt file path. For me it is as so.

dayz_spaceInterrupt = compile preprocessFileLineNumbers "Scripts\dayz_spaceInterrupt.sqf";

 

You will need to obtain the dayz_spaceInterrupt.sqf file from the client files. This is located in dayz_code\Actions Copy and paste it into a folder called Scripts in your mission pbo. 

With in Dayz_spaceinterrupt at line 117 you will find this chunk of code:

 

if (_dikCode == 210) then {
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

 

Change to the file that you will download attached. 

if (_dikCode == 210) then {

_nill = execvm "Scripts\playerstats.sqf";

};

Simply have this point to your new custom debug.

Attatched I will have the Player stats file for the custom debug monitor. Simply add you and your admins UID's and whola a simple way to get coords!

 
Changing AI behviour:

Again pulled straight from the forums!

/// Sets behavior of AI groups

paddster7, on 25 Dec 2013 - 5:57 PM, said:

ai_combatmode = "RED";

ai_behaviour = "COMBAT";

This code is from the AIconfig.sqf file.

In a previous post the explanation for "ai_behaviour" was given as:

Here are the different ai_beahaviour you can use.

SAFE, CARELESS - Units will stay upright

AWARE, COMBAT - Units will stay upright most of the time, kneeling down occasionally

STEALTH - Units will be prone most of the time

However, can you please give me an explanation of the "ai_combatmode" setting? What is the "RED" mode and what other modes are there?

"BLUE" (Never fire)

When hostile units are detected, they will track them, but will never fire back, even when fired upon.

This mode can only be set through the editor or script. No in-game commands to subordinates can set them to combat mode Blue.

"GREEN" (Hold fire - defend only)

When a player orders his units to "Hold fire", the units are set to combat mode Green.

"WHITE" (Hold fire, engage at will)

"YELLOW" (Fire at will)

If AI spots a target and decides it is in effective range, he will open fire. By default AI is set to YELLOW.

If a leader calls Target, the unit with aim without breaking formation.

"RED" (Fire at will, engage at will)

When a leader commands his units to Engage at will, combat mode RED is set. The AI does not keep formation and each member moves individualy. The leader command Disengage will set the units back to fire at will (YELLOW)

If Attack and Engage is called, the unit will break formation to find the best place to attack from (combat mode RED).

NOTE: To make AI hunt down a known target, you need to use '_unit setCombatMode "RED"'. The Seek & Destroy waypoint only makes the AI to search the vicinity of the waypoint itself. Not affect their behavior on their way to the waypoint itself.

And to your behavior full description :

Safe

It is possible to choose also Careless in mission editor, that expands the behavior for even more free movement (loiter) in range up to 150m.

will use roads, groups travel in convoy (overrides formation command)

stance with lowered weapon

turned out from vehicle

lie down when scared

less turning head, less observing surroundings (limited rate of target database)

Aware

Default behavior.

lie down when scared

soldiers sometimes move in cover

vehicles still prefer roads, travel in convoy

Danger (Combat)

dismiss (loiter movement) canceled

ignores limited speed setting

tends to change stance to kneel or prone

soldiers move in cover

soldiers disembark from some vehicles, e.g. damaged aircraft

turns of vehicle lights

Stealth

dismiss (loiter movement) canceled

faster target acquisition

tends to change stance to kneel or prone

keep themself also out of Unknown targets

soldiers move in cover, routing near structures

soldiers disembark from some vehicles, e.g. damaged aircraft

turns of vehicle lights

tanks avoid passing trees

 
Editing Missions: 
Editing the missions to accommodate your custom server is easy and quick to do if done right. Here I will teach you how to change the basics and a little more advanced stuff like box contents and so forth. Lets get to it.
 
Editing Messages:

The simplest thing you can change is the message that it displays when the missions comes up. There are a total of 3 different messages. Displayed in this order.

- The Mission has started

- The Mission was successfully completed

- The Mission was not completed in time

These are the aims of the three messages now to chow you where they are and how to change them. This is the order in which they are displayed within the script.

The Mission has started message:

[nil,nil,rTitleText,"Bandits have disabled an armed vehicle with lots of chain gun ammo in the gear! Check your map for the location!", "PLAIN",10] call RE;

This will be the first message in this format. Simply change it to what ever you like but as long as you keep the two " markers on each end and you should be fine. For instance:

[nil,nil,rTitleText,"Change only this text", "PLAIN",10] call RE;

So we can gather that this is how the other messages will be displayed. Taking this information you simply change the text to what you like and there you have it a custom message to your players!!

 
Join in progress player marker fix: 
 

I do apologize for this problem and there is a easy fix from what I believe.

Find attached the files your will need to make this work.

Put this at the bottom of your Init.sqf

// Mission System Markers

[] execVM "debug\addmarkers.sqf";

[] execVM "debug\addmarkers75.sqf";

Simply just paste the folder in your mission file and your done!

Let me know the results.

 
Adding RPG/Missiles to turrets:
 

WEB11, on 24 Jan 2014 - 7:33 PM, said:snapback.png

 

I have not had many problems with vehicles and missions. You can change the turrents to a missile turret! Like so:

 

[[[(_position select 0) + 10, (_position select 1) -15, 0]], //position(s) (can be multiple).

"M2StaticMG", //Classname of turret

0.7,                     //Skill level 0-1. Has no effect if using custom skills

"USMC_LHD_Crew_Yellow",                 //Skin "" for random or classname here.

1,                         //Primary gun set number. "Random" for random weapon set. (not needed if ai_static_useweapon = False)

2,                         //Number of magazines. (not needed if ai_static_useweapon = False)

"",                         //Backpack "" for random or classname here. (not needed if ai_static_useweapon = False)

"Random",                 //Gearset number. "Random" for random gear set. (not needed if ai_static_useweapon = False)

true                        // mission true

] call spawn_static;

 

Change this line: 

 

"SPG9_TK_INS_EP1", //Classname of turret

 

This is a missile launcher turret. You also don't need to worry if people will pick up RPG's this way. The turrets are not able to be used once they die. 

It does not lock on so it won't be too OP. But bare in mind that people driving by the missions might get killed.

 

 

Another Method that was developed by other used to add RPG's to AI:

 

1) Open SpawnGroup.sqf in WAI/custom/ folder.

Quote

 

To remove RPG once AI is dead open ai_killed.sqf

Quote

 

All credit goes to the original author and WAI, I am merely keeping this information alive.

 

Next I want to find a way to give AI units NVGs, if anyone has that info please share it.

 

cant download .ZIP files. Maybe GITHUB link?

 

it says "Oops! Something went wrong!"

Link to comment
Share on other sites

 

I have upgraded Epoch to version 105 and am now getting this error:

 

12:52:46 "_iClass isNil, exiting loot spawn!"
12:52:46 Error in expression <s select _index;
_itemType = _itemTypes select _index;
[_itemType select 0, _ite>
12:52:46   Error position: <select _index;
[_itemType select 0, _ite>
12:52:46   Error Zero divisor
12:52:46 File z\addons\dayz_server\WAI\missions\missions\crash_spawner.sqf, line 73
 
Can anyone help?

 

The same problem! Any solution for this?

Link to comment
Share on other sites

Solution to above loot issue.... I had some problems with this for a bit in several different loot spawning scripts

loottable structure has changed ... you need to replace some lines in crashspawner module

_config = configFile >> "CfgBuildingLoot" >> _lootTable;
_itemTypes = [] + getArray (_config >> "itemType");
_index = dayz_CBLBase find toLower(_lootTable);
_weights = dayz_CBLChances select _index;
_cntWeights = count _weights;

with this

    if (DZE_MissionLootTable) then {
        _itemTypes = [] + getArray (missionConfigFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
    } else {
        _itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
    };
    _CBLBase = dayz_CBLBase find (toLower(_lootTable));
    _weights = dayz_CBLChances select _CBLBase;
    _cntWeights = count _weights;

and replace this

_index = floor(random _cntWeights);
_index = _weights select _index;
_itemType = _itemTypes select _index;
[_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;

with this

        _index1 = floor(random _cntWeights);
        _index2 = _weights select _index1;
        _itemType = _itemTypes select _index2;
        [_itemType select 0, _itemType select 1, _lootPos, 5] call spawn_loot;

last step, make sure that following vars are registered as private:

_index1, _index2 and _itemTypes

- look ontop of file and add them or replace the line with this one ...

private["_index1","_index2","_itemTypes","_timeAdjust","_timeToSpawn","_spawnRoll","_crash","_hasAdjustment","_newHeight","_adjustedPos","_useStatic","_crashDamage","_lootRadius","_preWaypoints","_preWaypointPos","_endTime","_startTime","_safetyPoint","_heliStart","_deadBody","_exploRange","_heliModel","_lootPos","_list","_craters","_dummy","_wp2","_wp3","_landingzone","_aigroup","_wp","_helipilot","_crash","_crashwreck","_smokerand","_staticcoords","_pos","_dir","_position","_num","_config","_itemType","_itemChance","_weights","_index","_iArray","_crashModel","_lootTable","_guaranteedLoot","_randomizedLoot","_frequency","_variance","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_permanentFire","_crashName"];

hope that helps... cheers

Link to comment
Share on other sites

Hey man appreciate what your doin here. Quick question I wanna get rid of safe zones and replace it with so guards. If a player fires within X amount of distance the ai would engage them and those that are tagged as friendly to that player. If this can or can't be done please let me know much appreciated

Link to comment
Share on other sites

I have this error in rpt causing that parachute units have no backpack:

13:54:20 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:20   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:20   Error Undefined variable in expression: _aipack
13:54:20 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:22 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:22   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:22   Error Undefined variable in expression: _aipack
13:54:22 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:24 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:24   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:24   Error Undefined variable in expression: _aipack
13:54:24 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:25 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:25   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:25   Error Undefined variable in expression: _aipack
13:54:25 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
customSpawns.sqf


[[12360.0,12598.0,0],  //Position that units will be dropped by
[0,0,0],                           //Starting position of the heli
400,                               //Radius from drop position a player has to be to spawn chopper
"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)
5,                                 //Number of units to be para dropped
0,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
"Random",                          //Primary gun set number. "Random" for random weapon set.
4,                                 //Number of magazines
"",                                //Backpack "" for random or classname here.
"Bandit2_DZ",                      //Skin "" for random or classname here.
"Random",                          //Gearset number. "Random" for random gear set.
True                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire. 
] spawn heli_para;

 

How to fix this?

heli_para.sqf




if (!isServer)exitWith{};
private ["_cleanheli","_drop","_helipos","_gunner2","_gunner","_playerPresent","_skillarray","_aicskill","_aiskin","_aigear","_helipatrol","_gear","_skin","_backpack","_mags","_gun","_triggerdis","_startingpos","_aiweapon","_mission","_heli_class","_startPos","_helicopter","_unitGroup","_pilot","_skill","_paranumber","_position","_wp1"];
_position = _this select 0;
_startingpos = _this select 1;
_triggerdis = _this select 2;
_heli_class = _this select 3;
_paranumber = _this select 4;
_skill = _this select 5;
_gun = _this select 6;
_mags = _this select 7;
_backpack = _this select 8;
_skin = _this select 9;
_gear = _this select 10;
_helipatrol = _this select 11;
if (count _this > 12) then {
	_mission = _this select 12;
} else {
	_mission = False;
};
//_delay = _this select 12;
_aiweapon = [];
_aigear = [];
_aiskin = "";
_aicskill = [];
_skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];

// wait for player to come into area.
diag_log "WAI: Paradrop Waiting for player";
waitUntil
{
	sleep 10;
	_playerPresent = false;
	{if((isPlayer _x) AND (_x distance [(_position select 0),(_position select 1),0] <= _triggerdis)) then {_playerPresent = true};}forEach playableUnits;
	(_playerPresent)
};
//Delay before chopper spawns in.
//sleep _delay;
//Spawing in Chopper and crew
diag_log format ["WAI: Spawning a %1 with %2 units to be paradropped at %3",_heli_class,_paranumber,_position];
_unitGroup = createGroup east;
_pilot = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
[_pilot] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

_helicopter = createVehicle [_heli_class, [(_startingpos select 0),(_startingpos select 1), 100], [], 0, "FLY"];
_helicopter setFuel 1;
_helicopter engineOn true;
_helicopter setVehicleAmmo 1;
_helicopter flyInHeight 150;
_helicopter addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];

_pilot assignAsDriver _helicopter;
_pilot moveInDriver _helicopter;

_gunner = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
_gunner assignAsGunner _helicopter;
_gunner moveInTurret [_helicopter,[0]];
[_gunner] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

_gunner2 = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
_gunner2 assignAsGunner _helicopter;
_gunner2 moveInTurret [_helicopter,[1]];
[_gunner2] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

{_pilot setSkill [_x,1]} forEach _skillarray;
{_gunner setSkill [_x,0.7]} forEach _skillarray;
{_gunner2 setSkill [_x,0.7]} forEach _skillarray;
{_x addweapon "Makarov";_x addmagazine "8Rnd_9x18_Makarov";_x addmagazine "8Rnd_9x18_Makarov";} forEach (units _unitgroup);
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_helicopter];
[_helicopter] spawn veh_monitor;

_unitGroup allowFleeing 0;
_unitGroup setBehaviour "CARELESS";
_unitGroup setSpeedMode "FULL";
_unitGroup setCombatMode "RED";

// Add waypoints to the chopper group.
_wp = _unitGroup addWaypoint [[(_position select 0), (_position select 1)], 0];
_wp setWaypointType "MOVE";
_wp setWaypointCompletionRadius 100;

_drop = True;
_helipos = getpos _helicopter;
while {(alive _helicopter) AND (_drop)} do {
	private ["_magazine","_weapon","_weaponandmag","_chute","_para","_pgroup"];
	sleep 1;
	_helipos = getpos _helicopter;
	if (_helipos distance [(_position select 0),(_position select 1),100] <= 200) then {
		_pgroup = createGroup east;
		for "_x" from 1 to _paranumber do {
			_helipos = getpos _helicopter;
			switch (_gun) do {
				case 0 : {_aiweapon = ai_wep0;};
				case 1 : {_aiweapon = ai_wep1;};
				case 2 : {_aiweapon = ai_wep2;};
				case 3 : {_aiweapon = ai_wep3;};
				case 4 : {_aiweapon = ai_wep4;};
				case "Random" : {_aiweapon = ai_wep_random call BIS_fnc_selectRandom;};
			};
			_weaponandmag = _aiweapon call BIS_fnc_selectRandom;
			_weapon = _weaponandmag select 0;
			_magazine = _weaponandmag select 1;
				switch (_gear) do {
				case 0 : {_aigear = ai_gear0;};
				case 1 : {_aigear = ai_gear1;};
				case 2 : {_aigear = ai_gear2;};
				case 3 : {_aigear = ai_gear3;};
				case 4 : {_aigear = ai_gear4;};
				case "Random" : {_aigear = ai_gear_random call BIS_fnc_selectRandom;};
			};
			_gearmagazines = _aigear select 0;
			_geartools = _aigear select 1;
			if (_skin == "") then {
				_aiskin = ai_skin call BIS_fnc_selectRandom;
			} else {
				_aiskin = _skin
			};
			_para = _pgroup createUnit [_aiskin, [0,0,0], [], 1, "PRIVATE"];
			if (_backpack == "") then {
				_aipack = ai_packs call BIS_fnc_selectRandom;
			} else {
				_aipack = _backpack
			};
			_para enableAI "TARGET";
			_para enableAI "AUTOTARGET";
			_para enableAI "MOVE";
			_para enableAI "ANIM";
			_para enableAI "FSM";
			_para setCombatMode ai_combatmode;
			_para setBehaviour ai_behaviour;
			removeAllWeapons _para;
			removeAllItems _para;
			_para addweapon _weapon;
			for "_i" from 1 to _mags do {_para addMagazine _magazine;};
			_para addBackpack _aipack;
			{_para addMagazine _x} forEach _gearmagazines;
			{_para addweapon _x} forEach _geartools;
			if (ai_custom_skills) then {
				switch (_skill) do {
				case 0 : {_aicskill = ai_custom_array1;};
				case 1 : {_aicskill = ai_custom_array2;};
				case 2 : {_aicskill= ai_custom_array3;};
				case "Random" : {_aicskill = ai_skill_random call BIS_fnc_selectRandom;};
			};
				{_para setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
			} else {
				{_para setSkill [_x,_skill]} forEach _skillarray;
			};
			ai_ground_units = (ai_ground_units + 1);
			_para addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}];
			_chute = createVehicle ["ParachuteEast", [(_helipos select 0), (_helipos select 1), (_helipos select 2)], [], 0, "NONE"];
			_para moveInDriver _chute;
			[_para] joinSilent _pgroup;
			sleep 1.5;
		};
		_drop = false;
		_pgroup selectLeader ((units _pgroup) select 0);
		diag_log format ["WAI: Spawned in %1 ai units for paradrop",_paranumber];
		[_pgroup, _position,_mission] call group_waypoints;
	};
};
if (_helipatrol) then { 
	_wp1 = _unitGroup addWaypoint [[(_position select 0),(_position select 1)], 100];
	_wp1 setWaypointType "SAD";
	_wp1 setWaypointCompletionRadius 150;
	_unitGroup setBehaviour "AWARE";
	_unitGroup setSpeedMode "FULL";
	_unitGroup setCombatMode "RED";
	{_x addEventHandler ["Killed",{[_this select 0, _this select 1, "air"] call on_kill;}];} forEach (units _unitgroup);
} else {
	{_x doMove [(_startingpos select 0), (_startingpos select 1), 100]} forEach (units _unitGroup);
	_unitGroup setBehaviour "CARELESS";
	_unitGroup setSpeedMode "FULL";
	_unitGroup setCombatMode "RED";
	_cleanheli = True;
	while {_cleanheli} do {
		sleep 20;
		_helipos1 = getpos _helicopter;
		if ((_helipos1 distance [(_startingpos select 0),(_startingpos select 1),100] <= 200) OR (!alive _helicopter)) then {
			deleteVehicle _helicopter;
			{deleteVehicle _x} forEach (units _unitgroup);
			sleep 10;
			deleteGroup _unitGroup;
			ai_air_units = (ai_air_units -3);
			diag_log "WAI: Paradrop cleaned up";
			_cleanheli = False;
		};
	};
};


	
	

Link to comment
Share on other sites

 

I have this error in rpt causing that parachute units have no backpack:

13:54:20 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:20   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:20   Error Undefined variable in expression: _aipack
13:54:20 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:22 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:22   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:22   Error Undefined variable in expression: _aipack
13:54:22 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:24 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:24   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:24   Error Undefined variable in expression: _aipack
13:54:24 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
13:54:25 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
13:54:25   Error position: <_aipack;
{_para addMagazine _x} forEach >
13:54:25   Error Undefined variable in expression: _aipack
13:54:25 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
customSpawns.sqf


[[12360.0,12598.0,0],  //Position that units will be dropped by
[0,0,0],                           //Starting position of the heli
400,                               //Radius from drop position a player has to be to spawn chopper
"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)
5,                                 //Number of units to be para dropped
0,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
"Random",                          //Primary gun set number. "Random" for random weapon set.
4,                                 //Number of magazines
"",                                //Backpack "" for random or classname here.
"Bandit2_DZ",                      //Skin "" for random or classname here.
"Random",                          //Gearset number. "Random" for random gear set.
True                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire. 
] spawn heli_para;

 

How to fix this?

heli_para.sqf




if (!isServer)exitWith{};
private ["_cleanheli","_drop","_helipos","_gunner2","_gunner","_playerPresent","_skillarray","_aicskill","_aiskin","_aigear","_helipatrol","_gear","_skin","_backpack","_mags","_gun","_triggerdis","_startingpos","_aiweapon","_mission","_heli_class","_startPos","_helicopter","_unitGroup","_pilot","_skill","_paranumber","_position","_wp1"];
_position = _this select 0;
_startingpos = _this select 1;
_triggerdis = _this select 2;
_heli_class = _this select 3;
_paranumber = _this select 4;
_skill = _this select 5;
_gun = _this select 6;
_mags = _this select 7;
_backpack = _this select 8;
_skin = _this select 9;
_gear = _this select 10;
_helipatrol = _this select 11;
if (count _this > 12) then {
	_mission = _this select 12;
} else {
	_mission = False;
};
//_delay = _this select 12;
_aiweapon = [];
_aigear = [];
_aiskin = "";
_aicskill = [];
_skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];

// wait for player to come into area.
diag_log "WAI: Paradrop Waiting for player";
waitUntil
{
	sleep 10;
	_playerPresent = false;
	{if((isPlayer _x) AND (_x distance [(_position select 0),(_position select 1),0] <= _triggerdis)) then {_playerPresent = true};}forEach playableUnits;
	(_playerPresent)
};
//Delay before chopper spawns in.
//sleep _delay;
//Spawing in Chopper and crew
diag_log format ["WAI: Spawning a %1 with %2 units to be paradropped at %3",_heli_class,_paranumber,_position];
_unitGroup = createGroup east;
_pilot = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
[_pilot] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

_helicopter = createVehicle [_heli_class, [(_startingpos select 0),(_startingpos select 1), 100], [], 0, "FLY"];
_helicopter setFuel 1;
_helicopter engineOn true;
_helicopter setVehicleAmmo 1;
_helicopter flyInHeight 150;
_helicopter addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];

_pilot assignAsDriver _helicopter;
_pilot moveInDriver _helicopter;

_gunner = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
_gunner assignAsGunner _helicopter;
_gunner moveInTurret [_helicopter,[0]];
[_gunner] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

_gunner2 = _unitGroup createUnit ["Bandit1_DZ", [0,0,0], [], 1, "NONE"];
_gunner2 assignAsGunner _helicopter;
_gunner2 moveInTurret [_helicopter,[1]];
[_gunner2] joinSilent _unitGroup;
ai_air_units = (ai_air_units +1);

{_pilot setSkill [_x,1]} forEach _skillarray;
{_gunner setSkill [_x,0.7]} forEach _skillarray;
{_gunner2 setSkill [_x,0.7]} forEach _skillarray;
{_x addweapon "Makarov";_x addmagazine "8Rnd_9x18_Makarov";_x addmagazine "8Rnd_9x18_Makarov";} forEach (units _unitgroup);
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_helicopter];
[_helicopter] spawn veh_monitor;

_unitGroup allowFleeing 0;
_unitGroup setBehaviour "CARELESS";
_unitGroup setSpeedMode "FULL";
_unitGroup setCombatMode "RED";

// Add waypoints to the chopper group.
_wp = _unitGroup addWaypoint [[(_position select 0), (_position select 1)], 0];
_wp setWaypointType "MOVE";
_wp setWaypointCompletionRadius 100;

_drop = True;
_helipos = getpos _helicopter;
while {(alive _helicopter) AND (_drop)} do {
	private ["_magazine","_weapon","_weaponandmag","_chute","_para","_pgroup"];
	sleep 1;
	_helipos = getpos _helicopter;
	if (_helipos distance [(_position select 0),(_position select 1),100] <= 200) then {
		_pgroup = createGroup east;
		for "_x" from 1 to _paranumber do {
			_helipos = getpos _helicopter;
			switch (_gun) do {
				case 0 : {_aiweapon = ai_wep0;};
				case 1 : {_aiweapon = ai_wep1;};
				case 2 : {_aiweapon = ai_wep2;};
				case 3 : {_aiweapon = ai_wep3;};
				case 4 : {_aiweapon = ai_wep4;};
				case "Random" : {_aiweapon = ai_wep_random call BIS_fnc_selectRandom;};
			};
			_weaponandmag = _aiweapon call BIS_fnc_selectRandom;
			_weapon = _weaponandmag select 0;
			_magazine = _weaponandmag select 1;
				switch (_gear) do {
				case 0 : {_aigear = ai_gear0;};
				case 1 : {_aigear = ai_gear1;};
				case 2 : {_aigear = ai_gear2;};
				case 3 : {_aigear = ai_gear3;};
				case 4 : {_aigear = ai_gear4;};
				case "Random" : {_aigear = ai_gear_random call BIS_fnc_selectRandom;};
			};
			_gearmagazines = _aigear select 0;
			_geartools = _aigear select 1;
			if (_skin == "") then {
				_aiskin = ai_skin call BIS_fnc_selectRandom;
			} else {
				_aiskin = _skin
			};
			_para = _pgroup createUnit [_aiskin, [0,0,0], [], 1, "PRIVATE"];
			if (_backpack == "") then {
				_aipack = ai_packs call BIS_fnc_selectRandom;
			} else {
				_aipack = _backpack
			};
			_para enableAI "TARGET";
			_para enableAI "AUTOTARGET";
			_para enableAI "MOVE";
			_para enableAI "ANIM";
			_para enableAI "FSM";
			_para setCombatMode ai_combatmode;
			_para setBehaviour ai_behaviour;
			removeAllWeapons _para;
			removeAllItems _para;
			_para addweapon _weapon;
			for "_i" from 1 to _mags do {_para addMagazine _magazine;};
			_para addBackpack _aipack;
			{_para addMagazine _x} forEach _gearmagazines;
			{_para addweapon _x} forEach _geartools;
			if (ai_custom_skills) then {
				switch (_skill) do {
				case 0 : {_aicskill = ai_custom_array1;};
				case 1 : {_aicskill = ai_custom_array2;};
				case 2 : {_aicskill= ai_custom_array3;};
				case "Random" : {_aicskill = ai_skill_random call BIS_fnc_selectRandom;};
			};
				{_para setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
			} else {
				{_para setSkill [_x,_skill]} forEach _skillarray;
			};
			ai_ground_units = (ai_ground_units + 1);
			_para addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}];
			_chute = createVehicle ["ParachuteEast", [(_helipos select 0), (_helipos select 1), (_helipos select 2)], [], 0, "NONE"];
			_para moveInDriver _chute;
			[_para] joinSilent _pgroup;
			sleep 1.5;
		};
		_drop = false;
		_pgroup selectLeader ((units _pgroup) select 0);
		diag_log format ["WAI: Spawned in %1 ai units for paradrop",_paranumber];
		[_pgroup, _position,_mission] call group_waypoints;
	};
};
if (_helipatrol) then { 
	_wp1 = _unitGroup addWaypoint [[(_position select 0),(_position select 1)], 100];
	_wp1 setWaypointType "SAD";
	_wp1 setWaypointCompletionRadius 150;
	_unitGroup setBehaviour "AWARE";
	_unitGroup setSpeedMode "FULL";
	_unitGroup setCombatMode "RED";
	{_x addEventHandler ["Killed",{[_this select 0, _this select 1, "air"] call on_kill;}];} forEach (units _unitgroup);
} else {
	{_x doMove [(_startingpos select 0), (_startingpos select 1), 100]} forEach (units _unitGroup);
	_unitGroup setBehaviour "CARELESS";
	_unitGroup setSpeedMode "FULL";
	_unitGroup setCombatMode "RED";
	_cleanheli = True;
	while {_cleanheli} do {
		sleep 20;
		_helipos1 = getpos _helicopter;
		if ((_helipos1 distance [(_startingpos select 0),(_startingpos select 1),100] <= 200) OR (!alive _helicopter)) then {
			deleteVehicle _helicopter;
			{deleteVehicle _x} forEach (units _unitgroup);
			sleep 10;
			deleteGroup _unitGroup;
			ai_air_units = (ai_air_units -3);
			diag_log "WAI: Paradrop cleaned up";
			_cleanheli = False;
		};
	};
};


	
	

+1

 

I have same issue, would be great if someone could fix it. This happened for me as soon as I switched to 105 &1051. It seems to happen regardless of arma version as it happened for me on both 112555 and 125402.

Link to comment
Share on other sites

 

replace 

if (_backpack == "") then {
	_aipack = ai_packs call BIS_fnc_selectRandom;
} else {
	_aipack = _backpack
};

with 

_aipack = ai_packs call BIS_fnc_selectRandom;

Thanks itsatrap!

 

Will give it a go and report back.

 

Do you also know how to get rid of the parachutes that don't despawn after the AI have para dropped? 

 

I am on 112555/1051

 

Thanks again!

Link to comment
Share on other sites

Parachutes seem to be a 112555 thing, long fixed with the Steam 1.63 Arma versions:

 

@itsatrap:

Your fix circumvents the (_backpack == "") if clause.

But, looking at the customSpawns.sqf cited above, the  parameter corresponding to _backpack is indeed "".

I knew about the different handling of undefined variables in the new Arma patches, but here _backpack should be defined.

 

So, is this another quirk that you cannot have empty strings as parameters, anymore?

Link to comment
Share on other sites

Sad is a massive understatement! :-D

Sooner all the disparate launchers are sorted out, the better.

But if you look at both servers and players over 80% of both are still on dzc and pre steam beta.

Also, the number of players in general has dropped steeply because of this and 'stuck at the loadscreen'.

What really worries me now is the timing of 1052. If it happens before this is all sorted out I'm not sure what will happen to the mod....

Link to comment
Share on other sites

I've installed this system and it's working great, I've added the RPG7 addon someone recommended here to give them the chance to spawn with the RPG7 and now I'm getting this error in my RPT file a lot:

 

1:32:26 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
 1:32:26   Error position: <_aipack;
{_para addMagazine _x} forEach >
 1:32:26   Error Undefined variable in expression: _aipack
 1:32:26 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
 
Would this most likely be from it attempting to add a RPG to the infantry in the heli?
Link to comment
Share on other sites

 

I've installed this system and it's working great, I've added the RPG7 addon someone recommended here to give them the chance to spawn with the RPG7 and now I'm getting this error in my RPT file a lot:

 

1:32:26 Error in expression <Magazine _magazine;};
_para addBackpack _aipack;
{_para addMagazine _x} forEach >
 1:32:26   Error position: <_aipack;
{_para addMagazine _x} forEach >
 1:32:26   Error Undefined variable in expression: _aipack
 1:32:26 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 137
 
Would this most likely be from it attempting to add a RPG to the infantry in the heli?

 

the suggested fix is only one page, 11 posts back in this thread......

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...