Author Topic: Dialogs!  (Read 24205 times)

0 Members and 1 Guest are viewing this topic.

Offline Serenity

  • Level 1
  • *
  • Posts: 146
  • Karma: +15/-4
    • View Profile
Dialogs!
« on: August 24, 2007, 06:54:49 AM »
I have been looking at various npc mods and how their dialogs execute at certain times. Troubling and confusing they are. What is the best non-complicated way to do this?
Dreams are answers to questions we haven't yet figured out how to ask.  ~X-Files~

Offline theacefes

  • Global Moderator
  • Level 3
  • *****
  • Posts: 1250
  • Karma: +3/-0
  • Gender: Female
  • XTREME METAL ROCKER PUNK CHICK WITH ULTRA SURFBOARD
    • MSN Messenger - bohdi2185@msn.com
    • AOL Instant Messenger - bohdi2185
    • Yahoo Instant Messenger - theacefes@yahoo.com
    • View Profile
    • My Personal Website
    • Email
Re: Dialogs!
« Reply #1 on: August 26, 2007, 08:43:36 PM »
Many NPCs use a combination of timer triggered (a timer is set and when it goes off the npc talks) and event triggered (ie: the slayer change in spellhold) to execute talks.

My Auren Aseph mod is a very simply coded mod, in my opinion anyway, so if you need a hand on how to use timers, download it and take a look at her main script.

For example...this is a talk that Auren has with the PC right after she joins the group.

In her main script K#Auren.baf, I put this.

IF
InParty("K#Auren")           // Auren is in the party
InParty(Player1)               // The PC is in the party and therefore available for talk
!ActuallyInCombat()         // There is no fighting going on
Global("K#Friendship","GLOBAL", 0)                        // The variable that keeps track of how many times they have talked is 0, which means they have not started bantering yet
!GlobalTimerNotExpired("FriendshipT","GLOBAL")      //   The timer, called FriendshipT in this case, has expired, or run out.
THEN
RESPONSE #100         //  This is guaranteed to happen
Interact(Player1)        // Auren will start dialog with the PC
SetGlobalTimer("FriendshipT","GLOBAL",FOUR_DAYS)    // After she starts talking, the timer is set to go off again in 4 game days
END


Now, in Auren's bantering file, called K#AurenB.d, we have a list of conditions so that the game knows when to make Auren talk.

CHAIN
IF
~InParty("K#Auren")  // Auren is in the party
InParty(Player1)       // PC in party
!ActuallyInCombat()   // not fighting
!GlobalTimerNotExpired("FriendshipT","GLOBAL")   // the timer went off
!Global("Chapter","GLOBAL",5)   // It's not chapter 5, the underdark chapter
Global("K#Friendship","GLOBAL", 0)~ // They havent talked yet
THEN K#AurenB AurenPC1  // All the conditions are set, so if they are true, then the K#AurenB file can start the talk labeled AurenPC1
~So, where are you from, <CHARNAME>?  I always make it a point to discover my companions' roots before getting too deep into our travels together.~ [K#AureP8]
DO ~SetGlobal("K#Friendship", "GLOBAL", 1)~   // Make sure you set the talk variable one integer more, so that the banter cant fire again.
END
IF ~~ THEN REPLY ~I was raised in Candlekeep by Gorion, my foster father.~ GOTO AurenPC1-1
IF ~~ THEN REPLY ~I really don't feel like talking about this right now, Auren.~ GOTO AurenPC1-2



« Last Edit: August 26, 2007, 08:52:34 PM by theacefes »
-Ace
NPC Creation Guide - Latest Version
My Music Reels (mod-related and others)


Magical Unicorns - Because ponies are so last year.

theacefes: People probably look at our pictures and think "hmm one admin looks psychotic and the other looks like Captain Picard..."
grimsqueaker: TOGETHER THEY FIGHT CRIME

Offline Serenity

  • Level 1
  • *
  • Posts: 146
  • Karma: +15/-4
    • View Profile
Re: Dialogs!
« Reply #2 on: September 08, 2007, 06:45:34 PM »
Great thanks! I'll look over Auren's stuff to see how things work.
Dreams are answers to questions we haven't yet figured out how to ask.  ~X-Files~

Offline fpost230

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
    • Email
Re: Dialogs!
« Reply #3 on: January 14, 2015, 11:43:23 PM »
I have been looking at various npc mods and how their dialogs execute at certain times. Troubling and confusing they are. What is the best non-complicated way to do this?