Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
dayzintroscenexbox.c
Go to the documentation of this file.
2{
3 protected bool m_IsCharFemale;
5
13
16 protected Weather m_Weather;
17 protected Object m_Clutter;
20 protected ref TIntArray m_Date = new TIntArray;
21
23
27
32
33 //==================================
34 // DayZIntroSceneXbox
35 //==================================
37 {
38 m_MenuData = g_Game.GetMenuData();
39
40 m_LastPlayedCharacterID = m_MenuData.GetLastPlayedCharacter();
41 m_CharacterPos = "0 0 0";
42 m_CharacterDir = "0 0 0";
43
44 //g_Game.m_PlayerName = "Survivor"; //default
45 if ( m_MenuData.GetCharactersCount() == 0 )
46 {
48 }
49
50 if ( m_LastPlayedCharacterID > -1 )
51 {
52 string characterName = g_Game.GetPlayerGameName();
53 m_MenuData.GetCharacterName(m_LastPlayedCharacterID, characterName);
54 g_Game.SetPlayerGameName(characterName);
55 }
56
57 // Camera Setup
58 vector camera_position;
59 camera_position[0] = 1323.0; // X
60 camera_position[1] = 1.0; // Y
61 camera_position[2] = 1590.37; // Z
62 float camera_rotation_h = 100;
63 float camera_rotation_v = -3;
64 float camera_fov = 0.85;
65 float camera_focus_distance = 0.0;
66 float camera_focus_streght = 0.0;
67
68 // Character
69 float character_distance = 2.25;
70
71 // Camera Setup
72 m_SceneCamera = CameraCreate(camera_position, camera_rotation_h, camera_rotation_v, camera_fov, camera_focus_distance, camera_focus_streght);
73 m_SceneCamera.SetActive(true);
74
75 PPEffects.Init(); //Deprecated, left in for legacy purposes only
76
77 // Character Setup
78 vector cam_dir = m_SceneCamera.GetDirection();
79 m_CharacterPos = camera_position + ( cam_dir * character_distance );
81 m_CharacterDir = (camera_position - m_CharacterPos);
82
83 float overcast = 0.42;
84 float rain = 0.0;
85 float snowfall = 0.0;
86 float fog = 0.0;
87
88
89 m_Weather = g_Game.GetWeather();
90 m_Weather.GetOvercast().SetLimits(overcast, overcast);
91 m_Weather.GetRain().SetLimits(rain, rain);
92 m_Weather.GetSnowfall().SetLimits(snowfall, snowfall);
93 m_Weather.GetFog().SetLimits(fog, fog);
94
95 m_Weather.GetOvercast().Set(overcast, 0, 0);
96 m_Weather.GetRain().Set(rain, 0, 0);
97 m_Weather.GetSnowfall().Set(snowfall, 0, 0);
98 m_Weather.GetFog().Set(fog, 0, 0);
99
101 m_Character.LoadCharacterData(m_CharacterPos, m_CharacterDir);
102
103 m_TimerParticle.Run(0.1, this, "SetupParticles", null, false);
104 //m_TimerDate.Run(2.0, this, "SetupDate", null, false);
105 m_TimerUpdate.Run(0.5, this, "SetupCharacter", null, true);
106
107 vector clut_pos = SnapToGround( m_CharacterPos + "-1 0 0" );
108 m_Clutter = g_Game.CreateObject( "ClutterCutter2x2", clut_pos, true );
109
110 // Xbox check update
112
113 g_Game.SetHudBrightness(g_Game.GetHUDBrightnessSetting());
114
116 }
117
119 {
120 if ( m_TimerUpdate )
121 {
122 m_TimerUpdate.Stop();
123 delete m_TimerUpdate;
124 m_TimerUpdate = null;
125 }
126
127 if ( m_TimerParticle )
128 {
129 m_TimerParticle.Stop();
130 delete m_TimerParticle;
131 m_TimerParticle = null;
132 }
133
134
135 if ( m_TimerDate )
136 {
137 m_TimerDate.Stop();
138 delete m_TimerDate;
139 m_TimerDate = null;
140 }
141
143
144 g_Game.ObjectDelete( m_SceneCamera );
145
146 if ( m_MenuData )
147 {
148 m_MenuData.ClearCharacters();
149 }
150
154
156 }
157
158 protected void SetInitPostprocesses()
159 {
160 PPERequester_MenuEffects requester;
161 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
162
163 requester.SetVignetteIntensity(0.3);
164 PPERequesterBank.GetRequester(PPERequester_IntroChromAbb).Start();
165 }
166
167 //==============================================
168 // GetIntroSceneCharacter
169 //==============================================
174
175 //==================================
176 // SetupCharacter
177 //==================================
179 {
180 if ( m_Character.GetCharacterObj() )
181 {
182 vector v = m_Character.GetCharacterObj().GetOrientation();
183 v[0] = -75;
184 m_Character.GetCharacterObj().SetOrientation(v);
185 }
186 }
187
188 //==================================
189 // SetupParticles
190 //==================================
192 {
194 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1330.36 2.11628 1594.31");
195 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1333.88 1.51392 1594.88");
196 SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1331.52 2.34052 1593.55");
197
198 vector pos = m_SceneCamera.GetPosition() + m_SceneCamera.GetDirection() * 1.5;
199 vector dir = m_SceneCamera.GetDirection();
200 float temp = dir[0];
201 dir[0] = dir[2];
202 dir[2] = -temp;
203
204 vector pos_right = pos + (dir * 1.5);
205 vector pos_left = pos + (-dir * 1.5);
206
209
212 }
213
214 //==================================
215 // SetupDate
216 //==================================
218 {
219 //g_Game.GetWorld().SetDate(m_Date.Get(0), m_Date.Get(1), m_Date.Get(2), m_Date.Get(3), m_Date.Get(4));
220 //g_Game.GetWorld().SetDate(2020, 10, 15, 18, 20);
221 }
222
223 //==================================
224 // CheckXboxClientUpdateLoopStart
225 //==================================
227 {
228 if ( CheckXboxClientUpdate() )
229 {
230 m_TimerClientUpdate.Run(30, this, "CheckXboxClientUpdate", null, true);
231 }
232 }
233
234 //==================================
235 // CheckXboxClientUpdateLoopStop
236 //==================================
238 {
240 {
241 m_TimerClientUpdate.Stop();
242 delete m_TimerClientUpdate;
243 m_TimerClientUpdate = null;
244 }
245 }
246
247 //==================================
248 // CheckXboxClientUpdate
249 //==================================
251 {
253 }
254
255 //==================================
256 // CameraCreate
257 //==================================
258 protected Camera CameraCreate(vector cam_pos, float cam_rot_h, float cam_rot_v, float cam_fov, float cam_focus_dist, float cam_focus_strg)
259 {
260 Camera cam = Camera.Cast( g_Game.CreateObject("staticcamera", SnapToGround(cam_pos), true));
261 cam.SetOrientation( Vector( cam_rot_h, cam_rot_v, 0) );
262 cam.SetFOV( cam_fov );
263 cam.SetFocus(cam_focus_dist, cam_focus_strg);
264
265 return cam;
266 }
267
268 //==================================
269 // GetCamera
270 //==================================
272 {
273 return m_SceneCamera;
274 }
275
276 //==================================
277 // ResetIntroCamera
278 //==================================
280 {
281
282 }
283
284 //==================================
285 // SetCharacterFemale
286 //==================================
287 void SetCharacterFemale(bool fem)
288 {
289 m_IsCharFemale = fem;
290 }
291
292 //==================================
293 // IsCharacterFemale
294 //==================================
296 {
297 return m_IsCharFemale;
298 }
299
300 //==================================
301 // CreateRandomCharacter
302 //==================================
304 {
305 string character_name;
306 string params[2];
307
309
310 if (m_IsCharFemale)
311 {
312 character_name = m_CharPersonalityFemaleList.GetRandomElement();
313 }
314 else
315 {
316 character_name = m_CharPersonalityMaleList.GetRandomElement();
317 }
318
319 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(UpdateCharacterPos, 250);
320 }
321
323 {
324 string name;
325 BiosUserManager user_manager = g_Game.GetUserManager();
326 if( user_manager )
327 {
328 BiosUser user = user_manager.GetSelectedUser();
329 if( user )
330 {
331 g_Game.SetPlayerGameName( user.GetName() );
332 return;
333 }
334 }
336 }
337
339 {
340 if (m_Character.GetCharacterObj())
341 {
342 m_Character.GetCharacterObj().SetPosition(m_CharacterPos);
343 m_Character.GetCharacterObj().SetDirection(m_CharacterDir.Normalized() );
344 }
345 }
346
347 void SaveCharName( string name )
348 {
349 GetDayZGame().InitCharacterMenuDataInfo(m_MenuData.GetCharactersCount());
350
351 //if (!GetDayZGame().IsNewCharacter() && m_LastPlayedCharacterID > -1)
352 //{
353 m_MenuData.SetCharacterName(m_LastPlayedCharacterID, name);
354 //}
355 if (m_Character.IsDefaultCharacter())
356 {
357 g_Game.GetMenuDefaultCharacterData().SetCharacterName(name);
358 }
359 m_MenuData.SaveCharactersLocal();
360 }
361
362 // ------------------------------------------------------------
364 {
365 float pos_x = pos[0];
366 float pos_z = pos[2];
367 float pos_y = g_Game.SurfaceY(pos_x, pos_z);
368 vector tmp_pos = Vector(pos_x, pos_y, pos_z);
369 tmp_pos[1] = tmp_pos[1] + pos[1];
370
371 return tmp_pos;
372 }
373};
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
proto native owned string GetName()
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
Super root of all classes in Enforce script.
Definition enscript.c:11
ref TStringArray m_CharShoesList
ref TStringArray m_genderList
ref MenuEvaporation m_FXParticleStreamLeft
ref TStringArray m_CharPersonalityMaleList
vector SnapToGround(vector pos)
ref TStringArray m_CharShirtList
ref TStringArray m_CharPantsList
void SaveCharName(string name)
ref IntroSceneCharacter m_Character
ref MenuEvaporation m_FXParticleStreamRight
ref TStringArray m_CharPersonalityFemaleList
IntroSceneCharacter GetIntroCharacter()
ref MenuCarEngineSmoke m_FXParticleCarSmoke
Camera CameraCreate(vector cam_pos, float cam_rot_h, float cam_rot_v, float cam_fov, float cam_focus_dist, float cam_focus_strg)
ref TStringArray m_AllCharacters
void SetCharacterFemale(bool fem)
TODO doc.
Definition enscript.c:118
void IntroSceneCharacter()
Definition enmath.c:7
static bool CheckUpdate()
Static component of PPE manager, used to hold the instance.
Definition ppemanager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition ppemanager.c:27
Deprecated; 'PPEManager' used instead.
Definition ppeffects.c:3
static void Init()
Definition ppeffects.c:52
Manager class for managing Effect (EffectParticle, EffectSound).
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Weather controller.
Definition weather.c:168
DayZGame g_Game
Definition dayzgame.c:3942
DayZGame GetDayZGame()
Definition dayzgame.c:3944
const string DEFAULT_CHARACTER_NAME
Definition constants.c:985
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
Definition enscript.c:712
array< int > TIntArray
Definition enscript.c:714
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_GUI
Definition tools.c:9
PPERequesterCategory