Skip to content

A pair of dialogue conditions I'm not certain about

chimericchimeric Member Posts: 1,163
This is a simple Intelligence check in a Weidu dialogue:

IF ~CheckStatGT(Myself,14,INT)~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",1) FadeToColor([0.0],0) Wait(2) AddexperienceParty(200) AdvanceTime(FOUR_HOURS) FadeFromColor([50.0],0) ApplySpellRES("SYSTEM_#",LastTalkedToBy("KAZAKER")) Wait(1) ActionOverride("KAZAKER",Dialogue(LastTalkedToBy("KAZAKER")))~ EXIT

IF ~CheckStatLT(Myself,15,INT)~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",2) FadeToColor([0.0],0) Wait(2) AdvanceTime(ONE_HOUR) FadeFromColor([50.0],0) Wait(1) ActionOverride("KAZAKER",Dialogue(LastTalkedToBy("KAZAKER")))~ EXIT


The first series of actions is supposed to happen if the PC is smart, the second - if less so. There is a problem with executing these series from inside the conversation, and I'd like to know why they fail, but my main question here is why does only the first option ever get selected. Even if I talk to the NPC with a stupid character, they still get the smart outcome. I can see it by the glow in the custom spell. Is it that it's actually the NPC's Intelligence that gets measured? His is 18.

Comments

  •  TheArtisan TheArtisan Member Posts: 3,277
    edited January 2017
    I'm guessing at the moment since you haven't shown the whole dialogue but I think your last comment is correct, the 'Myself' in the command is directed at the NPC. Try changing the target to 'Player1'.
  • chimericchimeric Member Posts: 1,163
    edited January 2017
    Well, I had to change it to LastTalkedToBy(), but yes, that solved the problem. It's confusing who the checks refer to, because this is the REPLY line. The player character is the one doing the talking right now.

    But about my other question: who knows what kind of action sequence I can put at the end of a dialogue, in a DO before EXIT? Simple actions do trigger, but anything with Wait() seems thrown off. And if this is not a reliable way of running actions, then what is the alternative? I wanted to set a global, fade out the screen, quickly, apply a short wait, then under this cover of darkness give some XP, advance time, apply a spell and fade in again. The final command in my intended sequence before EXIT was this: ActionOverride("KAZAKER",Dialogue(LastTalkedToBy(Myself))).

    KAZAKER is the script name of this NPC, and after an ActionOverride the subject of the action, i.e. Myself, becomes the new creature. For example, with ActionOverride("KAZAKER",Kill(Myself)) he would commit suicide. And in the case at hand Kazaker should have addressed the same PC as the last time around, i.e. resume the conversation. And, with the global set, he should have started with the proper state line. Well, if I'm writing about it on the boards, it means that doesn't happen - he doesn't begin to talk, though the fade-out occurs. Am I missing some technical detail everyone's learned ages ago, or it's just impossible to put an elaborate sequence like that before EXIT?
  • ArdanisArdanis Member Posts: 1,736
    If you afterwards talk to him manually and don't get the appropriate state, then something is wrong with your variables and state triggers. If everything is fine, try wrapping it into cutscene mode, i.e. add StartCutsceneMode() at the start - dialog automatically ends the mode, so you don't really need EndCutsceneMode() to close it. I also have prejudice against Dialog(), so maybe StartDialogNoSet(LastTalkedToBy()) will work better.
  • chimericchimeric Member Posts: 1,163
    Maybe. Thanks. Another strange thing that happens is that with StartDialog (I've never used StartDialogNoSet) characters get teleported back to the party from the NPC's location. The screen fades, the next actions written happen or not, and when it dawns, the character I sent half across the map to talk to the NPC is back with the rest of the party. This may be the reason why the dialogue won't re-initiate. Could be a hard-coded response to AdvanceTime().
  • ArdanisArdanis Member Posts: 1,736
    StartDialog() sets creature's dialog reference to the argument, so it's a pretty bad idea to use it instead of NoSet variation.
    Re teleport thing - no idea, doesn't ring any bells.
  • jasteyjastey Member Posts: 2,671
    Wait() doesn't get executed / doesn't work in dialogue. As Ardenis pointed out, it's more reliable to put the actions into a cutscene that gets compiled in an extra .baf file.
    To your "NPC is back with PC" problem: Are you sure there was no command / no script running that made the NPC return to the PC in some way? How did you apply the spell, for example, maybe it was executed by KAZAKER who had to return to the PC for it? Dialogue() makes the NPC walk all the way to the character he wants to initiate dialogue with, so maybe the NPC walked across the area before and you didn't notice because he walked back for the Dilalogue() action (I am doing wild guesses here).
    As Ardanis said, StartDialogNoSet() is to preferred, because a lot can go wrong and interrupt the NPC's action while he is still walking towards the dialogue target with Dialog() (I am writing this out of my own experience.)
  • argent77argent77 Member Posts: 3,433
    I can confirm that AdvanceTime() does some strange things with creature positions. I had to explicitly reset the position of helper creatures after using this script action in my Golem Construction mod.
  • jasteyjastey Member Posts: 2,671
    Is it only happening for the creature executing the AdvanceTime() or for everyone else, too?
  • argent77argent77 Member Posts: 3,433
    edited February 2017
    I've noticed it only for summoned helper creatures, but didn't test much further. Afair, it doesn't happen when you save and reload the game (or exit and re-enter the area) while the creature is available on the map. I tested it quite some time ago, so I don't know all the details anymore.
  • chimericchimeric Member Posts: 1,163
    In my case the party gets reassembled and the NPC remains where he was. Just as with regular resting. You might have noticed that the party appears in a nice tight formation afterwards. This may be a function of the AdvanceTime built into the full rest action.

    With argrent77's code I should be able to do ActionOverride(LastTalkedToBy("KAZAKER"),JumpToObject("KAZAKER")).
Sign In or Register to comment.