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.
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.
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
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.
~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.
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