Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
wreck_santassleigh.c
Go to the documentation of this file.
1//Christmas Event: Santa's Sleigh
2class Wreck_SantasSleigh extends CrashBase
3{
4 XmasSleighLight m_SleighLight;
5
10
12 {
13 if (!g_Game.IsDedicatedServer())
14 {
15 //particles - Aurora trail
16 m_ParticleEfx = ParticleManager.GetInstance().PlayOnObject(ParticleList.AURORA_SANTA_WRECK,this,vector.Zero,vector.Zero,true);
17
18 //lights - green light
19 m_SleighLight = XmasSleighLight.Cast(ScriptedLightBase.CreateLight(XmasSleighLight,vector.Zero));
20 m_SleighLight.AttachOnMemoryPoint(this, "light");
21 }
22 }
23
24 // needs to have the soundset registered in CrashBase.Init()
25 override string GetSoundSet()
26 {
27 return "SledgeCrash_Distant_SoundSet";
28 }
29
30 override void EEOnCECreate()
31 {
32 super.EEOnCECreate();
34 }
35
36 override void EEDelete(EntityAI parent)
37 {
38 super.EEDelete(parent);
39
40 if ( !g_Game.IsDedicatedServer() )
41 {
42 if ( m_SleighLight )
43 m_SleighLight.Destroy();
44 }
45 }
46
48 {
49 //SpawnRandomDeers();
50 g_Game.GetCallQueue( CALL_CATEGORY_GAMEPLAY ).CallLater( SpawnRandomDeers, 0);
51 }
52
53 //Spawn a random amount of (dead) deers around the sleigh
55 {
56 EntityAI deer;
57 vector crash_pos = GetPosition();
58
60
61 for (int i = 0; i < m_MaxDeersAmount; i++)
62 {
63 vector deer_pos = RandomizePosition(crash_pos);
64 deer = EntityAI.Cast(g_Game.CreateObject("Animal_RangiferTarandus", deer_pos,false, true));
65 deer.SetHealth01("","", 0);
66 vector orientation = deer.GetOrientation();
67 deer.SetOrientation(Vector(Math.RandomIntInclusive(0,360),orientation[1],orientation[2]));
68 }
69
70 //spawns xmas reindeer
71 deer_pos = RandomizePosition(crash_pos);
72 deer = EntityAI.Cast(g_Game.CreateObject("Animal_RangiferTarandus_Xmas", deer_pos,false, true));
73 deer.SetHealth01("","", 0);
74 vector redorientation = deer.GetOrientation();
75 deer.SetOrientation(Vector(Math.RandomIntInclusive(0,360),redorientation[1],redorientation[2]));
76
77 }
78
79 //Return a new vector scattered around origin.
81 {
82 int randX;
83 int randZ;
84
86 if (Math.RandomIntInclusive(0,1) < 1)
87 randX = -randX;
88
90 if (Math.RandomIntInclusive(0,1) < 1)
91 randZ = -randZ;
92
93 origin[0] = origin[0] + randX;
94 origin[2] = origin[2] + randZ;
95
96 return origin;
97
98 }
99}
void SpawnRandomDeerLater()
void SpawnRandomDeers()
override void EEOnCECreate()
XmasSleighLight m_SleighLight
override string GetSoundSet()
vector RandomizePosition(vector origin)
override void EEDelete(EntityAI parent)
void Wreck_SantasSleigh()
Definition enmath.c:7
static const int AURORA_SANTA_WRECK
static const vector Zero
Definition enconvert.c:123
DayZGame g_Game
Definition dayzgame.c:3942
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition enmath.c:54
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
void RandomizePosition()
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).