Skip to content

NPC OnConversation event issue.

NeverwinterWightsNeverwinterWights Member Posts: 339
edited July 2018 in Builders - Scripting
If I remember right the OnConversation event also acts as an OnClick event for npcs. Maybe not, it's been awhile since I've used it. I've been trying to get NPCs to speak a random one line greeting (not using an actual conversation) using this event. Seems like it should be simple enough but isn't working.

void main() { string sTag = GetTag(OBJECT_SELF); //if (sTag == "BEGGAR_MALE" || sTag == "BEGGAR_FEMALE") //{ string sGreet; switch (Random(5)) { case 0: sGreet = "I haven't eaten in days."; break; case 1: sGreet = "Please. Can you spare a gold piece?"; break; case 2: sGreet = "Please show pity on me."; break; case 3: sGreet = "I'm down on my luck. I just need a little coin."; break; case 4: sGreet = "Help out a wounded adventurer?"; break; } //ActionSpeakString(sGreet); FloatingTextStringOnCreature(sGreet, OBJECT_SELF); //} PlayVoiceChat(VOICE_CHAT_HELLO, OBJECT_SELF); //ExecuteScript("nw_c2_default4", OBJECT_SELF); }

Comments

  • pscythepscythe Member Posts: 116
    Just use the default OnConversation script but put the lines in an actual conversation and use random in the "text appears when" scripts to decide which lines to say. Just make sure that the lines are one liners, that is no "[continue]" or "[end conversation]"'.
  • ShadooowShadooow Member Posts: 402
    Your problem is most likely the function FloatingTextStringOnCreature, you don't want to use that one but SpeakString instead.
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Shadooow said:

    Your problem is most likely the function FloatingTextStringOnCreature, you don't want to use that one but SpeakString instead.

    I tried SpeakString also, that's why it's commented out. Nothing seems to work in the script. Is the npc OBJECT_SELF in the OnConversation event?
    pscythe said:

    Just use the default OnConversation script but put the lines in an actual conversation and use random in the "text appears when" scripts to decide which lines to say. Just make sure that the lines are one liners, that is no "[continue]" or "[end conversation]"'.

    Trying to avoid this method so I don't have a bunch of text appears scripts.
  • ShadooowShadooow Member Posts: 402
    your script has ActionSpeakString, not SpeakString i suggested, it is possible that the action won't work because the action queve is modified by player clicking on that npc?

    either way, this *should* work, so I recommend to debug your script,

    here tutorial for debugging: https://neverwintervault.org/article/tutorial/script-debugging-tutorial
  • pscythepscythe Member Posts: 116
    edited July 2018
    Just tried it out. SpeakString works.

    Bioware's comment on SpeakString, the keyword is immediately

    // The caller will immediately speak sStringToSpeak (this is different from
    // ActionSpeakString)
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Yep it was the action queue. I'd completely forgotten that there was also a SpeakString without the action and I have the npcs spawn sitting (action). Thanks @Shadooow and @pscythe .
Sign In or Register to comment.