×
Меню
Индекс

MSFD Initiating and ending dialogue

 
ForceGreeting
 
ForceGreeting can be used to make Actors initiate dialogue. When ForceGreeting is called the dialogue window will open, and the Actor will use a greeting according to his dialogue settings. Therefore, if you want a special greeting by the Actor, you have to provide it via the dialogue window in the TES CS. It does not matter where the NPC is, this function will always work, so its usually best used in connection with a GetDistance or GetPCCell condition.
 
Note that ForceGreeting will not work remotely if the player has not encountered the NPC in the last 72 game hours, unless the NPC has "corpses persist" checked (in which case it will work as long as the player has encountered the NPC at some point during the game). This also applies to the "Talked to PC" flag. -(Forum info/Neko)
An alternative workaround: If you use PositionCell on the NPC once per day (even without changing their location), the 72 hour time limit no longer applies (Forum info /Time limit info from Cortex, thanks to Srikandi for bringing it to my attention). This trick to get around Actors breaking their connection to you after 72 hours seems to require the cell you send them to to not be the cell where you initially met them (Forum info / Cortex). This either implies it must not be their editor starting cell or that it must be a cell that you have not visited. In my fix I have an interior I send them to for this purpose so either explanation could be why it works. So basically after you have met them they get sent there each day even though they are already there after the first sending.
See the "72-hours bug" section under "Tips and Tricks" for more information.
 
Using ForceGreeting in dialogue results for a greeting can be a useful trick in some circumstances, usually to have a resultbox script executed without providing extra, unique text for it (you can just use a dot "." as the text). The NPC will then give whatever greeting would normally be given, with just an easily-ignored dot above as evidence that your resultbox script was executed. Note that you must change the tested conditions in the resultbox script - otherwise it will loop continuously and crash the game!
Note also that if an NPC's "Talked to PC" flag is set by your "fake" greeting, any normal greetings that rely on it won't be given. If this is an issue, you could filter your fake greeting for "Talked to PC != 0" to avoid this (the player will then have to talk to the NPC a second time before your script runs).
 
Example Script: this script shows a nice set of condition being checked before initiating the ForceGreeting command
 
Begin balynScript
 
float timer
short doOnce
 
if ( GetJournalIndex "DA_Mephala" < 40 )
     Return
endif
if ( GetJournalIndex DA_Mephala >= 60 )
     Return
endif
Set timer to ( timer + GetSecondsPassed )
if ( timer < 5 )
     Return
endif
 
Set timer to 0
 
if ( doOnce == 0 )
     if ( GetDistance Player <= 1024 )
          if ( player->GetDistance "hlaalu_loaddoor_ 02_balyn" <= 256 )
               if ( GetLOS Player == 1 )
                    ForceGreeting
                    Journal DA_Mephala 55
                    set doOnce to -1
               endif
          endif
     endif
endif
 
End
 
Note: If you use ForceGreeting from within an if block, the script will continue to execute the remaining elseif/else tests instead of skipping over them (as it should). To avoid this, add a return after the ForceGreeting.
 
This script will print the messagebox:
if ( ( Actor_ID->GetDisposition ) >= 80 )
  Actor_ID->ForceGreeting
else
  MessageBox "I'm not talking to you!"
endif
 
Here is the corrected version:
if ( ( Actor_ID->GetDisposition ) >= 80 )
  Actor_ID->ForceGreeting
  return
else
  MessageBox "I'm not talking to you!"
endif
 
 
Goodbye
 
Goodbye forces the end of dialogue: after calling this function the PC can only choose the goodbye option and thus close the dialogue window. Usually this function is used in the result section of a dialogue topic, not in scripts; however, it can be used in scripts if the dialogue window is open.