Jump to content

Stuttering NPC


theacefes

Recommended Posts

The same thing happened to Auren. I set up a timer for her banters and she simply continues to attempt dialogue (before the time allowed passes) and it 'stutters'. I am unable to rest, etc.

 

Timer block:

 

IF
InParty("K#Sarah")
InParty(Player1)
!ActuallyInCombat()
Global("SarahPreTalk","GLOBAL", 1)
!GlobalTimerNotExpired("SarahTimerPre","GLOBAL")
THEN
RESPONSE #100
Interact(Player1) 
RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800)
END

 

Banter Trigger Block

 

IF 
~InParty("K#Sarah")
InParty(Player1)
!ActuallyInCombat()
Global("SarahPreTalk","GLOBAL", 1)
!RealGlobalTimerNotExpired("SarahTimerPre","GLOBAL")~
THEN K#SarahB PreTalk1

 

Any suggestions? Why do the real timers I use cause a stutter but the game time ones do not (Auren uses an ingame timer).

 

Thanks in advance!

Link to comment

I think what you're having here is a big mix of RealGlobal timers, just Global timers, and no check variables. Which is bad.

 

You want

 

/* here goes block with setting of the timer for the first time and

setting SetGlobal("SarahPreTalk","GLOBAL",1) - you'd better post it, too, since I have my suspicions */

 

IF

RealGlobalTimerExpired("SarahTimerPre","GLOBAL")

InParty("K#Sarah")

InParty(Player1)

// better add checks about CD_STATE_NOT_VALID - see BG1 NPC/Xan/Gavin for examples

!ActuallyInCombat()

Global("SarahPreTalk","GLOBAL", 1)

THEN

RESPONSE #100

Interact(Player1)

END

 

 

Banter Trigger Block

 

 

CODE

IF

~Global("SarahPreTalk","GLOBAL", 1)~

THEN K#SarahB PreTalk1

 

And you *need*, need, need to set

SetGlobal("SarahPreTalk","GLOBAL", 2) and, if you so wish,

RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800) in this banter.

Link to comment

IF

Global("SarahJoined", "LOCALS", 1)

!RealGlobalTimerNotExpired("SarahTimerPre","GLOBAL")

THEN

RESPONSE #100

SetGlobal("SarahPreTalk","GLOBAL",1)

RealSetGlobalTimer("SarahTimerPre","GLOBAL",900)

END

 

There is the setting of the PreTalk global to 1.

 

So my problem seems to be that I need to set the timer again in the banter itself then, NOT in the script that's running it? Am I understanding this correctly?

 

EDIT: Also, that I am repeating the conditions needlessly in the banter trigger?

Link to comment

All right, let's see if I got this right.

 

This is what sets the pretalk global to 1

 

IF

Global("SarahJoined", "LOCALS", 1)

RealGlobalTimerExpired("SarahTimerPre","GLOBAL")

THEN

RESPONSE #100

SetGlobal("SarahPreTalk","GLOBAL",1)

END

 

This is the banter trigger:

 

CHAIN

IF

~Global("SarahPreTalk","GLOBAL", 1)~

THEN K#SarahB PreTalk1

 

Still a stutter. I set the timer again in the banter as well as the joining dlg where that joining global takes place.

Link to comment

Well, that's what I'm telling you - you don't write blocks like that, you add a check variable in every script block you have.

 

(By the way, you really need a prefix for your mod, otherwise Sarah may wind up uncompatible with pretty much everything. Look at BWL forums, they have a prefix list).

So, in each block you have to have a 'check' variable: so that it has one value in the upper part of the block, but is set to a different value in the lower part of the block. This way, it wouldn't stutter.

 

IF

Global("SarahJoined", "LOCALS", 1)

Global("SarahPreTalk","GLOBAL",0)

THEN

RESPONSE #100

SetGlobal("SarahPreTalk","GLOBAL",1)

RealSetGlobalTimer("SarahTimerPre","GLOBAL",900)

END

 

IF

RealGlobalTimerExpired("SarahTimerPre","GLOBAL")

InParty("K#Sarah")

InParty(Player1)

/* better add checks about CD_STATE_NOT_VALID - see BG1 NPC/Xan/Gavin */

!ActuallyInCombat()

Global("SarahPreTalk","GLOBAL", 1)

THEN

RESPONSE #100

Interact(Player1)

END

 

// Banter Trigger Block

 

APPEND K#SarahB // are you sure this is Sarah's B file?

 

IF ~Global("SarahPreTalk","GLOBAL", 1)~ THEN PreTalk1

SAY ~My script doesn't stutter anymore!~

++ ~Really?~ DO ~SetGlobal("SarahPreTalk","GLOBAL", 2) RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800)~ + PreTalk1.1

++ ~Cool!~ DO ~SetGlobal("SarahPreTalk","GLOBAL", 2) RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800)~ + PreTalk1.2

END

 

END

 

- something like this won't stutter.

Link to comment

No, there was no stutter, but it didn't fire either.

 

And yeah, I'm fairly certain that I have the right banter file name. As soon as I remove the timers, the banters fire one after the other, so I know they work (the banters).

 

EDIT: for clarification

 

By the way, thanks for helping me with this.

Link to comment

It might be not about SarahJoined - you said it stuttered before, so it probably swallows this variable nicely.

 

Would you please post the code you have now, script/banter, so we're looking at the same thing? (I'll go and have lunch soonish, but I'll be back.)

Link to comment

Sorry for the delay, had to sleep (timezones, ugh). Here you are. It should be what I copied from you earlier.

 

Script:

 

IF

Global("SarahJoined", "LOCALS", 1)

Global("SarahPreTalk","GLOBAL",0)

THEN

RESPONSE #100

SetGlobal("SarahPreTalk","GLOBAL",1)

RealSetGlobalTimer("SarahTimerPre","GLOBAL",900)

END

 

// PreTalk

 

IF

RealGlobalTimerExpired("SarahTimerPre","GLOBAL")

InParty("K#Sarah")

InParty(Player1)

/* better add checks about CD_STATE_NOT_VALID - see BG1 NPC/Xan/Gavin */

!ActuallyInCombat()

Global("SarahPreTalk","GLOBAL", 1)

THEN

RESPONSE #100

Interact(Player1)

END

 

 

K#Sarah B:

 

// Banter trigger

 

APPEND K#SarahB

 

IF ~Global("SarahPreTalk","GLOBAL", 1)~ THEN PreTalk1

SAY ~My script doesn't stutter anymore!~

++ ~Really?~ DO ~SetGlobal("SarahPreTalk","GLOBAL", 2) RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800)~ + PreTalk1.1

++ ~Cool!~ DO ~SetGlobal("SarahPreTalk","GLOBAL", 2) RealSetGlobalTimer("SarahTimerPre","GLOBAL",1800)~ + PreTalk1.1

END

 

IF ~~ THEN PreTalk1.1

SAY ~Neato.~

END

 

Also, SarahJoined is set to 1 in her joining dlg.

Link to comment

Mmm. It looks all right to me(and an extra END after the last END, because of the APPEND command, right?) - like, really, really all right to me, because it looks like very simple coding and the search reveals all timers/variables are written without typos.

 

Let's go over it again: after Sarah joins and fifteen minutes of real time pass, the banter does not start?

 

(Time is important, because the timer might have to run all over again; another way of checking, instead of waiting, would be typing in the console:

CLUAConsole:AdvanceRealTime(999999)

)

Link to comment

Okay, I got it to work!

 

The code you gave me was flawless enough, Kulyok, but what my idiotic brain figured was that if I advance time 900 seconds, the banter will fire. Which didn't happen. So I put the timer on 15 seconds and it worked perfectly fine.

 

Thanks again! And as for prefixes, I have always just used K# and it's never had any compatibility problems, though I will have to add it to my globals.

 

And...now I'm going to go get some coffee.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...