2015-08-30 05:01:00 +00:00
/*
2015-09-05 03:40:00 +00:00
DMS_fnc_OnKilled
2015-08-30 05:01:00 +00:00
Created by eraser1 and Defent
Influenced by WAI
Usage:
[
[
_killedUnit,
_killer
],
_side, // "bandit" only for now
2015-09-10 02:05:46 +00:00
_type // Type of AI: "soldier","static","vehicle","heli", etc.
2015-09-05 03:40:00 +00:00
] call DMS_fnc_OnKilled;
2015-08-30 05:01:00 +00:00
*/
2015-12-24 19:45:20 +00:00
private ["_unit", "_killer", "_side", "_type", "_launcher", "_launcherVar", "_playerObj", "_removeAll", "_rockets", "_grp", "_grpUnits", "_av", "_memCount", "_gunner", "_driver", "_gunnerIsAlive", "_driverIsAlive", "_grp", "_owner", "_start", "_roadKilled", "_veh", "_boom", "_revealAmount", "_muzzle", "_silencer"];
2015-08-31 05:08:30 +00:00
I know... it's been over a week... gimme a break
#### October 17, 2015 (2:30 PM CST-America):
* **NEW CONFIG VALUES**:
|DMS_TimeToFirstMission|
|DMS_ShowDifficultyColorLegend|
|DMS_TerritoryNearBlacklist|
|DMS_MinSurfaceNormal| (Used to be DMS_MaxSurfaceNormal, simply renamed)
|DMS_ai_launchers_per_group|
* **UPDATING ALL OF YOUR MISSION FILES IS HIGHLY RECOMMENDED UNLESS YOU
KNOW WHAT YOU'RE DOING**
* RENAMED "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". I must have
been very tired when I named it...
* DMS_MinSurfaceNormal is now 0.9 by default, but will be 0.95 for Altis
and Bornholm (since they're relatively large/flat maps). Esseker is
still 0.85. If you want to convert DMS_MinSurfaceNormal to degrees, you
would take the arc-cosine of the surfaceNormal, and that will give you
the degrees from horizontal. For example, arccos(0.9) is about 25
degrees. Google: "arccos(0.9) in degrees"
* Tweaked and rebalanced "DMS_BanditMissionTypes". Most of the spawn
chances are the same, they're just reduced in order to prevent the
creation of arrays that are far larger than they need to be.
* You can now manually define how long it takes for the first mission to
spawn after a restart.
* DMS will now by default create markers on the bottom left of the map
to show which colors correspond to which difficulty. It isn't very
pretty, but it gets the point across.
* DMS will now manually calculate the center of the map and its radius,
if it isn't preconfigured by DMS.
* You can now specify the vehicles to spawn for missions: "bandits",
"cardealer", "construction", "donthasslethehoff", and "thieves".
* You can now specify the spawning location of any mission (and whether
or not to use an alternative location if the provided location is
invalid). This will allow for easy integration of DMS into admin tools.
* Added support for scripts to be executed on mission completion or
mission failure (this will allow you to have "multi-part" missions,
where you would simply spawn the next part of the mission if the
previous is completed).
* Restructured DMS_DEBUG from the previous patch in favor of a more
"optimized" method.
* DMS_fnc_findSafePos is completely overhauled; DMS no longer uses
"BIS_fnc_findSafePos". It also now throttles minSurfaceNormal on
repeated failure. You can now determine whether or not the mission
should spawn on water (however, I don't suggest you use this function
for water spawns yet).
* You can also now define a minimum distance from other territories for
missions.
* DMS_fnc_IsValidPosition will now check for water depth if the provided
position is meant to be checked as a "water spawn". It will now also
check for nearby missions from A3XAI or VEMF (untested).
* DMS_fnc_IsValidPosition now checks whether or not the position is
outside of the map borders.
* DMS_fnc_SelectOffsetPos will now return the 3rd element of the
provided position as-is.
* You can now have multiple AI within a group with a launcher.
* AI now have a 5-second godmode after spawning.
* You can now spawn a crate using ASL pos. DMS_fnc_SpawnCrate will also
make sure that the provided classname is valid.
* Just like SpawnCrate, "DMS_fnc_SpawnNonPersistentVehicle" and
"DMS_fnc_SpawnPersistentVehicle" will now make sure that the provided
classname is valid.
* "DMS_fnc_SpawnPersistentVehicle" now supports ASL spawning.
* Added support for [Rod Serling's](https://github.com/Rod-Serling) AVS.
* General optimization.
2015-10-17 19:39:07 +00:00
if (DMS_DEBUG) then
{
(format ["OnKilled :: Logging AI death with parameters: %1",_this]) call DMS_fnc_DebugLog;
};
2016-01-07 00:38:55 +00:00
_unit = _this select 0;
_killer = _this select 1;
_side = _unit getVariable ["DMS_AI_Side", "bandit"];
_type = _unit getVariable ["DMS_AI_Type", "soldier"];
2015-09-18 23:26:36 +00:00
_launcher = secondaryWeapon _unit;
_launcherVar = _unit getVariable ["DMS_AI_Launcher",""];
_playerObj = objNull;
2015-08-30 05:01:00 +00:00
2016-02-07 20:24:35 +00:00
_unit call ([missionNamespace getVariable [_unit getVariable ["DMS_AI_CustomOnKilledFnc",""],{}]] param [0,{},[{}]]);
2015-09-14 04:52:02 +00:00
// Some of the previously used functions work with non-local argument. Some don't. BIS is annoying
_removeAll =
2015-08-30 05:01:00 +00:00
{
2015-09-14 04:52:02 +00:00
{_this removeWeaponGlobal _x;} forEach (weapons _this);
{_this unlinkItem _x;} forEach (assignedItems _this);
{_this removeItem _x;} forEach (items _this);
Major UI Improvements, Fixes, Improved readme
* **NEW CONFIG VALUES**:
|DMS_Show_Kill_Poptabs_Notification|
|DMS_Show_Kill_Respect_Notification|
|DMS_dynamicText_Duration|
|DMS_dynamicText_FadeTime|
|DMS_dynamicText_Title_Size|
|DMS_dynamicText_Title_Font|
|DMS_dynamicText_Message_Color|
|DMS_dynamicText_Message_Size|
|DMS_dynamicText_Message_Font|
|DMS_standardHint_Title_Size|
|DMS_standardHint_Title_Font|
|DMS_standardHint_Message_Color|
|DMS_standardHint_Message_Size|
|DMS_standardHint_Message_Font|
|DMS_textTiles_Duration|
|DMS_textTiles_FadeTime|
|DMS_textTiles_Title_Size|
|DMS_textTiles_Title_Font|
|DMS_textTiles_Message_Color|
|DMS_textTiles_Message_Size|
|DMS_textTiles_Message_Font|
* "DMS_PlayerNotificationTypes" has been adjusted to include
"systemChatRequest" and the brand new "textTilesRequest". **NOTE:** Due
to the way "text tiles" work, a player can only have one on his screen
at a time. As a result, if another text tile is created while the
mission message is up, the message will immediately disappear to display
the new text tile. Currently, the "Frag Messages" (the ones that say
"Player Kill +100") use text tiles. I don't think it should be a major
issue (especially if you use "systemChatRequest", so the player can just
scroll up), but if I get reports of it being stupid, I will default to
"dynamicTextRequest", which should also look pretty damn nice.
* These changes should make it much easier for people to use DMS
notification functions for other purposes.
* Fixed AI waypoints - the AI should now properly circle the objective
at the proper radius.
* Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult"
(reduced the radii). Due to the AI pathing fix.
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet"
should work now (although I'm fairly certain nobody uses it since nobody
ever complained :P )
* Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no
longer spawn jumbled up in most cases (like cardealer). Also, it's
updated to the latest Exile methods to ensure that vehicles have no
nightvision/thermal if configured to do so in Exile configs. Also added
the "MPKilled" EH used by Exile for non-persistent (persistent vehicles
already had it).
* You can now choose whether or not you want to display the poptabs or
respect kill messages when killing an AI with
"DMS_Show_Kill_Poptabs_Notification" and
"DMS_Show_Kill_Respect_Notification". Both are enabled by default.
* Fixed typos in the "OnKilled" EH (didn't really affect anything)
* Fixed cases when "currentMuzzle" would return a number. Thanks to
[azmodii](https://github.com/azmodii) for the reminder.
* Optimized the "AI share info" function in "OnKilled"
2015-10-09 00:16:48 +00:00
removeAllItemsWithMagazines _this;
removeHeadgear _this;
removeUniform _this;
removeVest _this;
removeBackpackGlobal _this;
2015-09-14 04:52:02 +00:00
};
2015-09-18 23:26:36 +00:00
moveOut _unit;
2015-12-24 19:45:20 +00:00
_unit removeAllEventHandlers "HandleDamage";
2015-09-14 04:52:02 +00:00
// Remove gear according to configs
if (DMS_clear_AI_body && {(random 100) <= DMS_clear_AI_body_chance}) then
{
_unit call _removeAll;
2015-08-30 05:01:00 +00:00
};
2015-08-29 19:58:46 +00:00
2015-11-15 02:08:41 +00:00
if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then
2015-08-30 05:01:00 +00:00
{
2015-09-18 23:26:36 +00:00
// Because arma is stupid sometimes
2016-03-25 23:09:41 +00:00
if (_launcher isEqualTo "") then
2015-09-18 23:26:36 +00:00
{
_launcher = _launcherVar;
diag_log "sneaky launchers...";
2015-11-15 02:08:41 +00:00
_unit spawn
2015-09-18 23:26:36 +00:00
{
2015-11-15 02:08:41 +00:00
sleep 0.5;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
{
2015-11-15 02:08:41 +00:00
_holder = _x;
{
if (_x isKindOf ["LauncherCore", configFile >> "CfgWeapons"]) exitWith
{
deleteVehicle _holder;
diag_log "gotcha";
};
} forEach (weaponCargo _holder);
} forEach (nearestObjects [_this, ["GroundWeaponHolder","WeaponHolderSimulated"], 5]);
};
2015-09-18 23:26:36 +00:00
};
2015-09-09 04:00:26 +00:00
_unit removeWeaponGlobal _launcher;
2016-01-07 00:38:55 +00:00
2015-08-30 05:01:00 +00:00
{
2015-11-15 02:08:41 +00:00
if (_x isKindOf ["CA_LauncherMagazine", configFile >> "CfgMagazines"]) then
2015-09-13 06:15:21 +00:00
{
2015-09-14 04:52:02 +00:00
_unit removeMagazineGlobal _x;
2015-08-29 19:58:46 +00:00
};
2015-11-15 02:08:41 +00:00
} forEach (magazines _unit);
2015-08-30 05:01:00 +00:00
};
2015-08-29 19:58:46 +00:00
2015-08-30 05:01:00 +00:00
if(DMS_RemoveNVG) then
{
_unit unlinkItem "NVGoggles";
};
2015-08-29 19:58:46 +00:00
2015-12-24 19:45:20 +00:00
_grp = group _unit;
_grpUnits = (units _grp) - [_unit];
2015-09-09 04:00:26 +00:00
// Give the AI a new leader if the killed unit was the leader
2015-12-24 19:45:20 +00:00
if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then
2015-08-31 20:44:15 +00:00
{
2016-03-01 06:34:55 +00:00
_grp selectLeader (selectRandom _grpUnits);
2015-08-31 20:44:15 +00:00
};
2015-09-15 03:50:09 +00:00
_av = _unit getVariable ["DMS_AssignedVeh",objNull];
if (!isNull _av) then
{
// Determine whether or not the vehicle has any active crew remaining.
2015-09-18 23:26:36 +00:00
_memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av);
2015-09-15 03:50:09 +00:00
2015-08-29 19:58:46 +00:00
2015-09-15 03:50:09 +00:00
// Destroy the vehicle and add it to cleanup if there are no active crew members of the vehicle.
2016-03-25 23:09:41 +00:00
if (_memCount isEqualTo 0) then
2015-09-15 03:50:09 +00:00
{
2016-03-25 23:09:41 +00:00
/*
I know what you're probably thinking:
What the hell is this? An "if-statement" evaluated for an "if-statement"?! What madness is this?! Does this guy know what he's doing? There has to be a better way!
To which I (eraser1) reply...
I know it looks funky, and there are prettier and slicker ways to do this (such as using "select") BUT I tested extensively and found out that this way is the fastest way, so... yeah...
*/
if
(
if (_av isKindOf "StaticWeapon") then
{
2016-03-31 22:54:56 +00:00
DMS_AI_destroyStaticWeapon && {(random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyStaticWeapon_chance])}
2016-03-25 23:09:41 +00:00
}
else
{
2016-03-31 22:54:56 +00:00
(random 100)<(_av getVariable ["DMS_DestructionChance",DMS_AI_destroyVehicleChance])
2016-03-25 23:09:41 +00:00
}
) then
2015-12-24 19:45:20 +00:00
{
_av setDamage 1;
_av setVariable ["ExileDiedAt",time];
_av spawn {sleep 1;_this enableSimulationGlobal false;};
2015-09-15 03:50:09 +00:00
2015-12-24 19:45:20 +00:00
if (DMS_DEBUG) then
{
2016-01-07 00:38:55 +00:00
(format["OnKilled :: Destroying used AI vehicle %1, and disabling simulation.",typeOf _av]) call DMS_fnc_DebugLog;
2015-12-24 19:45:20 +00:00
};
2016-03-25 23:09:41 +00:00
}
else
{
_av lock 1;
if (DMS_DEBUG) then
{
(format["OnKilled :: Unlocking used AI vehicle (%1).",typeOf _av]) call DMS_fnc_DebugLog;
};
I know... it's been over a week... gimme a break
#### October 17, 2015 (2:30 PM CST-America):
* **NEW CONFIG VALUES**:
|DMS_TimeToFirstMission|
|DMS_ShowDifficultyColorLegend|
|DMS_TerritoryNearBlacklist|
|DMS_MinSurfaceNormal| (Used to be DMS_MaxSurfaceNormal, simply renamed)
|DMS_ai_launchers_per_group|
* **UPDATING ALL OF YOUR MISSION FILES IS HIGHLY RECOMMENDED UNLESS YOU
KNOW WHAT YOU'RE DOING**
* RENAMED "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". I must have
been very tired when I named it...
* DMS_MinSurfaceNormal is now 0.9 by default, but will be 0.95 for Altis
and Bornholm (since they're relatively large/flat maps). Esseker is
still 0.85. If you want to convert DMS_MinSurfaceNormal to degrees, you
would take the arc-cosine of the surfaceNormal, and that will give you
the degrees from horizontal. For example, arccos(0.9) is about 25
degrees. Google: "arccos(0.9) in degrees"
* Tweaked and rebalanced "DMS_BanditMissionTypes". Most of the spawn
chances are the same, they're just reduced in order to prevent the
creation of arrays that are far larger than they need to be.
* You can now manually define how long it takes for the first mission to
spawn after a restart.
* DMS will now by default create markers on the bottom left of the map
to show which colors correspond to which difficulty. It isn't very
pretty, but it gets the point across.
* DMS will now manually calculate the center of the map and its radius,
if it isn't preconfigured by DMS.
* You can now specify the vehicles to spawn for missions: "bandits",
"cardealer", "construction", "donthasslethehoff", and "thieves".
* You can now specify the spawning location of any mission (and whether
or not to use an alternative location if the provided location is
invalid). This will allow for easy integration of DMS into admin tools.
* Added support for scripts to be executed on mission completion or
mission failure (this will allow you to have "multi-part" missions,
where you would simply spawn the next part of the mission if the
previous is completed).
* Restructured DMS_DEBUG from the previous patch in favor of a more
"optimized" method.
* DMS_fnc_findSafePos is completely overhauled; DMS no longer uses
"BIS_fnc_findSafePos". It also now throttles minSurfaceNormal on
repeated failure. You can now determine whether or not the mission
should spawn on water (however, I don't suggest you use this function
for water spawns yet).
* You can also now define a minimum distance from other territories for
missions.
* DMS_fnc_IsValidPosition will now check for water depth if the provided
position is meant to be checked as a "water spawn". It will now also
check for nearby missions from A3XAI or VEMF (untested).
* DMS_fnc_IsValidPosition now checks whether or not the position is
outside of the map borders.
* DMS_fnc_SelectOffsetPos will now return the 3rd element of the
provided position as-is.
* You can now have multiple AI within a group with a launcher.
* AI now have a 5-second godmode after spawning.
* You can now spawn a crate using ASL pos. DMS_fnc_SpawnCrate will also
make sure that the provided classname is valid.
* Just like SpawnCrate, "DMS_fnc_SpawnNonPersistentVehicle" and
"DMS_fnc_SpawnPersistentVehicle" will now make sure that the provided
classname is valid.
* "DMS_fnc_SpawnPersistentVehicle" now supports ASL spawning.
* Added support for [Rod Serling's](https://github.com/Rod-Serling) AVS.
* General optimization.
2015-10-17 19:39:07 +00:00
};
2015-09-15 03:50:09 +00:00
}
else
{
// Only check for this stuff for ground vehicles that have guns...
2015-09-17 03:37:17 +00:00
if ((_av isKindOf "LandVehicle") && {(count (weapons _av))>0}) then
2015-09-15 03:50:09 +00:00
{
_gunner = gunner _av;
_driver = driver _av;
2015-09-18 23:26:36 +00:00
// The fact that I have to do this in the FUCKING ONKILLED EVENTHANDLER is a testament to why ArmA will make me die prematurely
_gunnerIsAlive = alive _gunner;
_driverIsAlive = alive _driver;
if (_unit isEqualTo _gunner) then
{
_gunnerIsAlive = false;
};
if (_unit isEqualTo _driver) then
{
_driverIsAlive = false;
};
2015-09-15 03:50:09 +00:00
// If the gunner is dead but the driver is alive, then the driver becomes the gunner.
// Helps with troll AI vehicles driving around aimlessly after the gunner is shot off. More realistic imo
2015-09-18 23:26:36 +00:00
if (!_gunnerIsAlive && {_driverIsAlive}) then
2015-09-15 03:50:09 +00:00
{
2015-09-18 23:26:36 +00:00
[_driver,_av,_killer] spawn
2015-09-15 03:50:09 +00:00
{
2015-09-18 23:26:36 +00:00
_driver = _this select 0;
_av = _this select 1;
_killer = _this select 2;
_grp = group _driver;
_owner = groupOwner _grp;
_grp setVariable ["DMS_LockLocality",true];
// The AI has to be local in order for these commands to work, so I reset locality, just because it's really difficult to deal with otherwise
if (_owner!=2) then
{
diag_log format ["Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2];
};
sleep 5+(random 3); // 5 to 8 seconds delay after gunner death
2015-09-17 03:37:17 +00:00
2015-09-18 23:26:36 +00:00
if !(alive _driver) exitWith {};
unassignVehicle _driver;
2015-09-17 03:37:17 +00:00
moveOut _driver;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
_driver disableCollisionWith _av;
_av setVehicleAmmoDef 1;
2015-09-17 03:37:17 +00:00
2015-09-18 23:26:36 +00:00
waitUntil
{
unassignVehicle _driver;
doGetOut _driver;
moveOut _driver;
(vehicle _driver)==_driver
};
2015-09-17 03:37:17 +00:00
_driver assignAsGunner _av;
[_driver] orderGetIn true;
sleep 1.5;
2015-09-18 23:26:36 +00:00
if !(alive _driver) exitWith {};
2015-09-17 03:37:17 +00:00
_driver moveInGunner _av;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
_driver enableCollisionWith _av;
2015-09-17 03:37:17 +00:00
I know... it's been over a week... gimme a break
#### October 17, 2015 (2:30 PM CST-America):
* **NEW CONFIG VALUES**:
|DMS_TimeToFirstMission|
|DMS_ShowDifficultyColorLegend|
|DMS_TerritoryNearBlacklist|
|DMS_MinSurfaceNormal| (Used to be DMS_MaxSurfaceNormal, simply renamed)
|DMS_ai_launchers_per_group|
* **UPDATING ALL OF YOUR MISSION FILES IS HIGHLY RECOMMENDED UNLESS YOU
KNOW WHAT YOU'RE DOING**
* RENAMED "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". I must have
been very tired when I named it...
* DMS_MinSurfaceNormal is now 0.9 by default, but will be 0.95 for Altis
and Bornholm (since they're relatively large/flat maps). Esseker is
still 0.85. If you want to convert DMS_MinSurfaceNormal to degrees, you
would take the arc-cosine of the surfaceNormal, and that will give you
the degrees from horizontal. For example, arccos(0.9) is about 25
degrees. Google: "arccos(0.9) in degrees"
* Tweaked and rebalanced "DMS_BanditMissionTypes". Most of the spawn
chances are the same, they're just reduced in order to prevent the
creation of arrays that are far larger than they need to be.
* You can now manually define how long it takes for the first mission to
spawn after a restart.
* DMS will now by default create markers on the bottom left of the map
to show which colors correspond to which difficulty. It isn't very
pretty, but it gets the point across.
* DMS will now manually calculate the center of the map and its radius,
if it isn't preconfigured by DMS.
* You can now specify the vehicles to spawn for missions: "bandits",
"cardealer", "construction", "donthasslethehoff", and "thieves".
* You can now specify the spawning location of any mission (and whether
or not to use an alternative location if the provided location is
invalid). This will allow for easy integration of DMS into admin tools.
* Added support for scripts to be executed on mission completion or
mission failure (this will allow you to have "multi-part" missions,
where you would simply spawn the next part of the mission if the
previous is completed).
* Restructured DMS_DEBUG from the previous patch in favor of a more
"optimized" method.
* DMS_fnc_findSafePos is completely overhauled; DMS no longer uses
"BIS_fnc_findSafePos". It also now throttles minSurfaceNormal on
repeated failure. You can now determine whether or not the mission
should spawn on water (however, I don't suggest you use this function
for water spawns yet).
* You can also now define a minimum distance from other territories for
missions.
* DMS_fnc_IsValidPosition will now check for water depth if the provided
position is meant to be checked as a "water spawn". It will now also
check for nearby missions from A3XAI or VEMF (untested).
* DMS_fnc_IsValidPosition now checks whether or not the position is
outside of the map borders.
* DMS_fnc_SelectOffsetPos will now return the 3rd element of the
provided position as-is.
* You can now have multiple AI within a group with a launcher.
* AI now have a 5-second godmode after spawning.
* You can now spawn a crate using ASL pos. DMS_fnc_SpawnCrate will also
make sure that the provided classname is valid.
* Just like SpawnCrate, "DMS_fnc_SpawnNonPersistentVehicle" and
"DMS_fnc_SpawnPersistentVehicle" will now make sure that the provided
classname is valid.
* "DMS_fnc_SpawnPersistentVehicle" now supports ASL spawning.
* Added support for [Rod Serling's](https://github.com/Rod-Serling) AVS.
* General optimization.
2015-10-17 19:39:07 +00:00
if (DMS_DEBUG) then
{
(format["OnKilled :: Switched driver of AI Vehicle (%1) to gunner.",typeOf _av]) call DMS_fnc_DebugLog;
};
2015-09-18 23:26:36 +00:00
if (_owner!=2) then
{
_start = time;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
// Controlling AI... yes. I have to do this
waitUntil
{
_driver assignAsGunner _av;
[_driver] orderGetIn true;
_driver moveInGunner _av;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
(((gunner _av) isEqualTo _driver) || {(time-_start)>30})
};
sleep 3;
_start = time;
waitUntil
{
_driver assignAsGunner _av;
[_driver] orderGetIn true;
_driver moveInGunner _av;
2016-01-07 00:38:55 +00:00
2015-09-18 23:26:36 +00:00
(((gunner _av) isEqualTo _driver) || {(time-_start)>30})
};
_driver doTarget _killer;
_driver doFire _killer;
sleep 15;
diag_log format ["Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner];
2015-09-17 03:37:17 +00:00
};
2015-09-18 23:26:36 +00:00
_grp setVariable ["DMS_LockLocality",false];
2015-09-15 03:50:09 +00:00
};
};
};
};
};
2015-08-29 19:58:46 +00:00
2015-09-22 04:17:51 +00:00
_roadKilled = false;
2015-09-09 04:00:26 +00:00
2015-09-18 23:26:36 +00:00
if (isPlayer _killer) then
2015-09-09 04:00:26 +00:00
{
2015-09-18 23:26:36 +00:00
_veh = vehicle _killer;
2015-09-09 04:00:26 +00:00
2015-09-18 23:26:36 +00:00
_playerObj = _killer;
2015-09-09 04:00:26 +00:00
// Fix for players killing AI from mounted vehicle guns
2015-09-18 23:26:36 +00:00
if (!(_killer isKindOf "Exile_Unit_Player") && {!isNull (gunner _killer)}) then
2015-09-09 04:00:26 +00:00
{
2015-09-18 23:26:36 +00:00
_playerObj = gunner _killer;
2015-09-09 04:00:26 +00:00
};
2015-09-18 23:26:36 +00:00
if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
2015-09-09 04:00:26 +00:00
{
_playerObj = driver _veh;
2015-09-22 04:17:51 +00:00
_roadKilled = true;
2015-09-09 04:00:26 +00:00
2015-09-25 06:40:59 +00:00
if (DMS_explode_onRoadkill) then
{
2016-01-09 17:06:42 +00:00
_boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", [0,0,100], [], 0, "CAN_COLLIDE"];
_boom setPosATL (getPosATL _playerObj);
2015-09-25 06:40:59 +00:00
_boom setDamage 1;
I know... it's been over a week... gimme a break
#### October 17, 2015 (2:30 PM CST-America):
* **NEW CONFIG VALUES**:
|DMS_TimeToFirstMission|
|DMS_ShowDifficultyColorLegend|
|DMS_TerritoryNearBlacklist|
|DMS_MinSurfaceNormal| (Used to be DMS_MaxSurfaceNormal, simply renamed)
|DMS_ai_launchers_per_group|
* **UPDATING ALL OF YOUR MISSION FILES IS HIGHLY RECOMMENDED UNLESS YOU
KNOW WHAT YOU'RE DOING**
* RENAMED "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". I must have
been very tired when I named it...
* DMS_MinSurfaceNormal is now 0.9 by default, but will be 0.95 for Altis
and Bornholm (since they're relatively large/flat maps). Esseker is
still 0.85. If you want to convert DMS_MinSurfaceNormal to degrees, you
would take the arc-cosine of the surfaceNormal, and that will give you
the degrees from horizontal. For example, arccos(0.9) is about 25
degrees. Google: "arccos(0.9) in degrees"
* Tweaked and rebalanced "DMS_BanditMissionTypes". Most of the spawn
chances are the same, they're just reduced in order to prevent the
creation of arrays that are far larger than they need to be.
* You can now manually define how long it takes for the first mission to
spawn after a restart.
* DMS will now by default create markers on the bottom left of the map
to show which colors correspond to which difficulty. It isn't very
pretty, but it gets the point across.
* DMS will now manually calculate the center of the map and its radius,
if it isn't preconfigured by DMS.
* You can now specify the vehicles to spawn for missions: "bandits",
"cardealer", "construction", "donthasslethehoff", and "thieves".
* You can now specify the spawning location of any mission (and whether
or not to use an alternative location if the provided location is
invalid). This will allow for easy integration of DMS into admin tools.
* Added support for scripts to be executed on mission completion or
mission failure (this will allow you to have "multi-part" missions,
where you would simply spawn the next part of the mission if the
previous is completed).
* Restructured DMS_DEBUG from the previous patch in favor of a more
"optimized" method.
* DMS_fnc_findSafePos is completely overhauled; DMS no longer uses
"BIS_fnc_findSafePos". It also now throttles minSurfaceNormal on
repeated failure. You can now determine whether or not the mission
should spawn on water (however, I don't suggest you use this function
for water spawns yet).
* You can also now define a minimum distance from other territories for
missions.
* DMS_fnc_IsValidPosition will now check for water depth if the provided
position is meant to be checked as a "water spawn". It will now also
check for nearby missions from A3XAI or VEMF (untested).
* DMS_fnc_IsValidPosition now checks whether or not the position is
outside of the map borders.
* DMS_fnc_SelectOffsetPos will now return the 3rd element of the
provided position as-is.
* You can now have multiple AI within a group with a launcher.
* AI now have a 5-second godmode after spawning.
* You can now spawn a crate using ASL pos. DMS_fnc_SpawnCrate will also
make sure that the provided classname is valid.
* Just like SpawnCrate, "DMS_fnc_SpawnNonPersistentVehicle" and
"DMS_fnc_SpawnPersistentVehicle" will now make sure that the provided
classname is valid.
* "DMS_fnc_SpawnPersistentVehicle" now supports ASL spawning.
* Added support for [Rod Serling's](https://github.com/Rod-Serling) AVS.
* General optimization.
2015-10-17 19:39:07 +00:00
if (DMS_DEBUG) then
{
(format ["OnKilled :: %1 roadkilled an AI! Creating mine at the roadkilled AI's position!",name _killer]) call DMS_fnc_DebugLog;
};
2015-09-25 06:40:59 +00:00
};
2015-09-09 04:00:26 +00:00
// Remove gear from roadkills if configured to do so
if (DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}) then
{
2015-09-14 04:52:02 +00:00
_unit call _removeAll;
2015-09-09 04:00:26 +00:00
};
2015-09-15 03:50:09 +00:00
};
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
2016-02-07 20:24:35 +00:00
_unit setVariable ["DMS_KillerID",owner _playerObj];
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
// Reveal the killer to the AI units
if (DMS_ai_share_info) then
{
_revealAmount = 4.0;
Major UI Improvements, Fixes, Improved readme
* **NEW CONFIG VALUES**:
|DMS_Show_Kill_Poptabs_Notification|
|DMS_Show_Kill_Respect_Notification|
|DMS_dynamicText_Duration|
|DMS_dynamicText_FadeTime|
|DMS_dynamicText_Title_Size|
|DMS_dynamicText_Title_Font|
|DMS_dynamicText_Message_Color|
|DMS_dynamicText_Message_Size|
|DMS_dynamicText_Message_Font|
|DMS_standardHint_Title_Size|
|DMS_standardHint_Title_Font|
|DMS_standardHint_Message_Color|
|DMS_standardHint_Message_Size|
|DMS_standardHint_Message_Font|
|DMS_textTiles_Duration|
|DMS_textTiles_FadeTime|
|DMS_textTiles_Title_Size|
|DMS_textTiles_Title_Font|
|DMS_textTiles_Message_Color|
|DMS_textTiles_Message_Size|
|DMS_textTiles_Message_Font|
* "DMS_PlayerNotificationTypes" has been adjusted to include
"systemChatRequest" and the brand new "textTilesRequest". **NOTE:** Due
to the way "text tiles" work, a player can only have one on his screen
at a time. As a result, if another text tile is created while the
mission message is up, the message will immediately disappear to display
the new text tile. Currently, the "Frag Messages" (the ones that say
"Player Kill +100") use text tiles. I don't think it should be a major
issue (especially if you use "systemChatRequest", so the player can just
scroll up), but if I get reports of it being stupid, I will default to
"dynamicTextRequest", which should also look pretty damn nice.
* These changes should make it much easier for people to use DMS
notification functions for other purposes.
* Fixed AI waypoints - the AI should now properly circle the objective
at the proper radius.
* Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult"
(reduced the radii). Due to the AI pathing fix.
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet"
should work now (although I'm fairly certain nobody uses it since nobody
ever complained :P )
* Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no
longer spawn jumbled up in most cases (like cardealer). Also, it's
updated to the latest Exile methods to ensure that vehicles have no
nightvision/thermal if configured to do so in Exile configs. Also added
the "MPKilled" EH used by Exile for non-persistent (persistent vehicles
already had it).
* You can now choose whether or not you want to display the poptabs or
respect kill messages when killing an AI with
"DMS_Show_Kill_Poptabs_Notification" and
"DMS_Show_Kill_Respect_Notification". Both are enabled by default.
* Fixed typos in the "OnKilled" EH (didn't really affect anything)
* Fixed cases when "currentMuzzle" would return a number. Thanks to
[azmodii](https://github.com/azmodii) for the reminder.
* Optimized the "AI share info" function in "OnKilled"
2015-10-09 00:16:48 +00:00
_muzzle = currentMuzzle _playerObj;
2015-12-24 19:45:20 +00:00
if (_muzzle isEqualType "") then
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
{
Major UI Improvements, Fixes, Improved readme
* **NEW CONFIG VALUES**:
|DMS_Show_Kill_Poptabs_Notification|
|DMS_Show_Kill_Respect_Notification|
|DMS_dynamicText_Duration|
|DMS_dynamicText_FadeTime|
|DMS_dynamicText_Title_Size|
|DMS_dynamicText_Title_Font|
|DMS_dynamicText_Message_Color|
|DMS_dynamicText_Message_Size|
|DMS_dynamicText_Message_Font|
|DMS_standardHint_Title_Size|
|DMS_standardHint_Title_Font|
|DMS_standardHint_Message_Color|
|DMS_standardHint_Message_Size|
|DMS_standardHint_Message_Font|
|DMS_textTiles_Duration|
|DMS_textTiles_FadeTime|
|DMS_textTiles_Title_Size|
|DMS_textTiles_Title_Font|
|DMS_textTiles_Message_Color|
|DMS_textTiles_Message_Size|
|DMS_textTiles_Message_Font|
* "DMS_PlayerNotificationTypes" has been adjusted to include
"systemChatRequest" and the brand new "textTilesRequest". **NOTE:** Due
to the way "text tiles" work, a player can only have one on his screen
at a time. As a result, if another text tile is created while the
mission message is up, the message will immediately disappear to display
the new text tile. Currently, the "Frag Messages" (the ones that say
"Player Kill +100") use text tiles. I don't think it should be a major
issue (especially if you use "systemChatRequest", so the player can just
scroll up), but if I get reports of it being stupid, I will default to
"dynamicTextRequest", which should also look pretty damn nice.
* These changes should make it much easier for people to use DMS
notification functions for other purposes.
* Fixed AI waypoints - the AI should now properly circle the objective
at the proper radius.
* Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult"
(reduced the radii). Due to the AI pathing fix.
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet"
should work now (although I'm fairly certain nobody uses it since nobody
ever complained :P )
* Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no
longer spawn jumbled up in most cases (like cardealer). Also, it's
updated to the latest Exile methods to ensure that vehicles have no
nightvision/thermal if configured to do so in Exile configs. Also added
the "MPKilled" EH used by Exile for non-persistent (persistent vehicles
already had it).
* You can now choose whether or not you want to display the poptabs or
respect kill messages when killing an AI with
"DMS_Show_Kill_Poptabs_Notification" and
"DMS_Show_Kill_Respect_Notification". Both are enabled by default.
* Fixed typos in the "OnKilled" EH (didn't really affect anything)
* Fixed cases when "currentMuzzle" would return a number. Thanks to
[azmodii](https://github.com/azmodii) for the reminder.
* Optimized the "AI share info" function in "OnKilled"
2015-10-09 00:16:48 +00:00
_silencer = _playerObj weaponAccessories _muzzle select 0;
if (!isNil "_silencer" && {_silencer != ""}) then
{
_revealAmount = 2.0;
};
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
};
{
Major UI Improvements, Fixes, Improved readme
* **NEW CONFIG VALUES**:
|DMS_Show_Kill_Poptabs_Notification|
|DMS_Show_Kill_Respect_Notification|
|DMS_dynamicText_Duration|
|DMS_dynamicText_FadeTime|
|DMS_dynamicText_Title_Size|
|DMS_dynamicText_Title_Font|
|DMS_dynamicText_Message_Color|
|DMS_dynamicText_Message_Size|
|DMS_dynamicText_Message_Font|
|DMS_standardHint_Title_Size|
|DMS_standardHint_Title_Font|
|DMS_standardHint_Message_Color|
|DMS_standardHint_Message_Size|
|DMS_standardHint_Message_Font|
|DMS_textTiles_Duration|
|DMS_textTiles_FadeTime|
|DMS_textTiles_Title_Size|
|DMS_textTiles_Title_Font|
|DMS_textTiles_Message_Color|
|DMS_textTiles_Message_Size|
|DMS_textTiles_Message_Font|
* "DMS_PlayerNotificationTypes" has been adjusted to include
"systemChatRequest" and the brand new "textTilesRequest". **NOTE:** Due
to the way "text tiles" work, a player can only have one on his screen
at a time. As a result, if another text tile is created while the
mission message is up, the message will immediately disappear to display
the new text tile. Currently, the "Frag Messages" (the ones that say
"Player Kill +100") use text tiles. I don't think it should be a major
issue (especially if you use "systemChatRequest", so the player can just
scroll up), but if I get reports of it being stupid, I will default to
"dynamicTextRequest", which should also look pretty damn nice.
* These changes should make it much easier for people to use DMS
notification functions for other purposes.
* Fixed AI waypoints - the AI should now properly circle the objective
at the proper radius.
* Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult"
(reduced the radii). Due to the AI pathing fix.
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet"
should work now (although I'm fairly certain nobody uses it since nobody
ever complained :P )
* Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no
longer spawn jumbled up in most cases (like cardealer). Also, it's
updated to the latest Exile methods to ensure that vehicles have no
nightvision/thermal if configured to do so in Exile configs. Also added
the "MPKilled" EH used by Exile for non-persistent (persistent vehicles
already had it).
* You can now choose whether or not you want to display the poptabs or
respect kill messages when killing an AI with
"DMS_Show_Kill_Poptabs_Notification" and
"DMS_Show_Kill_Respect_Notification". Both are enabled by default.
* Fixed typos in the "OnKilled" EH (didn't really affect anything)
* Fixed cases when "currentMuzzle" would return a number. Thanks to
[azmodii](https://github.com/azmodii) for the reminder.
* Optimized the "AI share info" function in "OnKilled"
2015-10-09 00:16:48 +00:00
if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= DMS_ai_share_info_distance}}) then
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
{
_x reveal [_killer, _revealAmount max (_x knowsAbout _playerObj)];
};
2015-12-24 19:45:20 +00:00
} forEach _grpUnits;
Finally another update... warming up
* NEW CONFIG VALUE: DMS_SpawnMinefieldForEveryMission
* You can now force-spawn an AT mine minefield on every mission with the
above config. These mines will only blow up on Tanks, APCs, and MRAPs
(Ifrits, Hunters, Striders).
* ALL MISSIONS HAVE BEEN EDITED TO MATCH THE NEW STANDARD FOR
DMS_fnc_AddMissionToMonitor. **If you have made any custom missions or
modified any of the current mission scripts, make sure you merge your
changes**!
* Adjusted the placement of the armed car in "bandits" mission. It
should no longer spawn right on the crate.
* Marker and message names for the "foodtransport" mission have been
adjusted.
* Added the AI vehicle to the "mercbase" mission.
* Removed some RPT spam...
* Standardize ATL for DMS_fnc_importFromM3E_Convert
* When revealing a player to AI, the reveal amount will be reduced if
the player has a suppressor.
* DMS_fnc_SetGroupBehavior will now remove all previous waypoints from
the AI group.
* Improved logging message for DMS_fnc_SpawnMinefield. Also, the mine
warning signs should be on a random offset (instead of always spawning
at 0, 90, 180, and 270 degrees)
2015-10-01 02:29:33 +00:00
};
2015-09-15 03:50:09 +00:00
};
2015-09-09 04:00:26 +00:00
2015-11-15 02:08:41 +00:00
[_playerObj, _unit, _side, _type, _roadKilled] call DMS_fnc_PlayerAwardOnAIKill;
2015-08-29 19:58:46 +00:00
2015-11-15 02:08:41 +00:00
// Let Exile handle the AI Body cleanup.
2016-01-07 00:38:55 +00:00
_unit setVariable ["ExileDiedAt",time];
2016-02-07 20:24:35 +00:00
_unit setVariable ["DMS_KillerObj",[_playerObj,_killer] select (isNull _playerObj)];