mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
Set up OnKilled + cleanup
!!!!! NOTE: The behavior of commands "gunner" and "driver" are not extensively documented on the wiki. I'm not sure if respect/money increase will work properly for kills from vehicles! I need to test these commands later !!!!! Cleaned up obsolete/already created functions from preInit Created config values "DMS_BanditMoneyGainOnKill" and "DMS_BanditRepGainOnKill" and "DMS_RemoveNVG" OnKilled should now give respect and pop tabs to clients (if configured to do so). It should also give the onscreen popup for kills for respect and update the values on the client (as well as updating the corresponding stats on the server and database) Use "MPKilled" EH instead of "Killed" for potential issues with offloading.
This commit is contained in:
parent
02696c3406
commit
cb7338c16a
@ -14,7 +14,10 @@ DMS_DEBUG = false;
|
|||||||
DMS_StaticMission = false; // Enable/disable static missions
|
DMS_StaticMission = false; // Enable/disable static missions
|
||||||
DMS_TimeBetweenMissions = [600,900]; // [Minimum,Maximum] time between missions (if mission limit is not reached) | DEFAULT: 10-15 mins
|
DMS_TimeBetweenMissions = [600,900]; // [Minimum,Maximum] time between missions (if mission limit is not reached) | DEFAULT: 10-15 mins
|
||||||
DMS_MissionTimeOut = [900,1800]; // [Minimum,Maximum] time it will take for a mission to timeout | Default: 15-30 mins
|
DMS_MissionTimeOut = [900,1800]; // [Minimum,Maximum] time it will take for a mission to timeout | Default: 15-30 mins
|
||||||
|
|
||||||
DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement
|
DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement
|
||||||
|
DMS_BanditMoneyGainOnKill = 250; // The amount of Poptabs gained for killing a bandit
|
||||||
|
DMS_BanditRepGainOnKill = 100; // The amount of Respect gained for killing a bandit
|
||||||
|
|
||||||
DMS_MissionMarkerWinDot = true; // Keep the mission marker dot with a "win" message after mission is over
|
DMS_MissionMarkerWinDot = true; // Keep the mission marker dot with a "win" message after mission is over
|
||||||
DMS_MissionMarkerLoseDot = true; // Keep the mission marker dot with a "lose" message after mission is over
|
DMS_MissionMarkerLoseDot = true; // Keep the mission marker dot with a "lose" message after mission is over
|
||||||
@ -64,8 +67,9 @@ DMS_DEBUG = false;
|
|||||||
|
|
||||||
DMS_banditSide = EAST; // The side (team) that AI Bandits will spawn on
|
DMS_banditSide = EAST; // The side (team) that AI Bandits will spawn on
|
||||||
DMS_clear_AI_body = false; // Clear AI body when they die
|
DMS_clear_AI_body = false; // Clear AI body when they die
|
||||||
DMS_remove_roadkill = false; // Delete AI bodies that are roadkill
|
DMS_remove_roadkill = false; // Remove gear from AI bodies that are roadkilled
|
||||||
DMS_remove_roadkill_chance = 0; // Percentage chance that roadkilled AI bodies will be deleted
|
DMS_remove_roadkill_chance = 0; // Percentage chance that roadkilled AI bodies will be deleted
|
||||||
|
DMS_RemoveNVG = false; // Remove NVGs from AI bodies
|
||||||
|
|
||||||
DMS_ai_offload_to_client = true; // Offload spawned AI groups to random clients. Helps with server performance.
|
DMS_ai_offload_to_client = true; // Offload spawned AI groups to random clients. Helps with server performance.
|
||||||
|
|
||||||
|
@ -5,14 +5,10 @@
|
|||||||
|
|
||||||
/* compiles
|
/* compiles
|
||||||
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
|
DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\DMS_CreateMarker.sqf";
|
||||||
spawn_group = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_group.sqf";
|
|
||||||
spawn_soldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_soldier.sqf";
|
|
||||||
spawn_static = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_static.sqf";
|
spawn_static = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\spawn_static.sqf";
|
||||||
group_waypoints = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\group_waypoints.sqf";
|
|
||||||
heli_para = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_para.sqf";
|
heli_para = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_para.sqf";
|
||||||
heli_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_patrol.sqf";
|
heli_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\heli_patrol.sqf";
|
||||||
vehicle_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_patrol.sqf";
|
vehicle_patrol = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_patrol.sqf";
|
||||||
bandit_behaviour = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\bandit_behaviour.sqf";
|
|
||||||
vehicle_monitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_monitor.sqf";
|
vehicle_monitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\vehicle_monitor.sqf";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -32,7 +28,7 @@ DMS_selectMagazine = compileFinal preprocessFileLineNumbers "\x\addons\dms\s
|
|||||||
DMS_TargetsKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\TargetsKilled.sqf";
|
DMS_TargetsKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\TargetsKilled.sqf";
|
||||||
DMS_SpawnAIGroup = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAIGroup.sqf";
|
DMS_SpawnAIGroup = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAIGroup.sqf";
|
||||||
DMS_SpawnAISoldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAISoldier.sqf";
|
DMS_SpawnAISoldier = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnAISoldier.sqf";
|
||||||
DMS_OnKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\OnKilled.sqf";//<--- TODO
|
DMS_OnKilled = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\OnKilled.sqf";
|
||||||
DMS_SetGroupBehavior = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetGroupBehavior.sqf";
|
DMS_SetGroupBehavior = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetGroupBehavior.sqf";
|
||||||
DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\AddMissionToMonitor.sqf";
|
DMS_AddMissionToMonitor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\AddMissionToMonitor.sqf";
|
||||||
|
|
||||||
|
@ -1,104 +1,122 @@
|
|||||||
private ["_rockets","_launcher","_type","_mission","_unit","_player"];
|
/*
|
||||||
|
DMS_OnKilled
|
||||||
|
Created by eraser1 and Defent
|
||||||
|
Influenced by WAI
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
[
|
||||||
|
[
|
||||||
|
_killedUnit,
|
||||||
|
_killer
|
||||||
|
],
|
||||||
|
_side, // "bandit" only for now
|
||||||
|
_type // not currently used
|
||||||
|
] call DMS_OnKilled;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_unit", "_player", "_playerObj", "_side", "_type", "_launcher", "_rockets", "_money", "_respect", "_moneyGain", "_repGain"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0 select 0;
|
||||||
_player = _this select 1;
|
_player = _this select 0 select 1;
|
||||||
_type = _this select 2;
|
_side = _this select 1;
|
||||||
_launcher = secondaryWeapon _unit;
|
_type = _this select 2;
|
||||||
|
_launcher = secondaryWeapon _unit;
|
||||||
|
|
||||||
call {
|
if (isPlayer _player) then
|
||||||
|
{
|
||||||
|
_playerObj = _player;
|
||||||
|
|
||||||
// then is faster than exitWith
|
if (DMS_ai_share_info) then
|
||||||
if(_type == "ground") then { ai_ground_units = (ai_ground_units -1);};
|
{
|
||||||
|
|
||||||
// Not defined yet -->
|
|
||||||
// if(_type == "air") exitWith { ai_air_units = (ai_air_units -1); };
|
|
||||||
// if(_type == "vehicle") exitWith { ai_vehicle_units = (ai_vehicle_units -1); };
|
|
||||||
// if(_type == "static") exitWith { ai_emplacement_units = (ai_emplacement_units -1); };
|
|
||||||
// <-- Not defined yet
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (isPlayer _player) then {
|
|
||||||
|
|
||||||
|
|
||||||
/* < NOT SURE IF THIS WORKS IN EXILE >
|
|
||||||
|
|
||||||
private ["_gainMoney","_gainRep",];
|
|
||||||
|
|
||||||
if (DMS_MoneyGainOnKill) then {
|
|
||||||
_gainMoney = _unit getVariable ["ExileMoney", 0];
|
|
||||||
call {
|
|
||||||
if (_unit getVariable ["Bandit", false]) exitWith {
|
|
||||||
_player setVariable ["ExileMoney",(ExileMoney + DMS_MoneyGainOnKill),true];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (DMS_RepGainOnKill) then {
|
|
||||||
_gainRep = _player getVariable ["ExileScore", 0];
|
|
||||||
call {
|
|
||||||
if (_unit getVariable ["Bandit", false]) exitWith {
|
|
||||||
_player setVariable ["ExileScore",(ExileScore + DMS_RepGainOnKill),true];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (DMS_clear_AI_body) then {
|
|
||||||
DMS_CleanUpList pushBack [_unit,diag_tickTime,DMS_CompletedMissionCleanupTime];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (DMS_ai_share_info) then {
|
|
||||||
{
|
|
||||||
if (((position _x) distance (position _unit)) <= DMS_ai_share_info_distance ) then {
|
|
||||||
_x reveal [_player, 4.0];
|
|
||||||
};
|
|
||||||
} count allUnits;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (DMS_remove_roadkill) then {
|
|
||||||
|
|
||||||
removeBackpack _unit;
|
|
||||||
removeAllWeapons _unit;
|
|
||||||
|
|
||||||
{
|
|
||||||
_unit removeMagazine _x
|
|
||||||
} count magazines _unit;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if ((random 100) <= DMS_remove_roadkill_chance) then {
|
|
||||||
|
|
||||||
removeAllWeapons _unit;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
if(DMS_ai_remove_launchers && _launcher != "") then {
|
|
||||||
|
|
||||||
_rockets = _launcher call DMS_selectMagazine;
|
|
||||||
_unit removeWeapon _launcher;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if(_x == _rockets) then {
|
if (((position _x) distance (position _unit)) <= DMS_ai_share_info_distance ) then {
|
||||||
_unit removeMagazine _x;
|
_x reveal [_player, 4.0];
|
||||||
};
|
};
|
||||||
} count magazines _unit;
|
} count allUnits;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_playerObj = gunner _player;
|
||||||
|
|
||||||
|
if (isNull _playerObj) then
|
||||||
|
{
|
||||||
|
_playerObj = driver _player;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(DMS_RemoveNVG) then {
|
if (DMS_clear_AI_body || {DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}}) then
|
||||||
if (_unit hasWeapon "NVGoggles") then {
|
{
|
||||||
_unit removeWeapon "NVGoggles";
|
removeAllWeapons _unit;
|
||||||
};
|
removeAllAssignedItems _unit;
|
||||||
|
removeAllItemsWithMagazines _unit;
|
||||||
|
removeUniform _unit;
|
||||||
|
removeVest _unit;
|
||||||
|
removeBackpack _unit;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if(DMS_ai_remove_launchers && {_launcher != ""}) then
|
||||||
|
{
|
||||||
|
_rockets = _launcher call DMS_selectMagazine;
|
||||||
|
_unit removeWeapon _launcher;
|
||||||
|
|
||||||
|
{
|
||||||
|
if(_x == _rockets) then {
|
||||||
|
_unit removeMagazine _x;
|
||||||
|
};
|
||||||
|
false;
|
||||||
|
} count magazines _unit;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(DMS_RemoveNVG) then
|
||||||
|
{
|
||||||
|
_unit unlinkItem "NVGoggles";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ((!isNull _playerObj) && {(getPlayerUID _playerObj) != ""}) then
|
||||||
|
{
|
||||||
|
_moneyGain = missionNamespace getVariable [format ["DMS_%1MoneyGainOnKill",_side],0];
|
||||||
|
_repGain = missionNamespace getVariable [format ["DMS_%1RepGainOnKill",_side],0];
|
||||||
|
|
||||||
|
if ((_moneyGain>0) || (_repGain>0)) then
|
||||||
|
{
|
||||||
|
_money = _playerObj getVariable ["ExileMoney", 0];
|
||||||
|
_respect = _playerObj getVariable ["ExileScore", 0];
|
||||||
|
|
||||||
|
if (_moneyGain>0) then
|
||||||
|
{
|
||||||
|
// Set client's money
|
||||||
|
_money = _money + _moneyGain;
|
||||||
|
_playerObj setVariable ["ExileMoney",_money];
|
||||||
|
|
||||||
|
// Send updated money value to client
|
||||||
|
ExileClientPlayerMoney = _money;
|
||||||
|
(owner _playerObj) publicVariableClient "ExileClientPlayerMoney";
|
||||||
|
ExileClientPlayerMoney = nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_repGain>0) then
|
||||||
|
{
|
||||||
|
// Set client's respect
|
||||||
|
_respect = _respect + _repGain;
|
||||||
|
_playerObj setVariable ["ExileScore",_respect];
|
||||||
|
|
||||||
|
// Send frag message
|
||||||
|
[_playerObj, "showFragRequest", [["AI Kill",_repGain]]] call ExileServer_system_network_send_to;
|
||||||
|
|
||||||
|
// Send updated respect value to client
|
||||||
|
ExileClientPlayerScore = _respect;
|
||||||
|
(owner _playerObj) publicVariableClient "ExileClientPlayerScore";
|
||||||
|
ExileClientPlayerScore = nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update client database entry
|
||||||
|
format["setAccountMoneyAndRespect:%1:%2:%3", _money, _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
DMS_CleanUpList pushBack [_unit,diag_tickTime,DMS_CompletedMissionCleanupTime];
|
@ -270,7 +270,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// Soldier killed event handler
|
// Soldier killed event handler
|
||||||
_unit addEventHandler ["Killed",{[_this, "soldier"] call DMS_OnKilled;}];
|
_unit addMPEventHandler ["MPKilled",{[_this, _side, "soldier"] call DMS_OnKilled;}];
|
||||||
|
|
||||||
_unit enableAI "TARGET";
|
_unit enableAI "TARGET";
|
||||||
_unit enableAI "AUTOTARGET";
|
_unit enableAI "AUTOTARGET";
|
||||||
|
Loading…
Reference in New Issue
Block a user