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 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 | //============================================================================= // Spatial Fear // Class: SFCommunication // Description: Configures a communictation, that is played back at a SFPlayer. // The communication is configured by writing the text to display // in one of the CommunicationProtocol strings. // Because there is a limit of about 1200 characters in a string // you have to make sure each string does not get longer than 1200. // In any case you can branch to one of the other strings in the array // And continue the communication. // A communicationis done by writing down the communication text and // inserting some special tags in the text. // See the complete list of supported tags: // \\n - Place a plain \\n (without any brackets) inside your text, to do a newline. // <wait:number> - halts the communication for <number> of seconds // <cls> - clears the dialog screen // <showActorTip:number:TippString> Shows an actor tip on the HUD using number to index into the TippNames array to find the name of the actor to show the tip for. TippString is the string to display above the actor. // <hideActorTip> - hides the currently visible actor tip // <branch:number> - branches into a new communication, inside the communication string array (CommunicationProtocol[number]) // <event:number> - fires an event, using the name configured in Events[number] // <sound:resourcename> - plays the sound with the name: resourcename // <tickrate:floatVal> - Sets the tickrate of the running text value to floatVal, using -1 resets the tickrate to the saved tickrate before the last change. // <playanim:number> - Plays the animation with name Animations[number] on the captains head. // <playtweenanim:number:floatVal> - Plays the animation with name Animations[number] on the captains head using the passed tweenfactor to tween from the current animation to the new one. // <loopanim:number> - Loops the animation with name Animations[number] on the captains head. // <looptweenanim:number:floatVal> - Loops the animation with name Animations[number] on the captains head. The specified tween factor is used to tween from the current animation to the new one. // <askYesNo:number1:number2> - Displays a selection box asking for YES or NO. A yes selection branches to branch: number1 and a no selection to branch number2. Unsing -1 as a branch number will continue in the current branch. // <showWeaponDesc:number> - Opens the weapon description dialog on the HUD, using the data from the current weapon. If number = 1 the dialog is show, if number = 0 the dialog is hidden again. Used to introduce the weapon dialog. You should not forget to hide the window again. This will corrupt the rest of the HUD code. This function also enables the weapon descripton for the visor. // <waitForEvent:name> - Pauses the communication until this actor receives the event with the name: Events[number]. Make sure the event is fired sometime. There is no timeout. // <instantShow:floatVal:Number> - 'Hack'!! This messages shows all the text of the current branch IMMEDIATELY in the window! No running/ticking sound. So make sure you have no other markers like <sound> , ... in it, because the text is not interpreted and no markers are removed. Also make sure that the branch fits. // on one screen, CLS makes no sense for an instantShow message. With floatVal you specify, how long the message will be show, before processing goes on. With the number you specify the branch that is executed next (since the no <branch> tag will be evaluated in an instant show message. // <animRate:float> - Changes the animation rate for all subsequent playanim and loopanim calls. The default setting for playback/looping is 1.0 and should be modified with this macro. // <giveToPlayer:classname> - Add an inventory item to the players inventory. classname must be the fully qualified name of an item. E.g. SFItem.SFKeyCardB. // // Communication samples // CommunicationProtocol(0)="Hi guys, <loopanim:4>this is a communication sample.\\nFirst let's wait for 3 seconds.<wait:3>\\nNow let's clear the screen.<wait:2><cls>Now we are showing an actor tip.<showActorTip:0:This our lovely SmartVest.><wait:3>\\nJust to make sure you know it.<wait:5>\\nOK let's hide it again<wait:2><hideActorTip><cls><branch:1>" // CommunicationProtocol(1)="Now let's go on to some events.\\n<wait:3>First we will make some light<event:0><wait:3><cls>Ok maybe we want some more light<event:1><wait:3>\\nThat's all regarding events for the moment.<wait:3><cls><branch:2>" // CommunicationProtocol(2)="Let's move on to some sound.\\nStarting the sound test now!<sound:announcer.cd10><wait:2><sound:announcer.cd9><wait:2><sound:announcer.cd8><wait:2><sound:announcer.cd7><wait:2><sound:announcer.cd6><cls>Some text in between ;)\\n<sound:announcer.cd5><wait:2><sound:announcer.cd4><wait:2><sound:announcer.cd3><wait:2><sound:announcer.cd2><wait:2><sound:announcer.cd1>That's all for sounds.<wait:3><cls><branch:3>" // CommunicationProtocol(3)="Let's change the tickrate a bit.<wait:2><tickrate:0.2>\\nThis is VERY slow.<wait:2><tickrate:-1>\\nThis back to normal and now make it fast.<wait:2><cls><tickrate:0.005>OOOOOOOOOOOOOOhhhhhhhhhhhhhh veeeeeeeeeeeeeeeeeeery faaaaaaaaaaast.<wait:2><tickrate:-1><cls>Uff. Back to normal speed.<wait:3><cls><branch:4>" // CommunicationProtocol(4)="Let's do some animations.\\nLook closely at the model we are playing tree animations with a little wait in between.<playanim:1><wait:2><playanim:2><wait:2><playanim:3><wait:2><cls>Now we are playing a looping animation.<loopanim:0><wait:3><playanim:1>\\nAnd that's it.<wait:2><cls><branch:5>" // CommunicationProtocol(5)="Now we are trying to the test some stuff\\nWe want to have an\\nautomatic CLS when the end of the screen is reached.\\nline1\\nline2\\nline3\\nline4\\nline5\\nline6\\nline7\\nline8\\nok, was that enough??\\n or maybe some more\\n??<wait:3>Now we are trying to the test some stuff\\nWe want to have an\\nautomatic CLS when the end of the screen is reached, so\\nlet's add some lines, to fill the screen.\\nline1\\nline2\\nline3\\nline4\\nok, was that enough??\\n or maybe some more\\n??<wait:3><cls><branch:6>" // CommunicationProtocol(6)="A special feature is to enable HUD upgrade modules.\\n<wait:2><cls>Previously you should not be able to get a weapon description when picking up one.\\nNow we will enable this feature.<enableItemDesc><wait:3><cls>When you go on, try it and pick up a weapon.\\nBTW: The appearing dialog can be canceled with you CancelCommunication key.<wait:3><cls><branch:7>" // CommunicationProtocol(7)="A special feature is to show the weapon descripton window for the currently held weapon.<wait:2><showWeaponDesc:1><cls>Now you can start and explain the components and benefits of this visor upgrade.<wait:2><cls>Afterwards you should hide the window, to not mock up the HUD code!!!<wait:2><showWeaponDesc:0><cls>That's it for this feature.<wait:3><cls><branch:8>" // CommunicationProtocol(8)="Now we are trying to use a Yes/No selection.<wait:2>So let's ask a question:\\nDo you want YES or NO ??<wait:2><askYesNo:9:10><cls>You have decided not to branch away.<wait:3><cls><branch:11>" // CommunicationProtocol(9)="You selected YES.<wait:3><cls><branch:11>" // CommunicationProtocol(10)="You selected No.<wait:3><cls><branch:11>" // CommunicationProtocol(11)="Now we want to wait for an event.<wait:2>Hit the trigger next to the SmartVest, to continue.<waitForEvent:2><cls>Ok, you did it. Congratulations!!<wait:2><cls>" // CommunicationProtocol(12)="<instantShow:5:13>This is an instant show message.\\nNo running text and a wait for 5 secons at the end.>" // CommunicationProtocol(13)="This is the end, sorry guys.<wait:3>" // // Author: Markus Nuebel //============================================================================= class SFCommunication extends SFObject; // Communication types var enum ECommType { CT_Captain, CT_DataNode, CT_Trainer, CT_NPC, } CommunicationType; var (SpatialFear) string Title; // Title of the conversation var (SpatialFear) bool bAddToConversationHistory; // Flag to determine, if this communication has to show up in the Conversation History Window. Default: true var (SpatialFear) string DetailText[25]; // Detail text, to be displayed in browser. In case you do not want this to be generated by the system. If you think the text generated from the system does not match, add your own one here. var (SpatialFear) string CommunicationProtocol[25]; // Array of strings, that describe the communication protocol. Pleas see above for a detailed description. var (SpatialFear) name Events[25]; // Array of event names that can be refered to from the communication protocol. var (SpatialFear) name Animations[15]; // Array animation names that can be refered to from the communication protocol. var (SpatialFear) name TipNames[15]; // Array of names that can be referenced by an showActorTip tag. var (SpatialFear) ECommType Type; // Type of communication. var (SpatialFear) EFontSize FontSize; // Size of font var (SpatialFear) bool bHidePlayerHUD; // Show/Hide player HUD during conversation. Default: false var (SpatialFear) bool bPlayOnlyOnce; // Determines if this communication can be played only once, or repeatedly. Default: false (plays only once) var (SpatialFear) bool bCanBeCanceled; // Determines if this communication can be canceled. Default: true var bool m_bProcessed; // Privat: flag inicating, if the communication has already been processed. var bool m_bPaused; // Private: flag to indicate, if an event, that has been waiting for has arived. var bool m_bIsTrainer; // Private flag for the trainer hack, don't ask. var Pawn m_oEventInstigator; // Private: Reference to event instigator var Actor m_oEventActor; // Private: Reference to the actor, that constructed the event (e.g. the NPC deco actor) function PostBeginPlay() { local SFExtractionParser oParser; // Call to base class Super.PostBeginPlay(); // Check if the raw text must be extracted from the communication Protocol if(DetailText[0] == "") { oParser = Spawn(class'SFExtractionParser'); oParser.setData(Self); while(!oParser.process()) { // Nothing to do. All is done in oParser.process } // Release reference oParser = None; } } // Called when triggered by someone else. event Trigger( Actor Other, Pawn EventInstigator ) { local SFPlayer oPlayer; // Check, if currently paused, than go on again. if(m_bPaused) m_bPaused = false; // Call to base class Super.Trigger(Other, EventInstigator); // Check for SFPlayer if(EventInstigator.IsA('SFPlayer') ) { // Save reference m_oEventInstigator = EventInstigator; m_oEventActor = Other; // Call the communication function on the player oPlayer = SFPlayer(EventInstigator); if(None != oPlayer) { // Check type of communication switch(Type) { case CT_Trainer: m_bIsTrainer=true; oPlayer.addCommunication(Self); break; case CT_Captain: oPlayer.addCommunication(Self); break; case CT_DataNode: oPlayer.playCommunication(Self); break; case CT_NPC: oPlayer.playCommunication(Self); break; default: class'SFUtils'.Static.sfError("SFCommunication - Trigger: UNKNOWN communication type: " $ Type); } } } } // Marks a communication as played or read function markAsCompleted() { // Check the "play only once" flag if(bPlayOnlyOnce) m_bProcessed=true; } // CommunicationProtocol(0)="Hi guys, <loopanim:13>this is a communication sample.\\nFirst let's wait for 3 seconds.<wait:3>\\nNow let's clear the screen.<wait:2><cls>Now we are showing an actor tip.<showActorTip:0:This our lovely SmartVest.><wait:3>\\nJust to make sure you know it.<wait:5>\\nOK let's hide it again<wait:2><hideActorTip><cls><branch:1>" defaultproperties { Title="Unnamed" bAddToConversationHistory=True CommunicationProtocol(0)="Hi guys, <loopanim:13>this is a communication sample.\nFirst let's wait for 3 seconds.<wait:3>\nNow let's clear the screen.<wait:2><cls>Now we are showing an actor tip.<showActorTip:0:This our lovely SmartVest.><wait:3>\nJust to make sure you know it.<wait:5>\nOK let's hide it again<wait:2><hideActorTip><cls><branch:1>" CommunicationProtocol(1)="Now let's go on to some events.\n<wait:3>First we will make some light<event:0><wait:3><cls>Ok maybe we want some more light<event:1><wait:3>\nThat's all regarding events for the moment.<wait:3><cls><branch:2>" CommunicationProtocol(2)="Let's move on to some sound.\nStarting the sound test now!<sound:announcer.cd10><wait:2><sound:announcer.cd9><wait:2><sound:announcer.cd8><wait:2><sound:announcer.cd7><wait:2><sound:announcer.cd6><cls>Some text in between ;)\n<sound:announcer.cd5><wait:2><sound:announcer.cd4><wait:2><sound:announcer.cd3><wait:2><sound:announcer.cd2><wait:2><sound:announcer.cd1>That's all for sounds.<wait:3><cls><branch:3>" CommunicationProtocol(3)="Let's change the tickrate a bit.<wait:2><tickrate:0.2>\nThis is VERY slow.<wait:2><tickrate:-1>\nThis back to normal and now make it fast.<wait:2><cls><tickrate:0.005>OOOOOOOOOOOOOOhhhhhhhhhhhhhh veeeeeeeeeeeeeeeeeeery faaaaaaaaaaast.<wait:2><tickrate:-1><cls>Uff. Back to normal speed.<wait:3><cls><branch:4>" CommunicationProtocol(4)="Let's do some animations.\nLook closely at the model we are playing three animations with a little wait in between.<playanim:1><wait:2><playanim:2><wait:2><playanim:3><wait:2><cls>Now we are playing a looping animation.<loopanim:0><wait:3><playanim:1>\nAnd that's it.<wait:2><cls><branch:5>" CommunicationProtocol(5)="Now we are trying to the test some stuff\nWe want to have an\nautomatic CLS when the end of the screen is reached.\nline1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\nline9\nok, was that enough??\n or maybe some more\n??<wait:3>Now we are trying to the test some stuff\nWe want to have an\nautomatic CLS when the end of the screen is reached, so\nlet's add some lines, to fill the screen.\nline1\nline2\nline3\nline4\nline5\nok, was that enough??\n or maybe some more\n??<wait:3><cls><branch:6>" CommunicationProtocol(6)="A special feature is to enable HUD upgrade modules.\n<wait:2><cls>Previously you should not be able to get a weapon description when picking up one.\nNow we will enable this feature.<enableItemDesc><wait:3><cls>When you go on, try it and pick up a weapon.\nBTW: The appearing dialog can be canceled with you CancelCommunication key.<wait:3><cls><branch:7>" CommunicationProtocol(7)="A special feature is to show the weapon descripton window for the currently held weapon.<wait:2><showWeaponDesc:1><cls>Now you can start and explain the components and benefits of this visor upgrade.<wait:2><cls>Afterwards you should hide the window, to not mock up the HUD code!!!<wait:2><showWeaponDesc:0><cls>That's it for this feature.<wait:3><cls><branch:8>" CommunicationProtocol(8)="Now we are trying to use a Yes/No selection.<wait:2>So let's ask a question:\nDo you want YES or NO ??<wait:2><askYesNo:9:10><cls>You have decided not to branch away.<wait:3><cls><branch:11>" CommunicationProtocol(9)="You selected YES.<wait:3><cls><branch:11>" CommunicationProtocol(10)="You selected No.<wait:3><cls><branch:11>" CommunicationProtocol(11)="Now we want to wait for an event.<wait:2>Hit the trigger next to the SmartVest, to continue.<waitForEvent:2><cls>Ok, you did it. Congratulations!!<wait:2><cls><branch:12>" CommunicationProtocol(12)="<instantShow:5:13>This is an instant show message.\nNo running text and a wait for 5 secons at the end." CommunicationProtocol(13)="This is the end, sorry guys.<wait:3>" Events(0)=LightFire Events(1)=LightFire2 Events(2)=Continue Animations(0)=Basic Animations(1)=bLink Animations(2)=Smile Animations(3)=Angry Animations(4)=MouthA Animations(5)=MouthE Animations(6)=MouthM Animations(7)=MouthO Animations(8)=MouthC Animations(9)=MouthF Animations(10)=MouthU Animations(11)=Smirk Animations(12)=Worried Animations(13)=All TipNames(0)=SFSmartVest1 FontSize=FS_Medium bPlayOnlyOnce=True bCanBeCanceled=True m_bIsTrainer=True } |