From f4fa8cb8f253d806a8f8e14e10b165ae33ff8844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Tu=C5=9Bnio?= Date: Sat, 13 May 2017 18:01:48 +0100 Subject: [PATCH] ADD: a reputation change whenever a building is destroyed --- .../core/def/mission.sqf | 19 +++++++++++++++++++ .../core/fnc/compile.sqf | 1 + .../core/fnc/eh/buildingchanged.sqf | 14 ++++++++++++++ .../core/init_server.sqf | 2 ++ 4 files changed, 36 insertions(+) create mode 100644 =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf index d944af25b..c480dce93 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf @@ -159,6 +159,23 @@ if (isServer) then { //Vehs btc_vehicles = [btc_veh_1,btc_veh_2,btc_veh_3,btc_veh_4,btc_veh_5,btc_veh_6,btc_veh_7,btc_veh_8,btc_veh_9,btc_veh_10,btc_veh_11,btc_veh_12,btc_veh_13,btc_veh_14,btc_veh_15]; btc_helo = [btc_helo_1]; + + // Prefixes of buildings and their multiplier. This will multiply the values of btc_rep_malus_building_destroyed + // and btc_rep_malus_building_damaged, if a building is not present here it will be multiplied by 1.0. + // Use 0.0 to disable reputation hit on a specific's building destruction. + // This will also be applied left-to-right, so if you differentiate between i.e. "Land_Chapel" and "Land_Chapel_Small" + // then place the more specific prefix first. + // You can modify this for any other terrain, clearing the table will also make all buildings just have a 1.0 multiplier. + btc_buildings_multipliers = [ ["Land_BellTower", 0.2 ], ["Land_Chapel_Small", 2.5], ["Land_Chapel", 3.0], + ["Land_Lighthouse_small", 2.5], [ "Land_LightHouse", 4.0 ], ["Land_WIP", 1.5], ["Land_u_Addon_01", 0.2], + ["Land_Metal_Shed", 0.5], ["Land_i_House_Big", 1.5], ["Land_u_House_Big", 1.5], ["Land_d_House_Big", 1.5], + ["Land_i_Shop", 1.5], ["Land_u_Shop", 1.5], ["Land_d_Shop", 1.5], ["Land_Slum", 0.8], + ["Land_i_Stone_HouseBig", 1.5], ["Land_d_Stone_HouseBig", 1.5], ["Land_Airport_Tower", 10.0], + ["Land_Hangar", 7.0], ["Land_cmp_Hopper", 4.0], ["Land_cmp_Tower", 4.0], ["Land_dp_smallTank", 3.0], + ["Land_Factory_Conv", 2.0], ["Land_Factory_Hopper", 4.0], ["Land_Factory_Main", 6.0], ["Land_FuelStation_Shed", 2.0], + ["Land_ReservoirTank", 3.0], ["Land_Shed", 0.2], ["Land_i_Shed_Ind", 1.5], ["Land_u_Shed_Ind", 1.5], + ["Land_spp_Tower", 7.0], ["Land_spp_Transformer", 3.0], ["Land_TTowerBig", 6.0], ["Land_TTowerSmall", 4.5], + ["Land_i_Barracks", 1.75], ["Land_u_Barracks", 1.75] ]; }; //City @@ -521,6 +538,8 @@ btc_rep_malus_civ_killed = - 10; btc_rep_malus_civ_firenear = - 5; btc_rep_malus_player_respawn = - 10; btc_rep_malus_veh_killed = - 25; +btc_rep_malus_building_damaged = - 5; +btc_rep_malus_building_destroyed = - 10; //Side if (isNil "btc_side_assigned") then {btc_side_assigned = false;}; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf index f3371334a..30a72484e 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf @@ -64,6 +64,7 @@ if (isServer) then { btc_fnc_eh_veh_respawn = compile preprocessFile "core\fnc\eh\veh_respawn.sqf"; btc_fnc_eh_explosives_defuse = compile preprocessFile "core\fnc\eh\explosives_defuse.sqf"; btc_fnc_eh_handledisconnect = compile preprocessFile "core\fnc\eh\handledisconnect.sqf"; + btc_fnc_eh_buildingchanged = compile preprocessFile "core\fnc\eh\buildingchanged.sqf"; //IED btc_fnc_ied_boom = compile preprocessFile "core\fnc\ied\boom.sqf"; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf new file mode 100644 index 000000000..68bba5e88 --- /dev/null +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf @@ -0,0 +1,14 @@ +params ["_from", "_to", "_isRuin"]; +private _classname = typeOf _from; +private _malus = [btc_rep_malus_building_damaged, btc_rep_malus_building_destroyed] select _isRuin; + +{ + if([_x select 0, _classname] call BIS_fnc_inString) exitWith { + _malus = _malus * (_x select 1); + }; +} forEach btc_buildings_multipliers; + +if(btc_debug_log) then { + systemChat format [ "BuildingChanged: %1 to %2. Malus: %3", + typeOf _from, typeOf _to, _malus ]; +}; diff --git a/=BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf b/=BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf index a3f3f3cfe..fec752b40 100644 --- a/=BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf +++ b/=BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf @@ -24,6 +24,8 @@ call btc_fnc_db_autosave; addMissionEventHandler ["HandleDisconnect",btc_fnc_eh_handledisconnect]; +addMissionEventHandler ["BuildingChanged",btc_fnc_eh_buildingchanged]; + ["ace_explosives_defuse", btc_fnc_eh_explosives_defuse] call CBA_fnc_addEventHandler; ["Initialize"] call BIS_fnc_dynamicGroups;