DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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
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 {
53 }
54
55 // Camera Setup
56 vector camera_position;
57 camera_position[0] = 1323.0; // X
58 camera_position[1] = 1.0; // Y
59 camera_position[2] = 1590.37; // Z
60 float camera_rotation_h = 100;
61 float camera_rotation_v = -3;
62 float camera_fov = 0.85;
63 float camera_focus_distance = 0.0;
64 float camera_focus_streght = 0.0;
65
66 // Character
67 float character_distance = 2.25;
68
69 // Camera Setup
70 m_SceneCamera = CameraCreate(camera_position, camera_rotation_h, camera_rotation_v, camera_fov, camera_focus_distance, camera_focus_streght);
71 m_SceneCamera.SetActive(true);
72
73 PPEffects.Init(); //Deprecated, left in for legacy purposes only
74
75 // Character Setup
76 vector cam_dir = m_SceneCamera.GetDirection();
77 m_CharacterPos = camera_position + ( cam_dir * character_distance );
79 m_CharacterDir = (camera_position - m_CharacterPos);
80
82 m_Character.LoadCharacterData(m_CharacterPos, m_CharacterDir);
83
84 m_TimerParticle.Run(0.1, this, "SetupParticles", null, false);
85 //m_TimerDate.Run(2.0, this, "SetupDate", null, false);
86 m_TimerUpdate.Run(0.5, this, "SetupCharacter", null, true);
87
88 vector clut_pos = SnapToGround( m_CharacterPos + "-1 0 0" );
89 m_Clutter = GetGame().CreateObject( "ClutterCutter2x2", clut_pos, true );
90
91 // Xbox check update
93
94 g_Game.SetHudBrightness(g_Game.GetHUDBrightnessSetting());
95
97 }
98
100 {
101 if ( m_TimerUpdate )
102 {
104 delete m_TimerUpdate;
105 m_TimerUpdate = null;
106 }
107
108 if ( m_TimerParticle )
109 {
111 delete m_TimerParticle;
112 m_TimerParticle = null;
113 }
114
115
116 if ( m_TimerDate )
117 {
119 delete m_TimerDate;
120 m_TimerDate = null;
121 }
122
124
126
127 if ( m_MenuData )
128 {
130 }
131
135
137 }
138
139 protected void SetInitPostprocesses()
140 {
141 PPERequester_MenuEffects requester;
142 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
143
144 requester.SetVignetteIntensity(0.3);
145 PPERequesterBank.GetRequester(PPERequester_IntroChromAbb).Start();
146 }
147
148 //==============================================
149 // GetIntroSceneCharacter
150 //==============================================
152 {
153 return m_Character;
154 }
155
156 //==================================
157 // SetupCharacter
158 //==================================
160 {
161 if ( m_Character.GetCharacterObj() )
162 {
163 vector v = m_Character.GetCharacterObj().GetOrientation();
164 v[0] = -75;
165 m_Character.GetCharacterObj().SetOrientation(v);
166 }
167 }
168
169 //==================================
170 // SetupParticles
171 //==================================
173 {
175 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1330.36 2.11628 1594.31");
176 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1333.88 1.51392 1594.88");
177 SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1331.52 2.34052 1593.55");
178
179 vector pos = m_SceneCamera.GetPosition() + m_SceneCamera.GetDirection() * 1.5;
180 vector dir = m_SceneCamera.GetDirection();
181 float temp = dir[0];
182 dir[0] = dir[2];
183 dir[2] = -temp;
184
185 vector pos_right = pos + (dir * 1.5);
186 vector pos_left = pos + (-dir * 1.5);
187
190
193 }
194
195 //==================================
196 // SetupDate
197 //==================================
199 {
200 //g_Game.GetWorld().SetDate(m_Date.Get(0), m_Date.Get(1), m_Date.Get(2), m_Date.Get(3), m_Date.Get(4));
201 //g_Game.GetWorld().SetDate(2020, 10, 15, 18, 20);
202 }
203
204 //==================================
205 // CheckXboxClientUpdateLoopStart
206 //==================================
208 {
209 if ( CheckXboxClientUpdate() )
210 {
211 m_TimerClientUpdate.Run(30, this, "CheckXboxClientUpdate", null, true);
212 }
213 }
214
215 //==================================
216 // CheckXboxClientUpdateLoopStop
217 //==================================
219 {
221 {
223 delete m_TimerClientUpdate;
224 m_TimerClientUpdate = null;
225 }
226 }
227
228 //==================================
229 // CheckXboxClientUpdate
230 //==================================
232 {
234 }
235
236 //==================================
237 // CameraCreate
238 //==================================
239 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)
240 {
241 Camera cam = Camera.Cast( g_Game.CreateObject("staticcamera", SnapToGround(cam_pos), true));
242 cam.SetOrientation( Vector( cam_rot_h, cam_rot_v, 0) );
243 cam.SetFOV( cam_fov );
244 cam.SetFocus(cam_focus_dist, cam_focus_strg);
245
246 return cam;
247 }
248
249 //==================================
250 // GetCamera
251 //==================================
253 {
254 return m_SceneCamera;
255 }
256
257 //==================================
258 // ResetIntroCamera
259 //==================================
261 {
262
263 }
264
265 //==================================
266 // SetCharacterFemale
267 //==================================
268 void SetCharacterFemale(bool fem)
269 {
270 m_IsCharFemale = fem;
271 }
272
273 //==================================
274 // IsCharacterFemale
275 //==================================
277 {
278 return m_IsCharFemale;
279 }
280
281 //==================================
282 // CreateRandomCharacter
283 //==================================
285 {
286 string character_name;
287 string params[2];
288
290
291 if (m_IsCharFemale)
292 {
293 character_name = m_CharPersonalityFemaleList.GetRandomElement();
294 }
295 else
296 {
297 character_name = m_CharPersonalityMaleList.GetRandomElement();
298 }
299
301 }
302
304 {
305 string name;
306 BiosUserManager user_manager = GetGame().GetUserManager();
307 if( user_manager )
308 {
309 BiosUser user = user_manager.GetSelectedUser();
310 if( user )
311 {
312 g_Game.SetPlayerGameName( user.GetName() );
313 return;
314 }
315 }
317 }
318
320 {
321 if (m_Character.GetCharacterObj())
322 {
323 m_Character.GetCharacterObj().SetPosition(m_CharacterPos);
324 m_Character.GetCharacterObj().SetDirection(m_CharacterDir.Normalized() );
325 }
326 }
327
328 void SaveCharName( string name )
329 {
330 GetDayZGame().InitCharacterMenuDataInfo(m_MenuData.GetCharactersCount());
331
332 //if (!GetDayZGame().IsNewCharacter() && m_LastPlayedCharacterID > -1)
333 //{
335 //}
336 if (m_Character.IsDefaultCharacter())
337 {
339 }
341 }
342
343 // ------------------------------------------------------------
345 {
346 float pos_x = pos[0];
347 float pos_z = pos[2];
348 float pos_y = GetGame().SurfaceY(pos_x, pos_z);
349 vector tmp_pos = Vector(pos_x, pos_y, pos_z);
350 tmp_pos[1] = tmp_pos[1] + pos[1];
351
352 return tmp_pos;
353 }
354};
DayZGame g_Game
Definition DayZGame.c:3654
DayZGame GetDayZGame()
Definition DayZGame.c:3656
PPERequesterCategory
string name
proto native owned string GetName()
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
proto native void ObjectDelete(Object obj)
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition Game.c:1392
proto native Object CreateObject(string type, vector pos, bool create_local=false, bool init_ai=false, bool create_physics=true)
Creates object of certain type.
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
proto native BiosUserManager GetUserManager()
proto native float SurfaceY(float x, float z)
Super root of all classes in Enforce script.
Definition EnScript.c:11
protected ref MenuEvaporation m_FXParticleStreamLeft
protected int m_LastPlayedCharacterID
protected ref MenuEvaporation m_FXParticleStreamRight
protected ref MenuCarEngineSmoke m_FXParticleCarSmoke
protected ref TStringArray m_genderList
protected ref TIntArray m_Date
protected Weather m_Weather
protected ref IntroSceneCharacter m_Character
vector SnapToGround(vector pos)
protected ref TStringArray m_CharShirtList
protected MenuData m_MenuData
void SaveCharName(string name)
protected ref TStringArray m_CharPantsList
protected Object m_Clutter
protected ref TStringArray m_CharPersonalityFemaleList
protected bool m_IsCharFemale
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)
protected void SetInitPostprocesses()
protected vector m_CharacterPos
IntroSceneCharacter GetIntroCharacter()
protected vector m_CharacterDir
protected ref TStringArray m_CharPersonalityMaleList
protected ref TStringArray m_CharShoesList
protected Camera m_SceneCamera
protected ref TStringArray m_AllCharacters
void SetCharacterFemale(bool fem)
TODO doc.
Definition EnScript.c:118
void IntroSceneCharacter()
Definition EnMath.c:7
proto native int GetCharactersCount()
proto native int GetLastPlayedCharacter()
proto native void SetCharacterName(int index, string newName)
proto void GetCharacterName(int index, out string name)
proto native void ClearCharacters()
proto native void SaveCharactersLocal()
Saves characters menu data to file.
void SetCharacterName(string name)
Definition gameplay.c:1049
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.
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
override void Stop()
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
proto native CGame GetGame()
const string DEFAULT_CHARACTER_NAME
Definition constants.c:823
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< int > TIntArray
Definition EnScript.c:687
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