DayZ 1.24
Loading...
Searching...
No Matches
BarbedWireTrigger.c
Go to the documentation of this file.
1
3{
5 const static int SOUNDS_COLLISION_COUNT = 4;
6 const static int SOUNDS_SHOCK_COUNT = 4;
7 const static string m_SoundsCollision[SOUNDS_COLLISION_COUNT] = {"barbedFenceCollision1", "barbedFenceCollision2", "barbedFenceCollision3", "barbedFenceCollision4"};
8 const static string m_SoundsShock[SOUNDS_SHOCK_COUNT] = {"electricFenceShock1", "electricFenceShock2", "electricFenceShock3", "electricFenceShock4"};
9
10 // When a player / AI touches the Barbed Wire
11 override void OnEnter(Object obj)
12 {
13 if (g_Game.IsServer())
14 {
16 {
17 if (obj.IsInherited(PlayerBase))
18 {
19 // When a player touches the barbed wire
20 string cfg = "CfgVehicles BarbedWire barbedWireShockEnergyConsumption";
21 float needed_energy = GetGame().ConfigGetFloat(cfg);
22 bool energy_consumed = m_ParentBarbedWire.GetCompEM().ConsumeEnergy(needed_energy);
23 PlayerBase player = PlayerBase.Cast(obj);
24
26 {
27 // TO DO:
28 // -Do electrical damage.
29 // -Cause bleeding?
30 // -Do some damage!
31
32 player.MessageImportant("*SCRATCH and ELECTROCUTION*");
33
34 // Play sound
37 }
38 else
39 {
40 // TO DO:
41 // -Cause bleeding?
42 // -Do some damage!
43
44 player.MessageImportant("*SCRATCH*");
45
46 // Play sound
48 }
49 }
50 else
51 {
52 // When an AI Agent touches the barbed wire
53 if (obj.IsInherited(ManBase))
54 {
55 ManBase AI_unit = ManBase.Cast(obj);
56 AI_unit.SetHealth("", "", 0);
57 }
58 }
59 }
60 }
61 }
62
63 // Sets parent object for this trigger
65 {
66 if (g_Game.IsServer())
68 }
69
70 // Plays an electric shock sound
77
78 // Plays a collision sound
85}
DayZGame g_Game
Definition DayZGame.c:3528
void PlaySound()
DEPRECATED UNUSED prototype for damage by BarbedWire, do not use as example.
static const int SOUNDS_SHOCK_COUNT
void SetParentObject(ItemBase wire)
static const string m_SoundsShock[SOUNDS_SHOCK_COUNT]
static const int SOUNDS_COLLISION_COUNT
static const string m_SoundsCollision[SOUNDS_COLLISION_COUNT]
override void OnEnter(Object obj)
Definition EnMath.c:7
Scripted Trigger.
Definition Hologram.c:1518
proto native CGame GetGame()
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].