forked from igorkis-scrts/A3-Antistasi-Plus
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathfn_initPetros.sqf
More file actions
106 lines (92 loc) · 3.29 KB
/
fn_initPetros.sqf
File metadata and controls
106 lines (92 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
Info("initPetros started");
scriptName "fn_initPetros";
petros setSkill 1;
petros setVariable ["respawning",false];
petros allowDamage false;
if (face petros != "GreekHead_A3_01") then {
[petros, createHashMapFromArray [["face", "GreekHead_A3_01"], ["speaker", "Male01GRE"], ["pitch", 1.1], ["firstName", "Petros"], ["lastName", ":)"]]] call A3A_fnc_setIdentity;
};
removeHeadgear petros;
removeGoggles petros;
private _vest = selectRandomWeighted (A3A_rebelGear get "ArmoredVests");
if (_vest == "") then { _vest = selectRandomWeighted (A3A_rebelGear get "CivilianVests") };
petros addVest _vest;
[petros, "Rifles"] call A3A_fnc_randomWeapon;
[petros, "Handguns", 10] call A3A_fnc_randomWeapon;
petros selectWeapon (primaryWeapon petros);
if (petros == leader group petros) then {
group petros setGroupIdGlobal ["Petros","GroupColor4"];
petros disableAI "MOVE";
petros disableAI "AUTOTARGET";
petros setBehaviour "SAFE";
};
// Install both moving and static actions
[petros,"petros"] remoteExec ["A3A_fnc_flagaction", 0, petros];
[petros,true] call A3A_fnc_punishment_FF_addEH;
petros addEventHandler
[
"HandleDamage",
{
_part = _this select 1;
_damage = _this select 2;
_injurer = _this select 3;
_victim = _this select 0;
_instigator = _this select 6;
if (isPlayer _injurer) then
{
_damage = (_this select 0) getHitPointDamage (_this select 7);
};
if ((isNull _injurer) or (_injurer == petros)) then {_damage = 0};
if (_part == "") then
{
if (_damage > 1) then
{
if (!(petros getVariable ["incapacitated",false])) then
{
petros setVariable ["incapacitated",true,true];
_damage = 0.9;
if (!isNull _injurer) then {[petros,side _injurer] spawn A3A_fnc_unconscious} else {[petros,sideUnknown] spawn A3A_fnc_unconscious};
}
else
{
_overall = (petros getVariable ["overallDamage",0]) + (_damage - 1);
if (_overall > 1) then
{
petros removeAllEventHandlers "HandleDamage";
}
else
{
petros setVariable ["overallDamage",_overall];
_damage = 0.9;
};
};
};
};
_damage;
}
];
petros addMPEventHandler ["mpkilled",
{
removeAllActions petros;
if (!isServer) exitWith {};
_killer = _this select 1;
if ((side _killer == Invaders) or (side _killer == Occupants) and !(isPlayer _killer) and !(isNull _killer)) then
{
garrison setVariable ["Synd_HQ", [], true];
_hr = server getVariable "hr";
_res = server getVariable "resourcesFIA";
[-1*(round(_hr*0.9)), -1*(round(_res*0.9))] spawn A3A_fnc_resourcesFIA;
[] spawn A3A_fnc_petrosDeathMonitor;
}
else
{
[] call A3A_fnc_createPetros;
};
}];
[] spawn {sleep 120; petros allowDamage true;};
[petros] call A3A_fnc_unitAmbient; // adds ambient sounds and animations to petros
private _marker = "respawn_guerrila";
_marker setMarkerType "A3AU_RebalHQ_mrk";
Info("initPetros completed");