1 #using scripts\shared\math_shared;
2 #using scripts\shared\util_shared;
4 #insert scripts\shared\shared.gsh;
6 #precache( "lui_menu", "TempDialog" );
7 #precache( "lui_menu_data", "dialogText" );
8 #precache( "lui_menu_data", "title" );
18 if (level.disableGenericDialog)
30 typeString =
"attack";
43 /#println (
"Unexpected generic dialog string: "+typeString);#/
58 if( isdefined(
self.dds_characterID ) )
60 soundAlias +=
self.dds_characterID;
64 /#printLn(
"this AI does not have a dds_characterID" );#/
68 soundAlias +=
"_" + typeString;
70 if(SoundExists(soundAlias))
78 self.a.idleFace = facialAnimationArray;
86 if (!anim.useFacialAnims)
91 self.a.idleFace = facialAnimationArray;
106 function SaySpecificDialogue(facialanim, soundAlias, importance, notifyString, waitOrNot, timeToWait, toplayer)
109 self thread
PlayFaceThread(facialanim, soundAlias, importance, notifyString, waitOrNot, timeToWait, toplayer);
168 function PlayFaceThread( facialanim, str_script_alias, importance, notifyString, waitOrNot, timeToWait, toplayer )
180 self endon(
"death" );
182 if ( !isdefined( str_script_alias ) )
185 self notify( notifyString );
189 str_notify_alias = str_script_alias;
191 DEFAULT( level.NumberOfImportantPeopleTalking, 0 );
192 DEFAULT( level.TalkNotifySeed, 0 );
193 DEFAULT( notifyString,
"PlayFaceThread " + str_script_alias );
198 if (
self.isTalking )
201 if ( IsDefined(
self.
a.currentDialogImportance ) )
203 if ( importance <
self.
a.currentDialogImportance )
206 self notify( notifyString );
209 else if ( importance ==
self.
a.currentDialogImportance )
211 if (
self.
a.facialSoundAlias == str_script_alias )
216 /# println(
"WARNING: delaying alias " +
self.
a.facialSoundAlias +
" to play " + str_script_alias ); #/
218 while (
self.isTalking )
220 self waittill(
"done speaking" );
226 /# PrintLn(
"WARNING: interrupting alias "+
self.
a.facialSoundAlias+
" to play "+str_script_alias); #/
228 self StopSound(
self.
a.facialSoundAlias );
229 self notify(
"cancel speaking");
231 while (
self.isTalking )
233 self waittill(
"done speaking" );
238 assert(
self.
a.facialSoundDone );
239 assert(
self.
a.facialSoundAlias == undefined );
240 assert(
self.
a.facialSoundNotify == undefined );
241 assert(
self.
a.currentDialogImportance == undefined );
242 assert( !
self.isTalking );
244 self notify(
"bc_interrupt" );
246 self.isTalking =
true;
247 self.a.facialSoundDone =
false;
248 self.a.facialSoundNotify = notifyString;
249 self.a.facialSoundAlias = str_script_alias;
250 self.a.currentDialogImportance = importance;
252 if ( importance == 1.0 )
254 level.NumberOfImportantPeopleTalking += 1;
259 if ( level.NumberOfImportantPeopleTalking > 1 )
261 println(
"WARNING: multiple high priority dialogs are happening at once " + str_script_alias );
266 uniqueNotify = notifyString +
" " + level.TalkNotifySeed;
268 level.TalkNotifySeed += 1;
270 if ( isdefined( level.scr_sound ) && isdefined( level.scr_sound[
"generic" ] ) )
272 str_vox_file = level.scr_sound[
"generic" ][ str_script_alias ];
275 if ( isdefined( str_vox_file ) )
277 if ( SoundExists( str_vox_file ) )
279 if ( IsPlayer( toplayer ) )
285 if ( isdefined(
self GetTagOrigin(
"J_Head" ) ) )
287 self PlaySoundWithNotify( str_vox_file, uniqueNotify,
"J_Head" );
291 self PlaySoundWithNotify( str_vox_file, uniqueNotify );
298 PrintLn(
"WARNING: DIALOG VO SOUND: '" + str_script_alias +
"' does not exist." );
299 self thread
_missing_dialog( str_script_alias, str_vox_file, uniqueNotify );
310 if ( importance == 1.0 )
312 level.NumberOfImportantPeopleTalking -= 1;
313 level.ImportantPeopleTalkingTime = GetTime();
316 if ( isdefined(
self ) )
318 self.isTalking =
false;
319 self.a.facialSoundDone =
true;
320 self.a.facialSoundNotify = undefined;
321 self.a.facialSoundAlias = undefined;
322 self.a.currentDialogImportance = undefined;
323 self.lastSayTime = GetTime();
326 self notify(
"done speaking", str_notify_alias );
327 self notify( notifyString );
335 self endon(
"death" );
336 toplayer endon(
"death" );
338 self PlaySoundToPlayer( soundAlias, toplayer );
339 n_playbackTime = SoundGetPlaybackTime( soundAlias );
341 if ( n_playbackTime > 0 )
343 wait n_playbackTime * .001;
350 self notify( uniqueNotify );
353 function private _temp_dialog( str_line, uniqueNotify, b_missing_vo =
false )
355 SetDvar(
"bgcache_disablewarninghints", 1 );
357 if ( !b_missing_vo && isdefined(
self.propername ) )
359 str_line =
self.propername +
": " + str_line;
362 foreach ( player
in level.players )
364 if ( !isdefined( player GetLUIMenu(
"TempDialog" ) ) )
366 player OpenLuiMenu(
"TempDialog" );
369 player SetLuiMenuData( player GetLUIMenu(
"TempDialog" ),
"dialogText", str_line );
373 player SetLuiMenuData( player GetLUIMenu(
"TempDialog" ),
"title",
"MISSING VO SOUND" );
377 player SetLuiMenuData( player GetLUIMenu(
"TempDialog" ),
"title",
"TEMP VO" );
382 n_wait_time = ( StrTok( str_line,
" ").size - 1 ) / 2;
386 foreach ( player
in level.players )
388 if ( isdefined( player GetLUIMenu(
"TempDialog" ) ) )
390 player CloseLUIMenu( player GetLUIMenu(
"TempDialog" ) );
394 SetDvar(
"bgcache_disablewarninghints", 0 );
396 self notify( uniqueNotify );
401 _temp_dialog(
"script id: " + str_script_alias +
" sound alias: " + str_vox_file, uniqueNotify,
true );
406 self endon (
"death");
407 self endon (killmeString);
408 self waittill (waitForString);
409 self.a.faceWaitForResult =
"notify";
410 self notify (notifyString);
415 self endon (
"death");
416 self endon (killmeString);
418 self.a.faceWaitForResult =
"time";
419 self notify (notifyString);