Skip to content

Commit

Permalink
Merge pull request #1656 from Vdauphin/Add-Grave
Browse files Browse the repository at this point in the history
Add: Reputation bonus when player put civilian killed by player in grave near religious building
  • Loading branch information
Vdauphin authored Oct 14, 2024
2 parents 6c379f4 + 492aa4f commit 4019a6b
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 10 deletions.
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ btc_rep_bonus_IEDCleanUp = 10;
btc_rep_bonus_removeTag = 3;
btc_rep_bonus_removeTagLetter = 0.5;
btc_rep_bonus_foodGive = 0.5;
btc_rep_bonus_grave = 5;

btc_rep_malus_civ_hd = - 2;
btc_rep_malus_animal_hd = - 1;
Expand Down
5 changes: 5 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/city/activate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ if (_civKilled isNotEqualTo []) then {
[[_city, _civKilled], btc_civ_fnc_createFlower] call btc_delay_fnc_exec;
};

private _grave = _city getVariable ["btc_rep_graves", []];
if (_grave isNotEqualTo []) then {
[[_city, _grave], btc_civ_fnc_createGrave] call btc_delay_fnc_exec;
};

[{
params ["_has_en", "_city", "_cachingRadius"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ btc_tags_server = btc_tags_server - [objNull];

(_city getVariable ["btc_civ_flowers", []]) call CBA_fnc_deleteEntity;

(_city getVariable ["btc_civ_graves", []]) call CBA_fnc_deleteEntity;

if (btc_debug_log) then {
[format ["count data_units = %1", count _data_units], __FILE__, [false]] call btc_debug_fnc_message;
[format ["count data_animals = %1", count _data_animals], __FILE__, [false]] call btc_debug_fnc_message;
Expand Down
50 changes: 50 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/civ/createGrave.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

/* ----------------------------------------------------------------------------
Function: btc_civ_fnc_createGrave
Description:
Create graves and add flower bouquets next to them.
Parameters:
_city - City. [Object]
_graves - Array of grave around city. [Array]
Returns:
Examples:
(begin example)
[btc_city_all get 1, [[getPosASL player, getDir player, "ACE_Grave"]]] call btc_civ_fnc_createGrave;
(end)
Author:
Vdauphin
---------------------------------------------------------------------------- */

params [
["_city", objNull, [objNull]],
["_graves", [], [[]]]
];

_city setVariable [
"btc_civ_graves",
_graves apply {
_x params ["_posASL", "_dir", "_graveType"];

private _grave = createVehicle [_graveType, [0, 0, 0], [], 0, "NONE"];
_grave setPosASL _posASL;
_grave setDir _dir;
_grave setVectorUp surfaceNormal _posASL;

_flowers = [];
for "_i" from 0 to (1 + round random 2) do {
_flowers pushBack createSimpleObject [
selectRandom btc_type_flowers,
[[_posASL vectorAdd [0, 0, 0.2], 0.2, 0.8, _dir, true]] call CBA_fnc_randPosArea
];
(_flowers select _i) setDir random 360;
};

[_flowers, _grave]
}
];
2 changes: 2 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (isServer) then {
btc_civ_fnc_create_patrol = compileScript ["core\fnc\civ\create_patrol.sqf"];
btc_civ_fnc_evacuate = compileScript ["core\fnc\civ\evacuate.sqf"];
btc_civ_fnc_createFlower = compileScript ["core\fnc\civ\createFlower.sqf"];
btc_civ_fnc_createGrave = compileScript ["core\fnc\civ\createGrave.sqf"];

//DATA
btc_data_fnc_add_group = compileScript ["core\fnc\data\add_group.sqf"];
Expand Down Expand Up @@ -168,6 +169,7 @@ if (isServer) then {
btc_rep_fnc_notify = compileScript ["core\fnc\rep\notify.sqf"];
btc_rep_fnc_killed = compileScript ["core\fnc\rep\killed.sqf"];
btc_rep_fnc_wheelChange = compileScript ["core\fnc\rep\wheelChange.sqf"];
btc_rep_fnc_grave = compileScript ["core\fnc\rep\grave.sqf"];

//RESPAWN
btc_respawn_fnc_addTicket = compileScript ["core\fnc\respawn\addTicket.sqf"];
Expand Down
4 changes: 3 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ private _cities_status = +(profileNamespace getVariable [format ["btc_hm_%1_citi
_x params ["_id", "_initialized", "_spawn_more", "_occupied", "_data_units", "_has_ho", "_ho_units_spawned", "_ieds", "_has_suicider",
["_data_animals", [], [[]]],
["_data_tags", [], [[]]],
["_civKilled", [], [[]]]
["_civKilled", [], [[]]],
["_graves", [], [[]]]
];

private _city = btc_city_all get _id;
Expand All @@ -49,6 +50,7 @@ private _cities_status = +(profileNamespace getVariable [format ["btc_hm_%1_citi
_city setVariable ["data_animals", _data_animals];
_city setVariable ["data_tags", _data_tags];
_city setVariable ["btc_rep_civKilled", _civKilled];
_city setVariable ["btc_rep_graves", _graves];

if (btc_debug) then {
private _marker = _city getVariable ["marker", ""];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ _object_data params [
["_turretMagazines", [], [[]]],
["_customName", "", [""]],
["_tagTexture", "", [""]],
["_properties", [], [[]]]
["_properties", [], [[]]],
["_playerKiller", "", [""]]
];

private _obj = createVehicle [_type, ASLToATL _pos, [], 0, "CAN_COLLIDE"];
Expand Down Expand Up @@ -76,5 +77,9 @@ if (_properties isNotEqualTo []) then {
([_obj] + _properties) call btc_veh_fnc_propertiesSet;
};

if (_playerKiller isNotEqualTo "") then {
_obj setVariable ["btc_rep_playerKiller", _playerKiller];
};

[_obj] call btc_log_fnc_init;
[_obj, _cargo, _inventory] call btc_db_fnc_loadCargo;
7 changes: 6 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/loadcargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Author:
["_dogtagDataTaken", [], [[]]],
["_turretMagazines", [], [[]]],
["_customName", "", [""]],
["_properties", [], [[]]]
["_properties", [], [[]]],
["_playerKiller", "", [""]]
];

private _l = createVehicle [_type, getPosATL _obj, [], 0, "CAN_COLLIDE"];
Expand Down Expand Up @@ -66,6 +67,10 @@ Author:
if (_properties isNotEqualTo []) then {
([_l] + _properties) call btc_veh_fnc_propertiesSet;
};

if (_playerKiller isNotEqualTo "") then {
_l setVariable ["btc_rep_playerKiller", _playerKiller];
};
} forEach _cargo;

//set inventory content for weapons, magazines and items
Expand Down
5 changes: 4 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/save.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private _cities_status = [];
_city_status pushBack (_y getVariable ["data_animals", []]);
_city_status pushBack (_y getVariable ["data_tags", []]);
_city_status pushBack (_y getVariable ["btc_rep_civKilled", []]);
_city_status pushBack (_y getVariable ["btc_rep_graves", []]);

_cities_status pushBack _city_status;
if (btc_debug_log) then {
Expand Down Expand Up @@ -146,7 +147,8 @@ private _vehiclesInCargo = _vehicles - _vehiclesNotInCargo;
["_turretMagazines", [], [[]]],
["_notuse", "", [""]],
["_tagTexture", "", [""]],
["_properties", [], [[]]]
["_properties", [], [[]]],
["_playerKiller", "", [""]]
];

private _data = [];
Expand All @@ -165,6 +167,7 @@ private _vehiclesInCargo = _vehicles - _vehiclesNotInCargo;
_data pushBack _turretMagazines;
_data pushBack _tagTexture;
_data pushBack _properties;
_data pushBack _playerKiller;

private _fakeViV = isVehicleCargo attachedTo _x;
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private _cargo = (_object getVariable ["ace_cargo_loaded", []]) apply {
_x call btc_body_fnc_dogtagGet,
magazinesAllTurrets _x,
_x getVariable ["ace_cargo_customName", ""],
[_x] call btc_veh_fnc_propertiesGet
[_x] call btc_veh_fnc_propertiesGet,
_x getVariable ["btc_rep_playerKiller", ""]
]
};
};
Expand All @@ -56,5 +57,6 @@ _data pushBack (magazinesAllTurrets _object);
_data pushBack (_object getVariable ["ace_cargo_customName", ""]);
_data pushBack (_object getVariable ["btc_tag_vehicle", ""]);
_data pushBack ([_object] call btc_veh_fnc_propertiesGet);
_data pushBack (_object getVariable ["btc_rep_playerKiller", ""]);

_data
20 changes: 17 additions & 3 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ if (btc_p_respawn_ticketsAtStart >= 0) then {
_unit in btc_body_deadPlayers
) then {
deleteMarker (_unit getVariable ["btc_body_deadMarker", ""]);
private _deadUnits = [[[_unit]] call btc_body_fnc_get] call btc_body_fnc_create;
private _deadUnit = _deadUnits select 0;
private _deadUnits = [[[_unit]] call btc_body_fnc_get] call btc_body_fnc_create;
_deadUnit = _deadUnits select 0;
btc_body_deadPlayers pushBack _deadUnit;
};
}];
Expand All @@ -156,4 +156,18 @@ if (btc_p_respawn_ticketsAtStart >= 0) then {
params ["_explosive", "_dir", "_pitch", "_unit"];
_explosive setVariable ["btc_side", side group _unit];
btc_explosives pushBack _this;
}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;

["ace_placedInBodyBag", {
params ["_patient", "_bodyBag", "_isGrave", "_medic"];
if (
isNil {_patient getVariable "btc_rep_playerKiller"}
) exitWith {};

private _killer = _patient getVariable "btc_rep_playerKiller";
if (_isGrave) then {
[btc_rep_fnc_grave, [_bodyBag, _medic], 0.2] call CBA_fnc_waitAndExecute;
} else {
_bodyBag setVariable ["btc_rep_playerKiller", _killer];
};
}] call CBA_fnc_addEventHandler;
47 changes: 47 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/rep/grave.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

/* ----------------------------------------------------------------------------
Function: btc_rep_fnc_grave
Description:
Add reputation when a player put dead civil in grave.
Parameters:
_restingPlace - Resting Place [Object]
_medic - Medic [Object]
Returns:
Examples:
(begin example)
[cursorObject, player] call btc_rep_fnc_grave;
(end)
Author:
Vdauphin
---------------------------------------------------------------------------- */

params ["_restingPlace", "_medic"];

private _church = nearestTerrainObjects [_restingPlace, ["CHURCH", "CHAPEL"], 50];
if (_church isEqualTo []) exitWith {};
_church = _church select 0;

[btc_rep_bonus_grave, _medic] call btc_rep_fnc_change;

private _city = [_church, values btc_city_all, false] call btc_fnc_find_closecity;
private _cachingRadius = _city getVariable "cachingRadius";

if (_city distance _church < _cachingRadius) then {
private _graveList = _city getVariable ["btc_rep_graves", []];
_graveList pushBack [
getPosASL _restingPlace,
getDir _restingPlace,
typeOf _restingPlace
];
_city setVariable ["btc_rep_graves", _graveList];

private _graveList = _city getVariable ["btc_civ_graves", []];
_graveList pushBack _restingPlace;
_city setVariable ["btc_civ_graves", _graveList];
};
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if (
};

if !(_isAgent) then {
_unit setVariable ["btc_rep_playerKiller", getPlayerUID _instigator];
private _city = (group _unit) getVariable ["btc_city", objNull];
if !(isNull _city) then {
private _civKilled = _city getVariable ["btc_rep_civKilled", []];
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
<Czech>Reputace</Czech>
</Key>
<Key ID="STR_BTC_HAM_DOC_REPUTATION_TEXT">
<Original>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;System:&lt;/marker&gt;&lt;br/&gt; At the beginning you have a very low reputation level, so civilians won't help you in revealing important information about the Oplitas, they will likely lie instead. Reputation can be ask to civilian. &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Data_F_Orange\Logos\arma3_orange_picture_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Good actions:&lt;/marker&gt;&lt;br/&gt; Helping the local population by fighting the Oplitas, disarming IED's, heal civilians, give banana, remove tag with spraypaint, remove tag with spraypaint red, succeed side mission and destroy cache/hideout will rise your reputation. &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\missions_f_orange\Data\Img\AAN\aan_3_4_co.paa' width='355' height='200' /&gt; &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\Ui_f\data\GUI\Cfg\Debriefing\endDefault_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Bad actions:&lt;/marker&gt;&lt;br/&gt; Bad actions cause bad effects: killing civilians/animals surrounded or captive enemy, mutilating alive/dead civilians/animals, firing near civilians for no reason, firing to civilian car, remove wheels, remove banana, damaging/destroying buildings, breaking door lock, losing player's vehicles and player respawns will decrease your reputation. Aborting a side mission does not affect reputation. &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\missions_f_orange\Data\Img\AAN\aan_3_3_co.paa' width='355' height='200'/&gt; &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Data_F_Orange\Logos\arma3_orange_artwork.jpg' width='362' height='512' /&gt; </Original>
<Original>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;System:&lt;/marker&gt;&lt;br/&gt; At the beginning you have a very low reputation level, so civilians won't help you in revealing important information about the Oplitas, they will likely lie instead. Reputation can be ask to civilian. &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Data_F_Orange\Logos\arma3_orange_picture_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Good actions:&lt;/marker&gt;&lt;br/&gt; Helping the local population by fighting the Oplitas, disarming IED's, heal civilians, put civilians killed by players in grave near church or chapel (50 m), give banana, remove tag with spraypaint, remove tag with spraypaint red, succeed side mission and destroy, cache/hideout will rise your reputation. &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\missions_f_orange\Data\Img\AAN\aan_3_4_co.paa' width='355' height='200' /&gt; &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\Ui_f\data\GUI\Cfg\Debriefing\endDefault_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Bad actions:&lt;/marker&gt;&lt;br/&gt; Bad actions cause bad effects: killing civilians/animals surrounded or captive enemy, mutilating alive/dead civilians/animals, firing near civilians for no reason, firing to civilian car, remove wheels, remove banana, damaging/destroying buildings, breaking door lock, losing player's vehicles and player respawns will decrease your reputation. Aborting a side mission does not affect reputation. &lt;br/&gt;&lt;br/&gt; &lt;img image='\a3\missions_f_orange\Data\Img\AAN\aan_3_3_co.paa' width='355' height='200'/&gt; &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Data_F_Orange\Logos\arma3_orange_artwork.jpg' width='362' height='512' /&gt; </Original>
<Spanish>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\talk_ca.paa' width='20' height='20'/&gt; La reputación se puede solicitar a los civiles&lt;br/&gt; Las malas acciones causan malos efectos sobre la reputacion.&lt;br/&gt; &lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; Ayudar a la población local luchando contra los Oplitas y desarmando los artefactos explosivos improvisados aumentará tu reputación; matar civiles, mutilar civiles vivos/muertos, disparar cerca de civiles sin razón alguna, disparar a vehículos civiles, dañar/destruir edificios, perder vehículos, respawns de jugadores disminuirá tu reputación. Al principio tienes un nivel de reputación muy bajo, por lo que los civiles no te ayudarán a revelar información importante sobre los Oplitas, es probable que mientan en su lugar.&lt;br/&gt; Abortar una misión secundaria no afecta a la reputación.</Spanish>
<German>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\talk_ca.paa' width='20' height='20'/&gt; Ihr Ansehen bei der Bevölkerung können Sie bei Zivilisten erfragen &lt;br/&gt; Schlechte bzw. böse Handlungen habe zur Folge das ihr Ansehen sinkt. &lt;br/&gt; &lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; Das Unterstützen der lokalen Bevölkerung, das Entschärfen von IEDs und der aktive Kampf gegen die Oplitas wird sich positiv auf ihr Ansehen auswirken. Negative Aktionen wie zb. das Töten oder verstümmeln von Zivlisten, das grundlose Abfeueren einer Waffe in der Nähe von Zivilisten, das Zerstören oder Beschädigen von Gebäuden, der Angriff auf zivile Fahrzeuge, der Verlust von Fahrzeugen im Allgemeinen oder das Respawnen haben hingegen einen nicht so guten Effekt. Zu Beginn ist Ihr Ansehen nur recht gering, weshalb es sein kann das Zivlisten eher zruückhaltend mit Informationen sind. In manchen Fällen werden die Zivilisten Sie auch einfach belügen.&lt;br/&gt; Das Abbrechen von Nebenaufgaben hat keine Auswirkung auf Ihr Ansehen.</German>
<Portuguese>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\talk_ca.paa' width='20' height='20'/&gt; A Reputação entre a população é obtida por meio dos civis &lt;br/&gt; Ações ruins ou más fazem a reputação diminuir. &lt;br/&gt; &lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; Ajudar a população local combatendo os inimigos e desarmando os IED's aumentará sua reputação. Matar civis, mutilar civis vivos/mortos, atirar perto de civis sem motivo, atirar nos veículos civis, danificar/destruir prédios, perder veículos civis, respawns de jogadores diminuirão a reputação. No começo, o nível de reputação é muito baixo, então, os civis não irão ajudá-lo a revelar informações importantes sobre os inimigos ou provavelmente irão mentir.&lt;br/&gt; Cancelar tarefas secundárias não afeta a reputação.</Portuguese>
Expand Down
2 changes: 1 addition & 1 deletion docs/InGame-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ When you destroy an hideout or an ammo cache, all the markers related to it will
### System:
At the beginning you have a very low reputation level, so civilians won't help you in revealing important information about the Oplitas, they will likely lie instead. Reputation can be ask to civilian.
### Good actions:
Helping the local population by fighting the Oplitas, disarming IED's, heal civilians, give banana, remove tag with spraypaint red, succeed side mission and destroy cache/hideout will rise your reputation.
Helping the local population by fighting the Oplitas, disarming IED's, heal civilians, put civilians killed by players in grave near church or chapel (50 m), give banana, remove tag with spraypaint red, succeed side mission and destroy cache/hideout will rise your reputation.
### Bad actions:
Bad actions cause bad effects: killing civilians/animals/surrounded or captive enemy, mutilating alive/dead civilians/animals, firing near civilians for no reason, firing to civilian car, remove wheels, remove banana, damaging/destroying buildings, breaking locked door, losing player's vehicles and player respawns will decrease your reputation. Aborting a side mission does not affect reputation.

Expand Down

0 comments on commit 4019a6b

Please sign in to comment.