Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 |
class ActionSpeak extends ActionGoalAction; var() Name speechTag "Tag for the speech, or mojo cutscene. This should NOT include the package name"; var() bool bWaitForSpeech "If true the script will wait until the speech has finished"; var() bool bPositional "Whether the speech is to be positional or not"; // AI goal parameters var() float AIGoal_priority "Priority of AI goal (only valid if speaker is an AI)"; var() Name AIGoal_listener "Pawn the AI will speak to (only valid if target is an AI)"; var() actionnoresolve Rotator AIGoal_facing "Direction the AI will turn to if AIGoal_listener is None (only valid if speaker is an AI)"; var() bool bNeedsToTurn "If true the AIGoal_listener and AIGoal_facing values will be used"; // execute latent function Variable execute() { local float speechDuration, speechStartTime; local AI_TalkGoal goal, realGoal; local Character characterSpeaker; Super.execute(); characterSpeaker = Character(FindByLabel(class'Character', target)); if(! characterSpeaker.IsAlive()) { log("Warning: Speaker " $target $" is not alive in ActionSpeak, speech cancelled"); return None; } if(characterSpeaker != None && characterSpeaker.IsA('BaseAICharacter')) { // TODO: need code here to generate an AI_Talk goal goal = new(parentScript.Level.Outer) class'AI_TalkGoal'(); // init goal parameters: goal.priority = AIGoal_priority + (parentScript.cutscenePriority * 10); goal.lipsyncAnimName = speechTag; goal.subtitleTag = speechTag; goal.targetName = AIGoal_listener; goal.facing = AIGoal_facing; goal.bPositional = bPositional; goal.bWaitForSpeech = bWaitForSpeech; goal.bNeedsToTurn = bNeedsToTurn; goal.goalName = name $ "_TalkGoal"; // uniquely identify this TalkGoal in case we need to remove it // call postGoal function defined in "ActionGoalAction": realGoal = AI_TalkGoal(postGoal(characterSpeaker, goal)); realGoal.AddRef(); // wait for the goal to finish if(bWaitForSpeech) { while(! realGoal.hasCompleted()) { // if the script needs to exit, we should unpost the goal if(parentScript.continueExecution()) { sleep(0.0); } else { parentScript.Level.SpeechManager.CancelSpeech(characterSpeaker); unpostGoal(characterSpeaker, realGoal.goalName); break; } } } realGoal.Release(); } else { speechStartTime = parentScript.Level.TimeSeconds; speechDuration = parentScript.Level.speechManager.PlayScriptedSpeech(characterSpeaker, speechTag, bPositional); if(bWaitForSpeech) { while((speechStartTime + speechDuration) > parentScript.Level.TimeSeconds) { if(parentScript.continueExecution()) { sleep(0.0); } else { parentScript.Level.SpeechManager.CancelSpeech(characterSpeaker); break; } } } } return None; } // editorDisplayString function editorDisplayString(out string s) { s = "Character " $propertyDisplayString('target') $" speaking dialog tag " $propertyDisplayString('speechTag'); } simulated function PrecacheSpeech(SpeechManager Manager) { Manager.PrecacheVO(string(speechTag)); } defaultproperties { bWaitForSpeech = true bPositional = true bNeedsToTurn = false AIGoal_priority = 50 returnType = None actionDisplayName = "Speak" actionHelp = "Makes a character speak" category = "AudioVisual" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |