Author Topic: Scripting hiccup, now in a TSA-approved Travel Size!  (Read 2190 times)

Offline berelinde

  • Planewalker
  • *****
  • Posts: 1188
  • Gender: Female
    • Gavin, cleric of Lathander, for Tutu
Scripting hiccup, now in a TSA-approved Travel Size!
« on: December 18, 2011, 07:29:28 PM »

While I was alpha-testing another mod, I found that Anomen periodically forgot movement commands and stopped attacking in combat. It wasn't continuous, but it repeated often enough to be noticeable. I was able to narrow it down to this script block.

Code: [Select]
IF
  RealGlobalTimerExpired("FWAnomenFlirtTOB","LOCALS")
  ActuallyInCombat()
THEN
  RESPONSE #100
    ActionOverride(Player1,DisplayString(Myself,105596))  // ~Running block 6 of anom25.BCS~
    SetGlobal("FWAnomenStartFlirtTOB","GLOBAL",0)
    RealSetGlobalTimer("FWAnomenFlirtTOB","LOCALS",125)
END

Which explains why Anomen periodically stopped attacking in combat. Since this block contains no check for an active romance, there was nothing to prevent the timer from restarting when AnomenRomanceActive=3. Since this block also contains no check for an active romance, it would continue to reset the timer.

Code: [Select]
IF
  RealGlobalTimerExpired("FWAnomenFlirtTOB","LOCALS")
  Global("FWAnomenStartFlirtTOB","GLOBAL",1)
THEN
  RESPONSE #100
    ActionOverride(Player1,DisplayString(Myself,105595))  // ~Running block 5 of anom25.BCS~
    SetGlobal("FWAnomenStartFlirtTOB","GLOBAL",0)
    RealSetGlobalTimer("FWAnomenFlirtTOB","LOCALS",2000)
END

This isn't a stutter, by any stretch of the imagination. Each block executes once and it's over until the timer comes up again. But it does make the NPC forget attack commands and stand there getting pummeled by Draconis, which is kind of a bit of a drag.

I want to point out that when the NPC Flirt Pack was written, this wasn't a problem. There weren't any romance mods that began in ToB, so Anomen would enter ToB with his RA variable=3, and "FWAnomenStartFlirtTOB" would never set. Now, there are a few romance mods that begin in ToB, so the variable does set. Yay, progress?

Disabling these two script blocks corrected the problem.

Looking through the NPC Flirt Pack, I see that the formula for these two script blocks is repeated for each NPC in both SoA and ToB. I propose adding a check for an active romance as a definitive fix. Again, there is nothing game-breaking about this mini micro-bug. It's so trivial, I'm reluctant to even mention it. But it does cause momentary annoyance from time to time, so if somebody gets around to it, it might be worth addressing. I'm posting the original script block and the proposed fix for Aerie in SoA, but it should be repeated for every other NPC covered by the Flirt Pack.
Code: [Select]
// original script blocks -- aeriesoainiflirt.baf

IF
    RealGlobalTimerExpired("FWAerieFlirt","LOCALS")
    Global("FWAerieStartFlirtSOA","GLOBAL",1)
THEN
    RESPONSE #100
        SetGlobal("FWAerieStartFlirtSOA","GLOBAL",0)
        RealSetGlobalTimer("FWAerieFlirt","LOCALS",2700)
END

IF
    RealGlobalTimerExpired("FWAerieFlirt","LOCALS")
    !CombatCounter(0)
THEN
    RESPONSE #100
        RealSetGlobalTimer("FWAerieFlirt","LOCALS",150)
END


Code: [Select]
// proposed script blocks -- aeriesoainiflirt.baf

IF
    RealGlobalTimerExpired("FWAerieFlirt","LOCALS")
    Global("FWAerieStartFlirtSOA","GLOBAL",1)
    !Global("AerieRomanceActive","GLOBAL",0)
    !Global("AerieRomanceActive","GLOBAL",3)
THEN
    RESPONSE #100
        SetGlobal("FWAerieStartFlirtSOA","GLOBAL",0)
        RealSetGlobalTimer("FWAerieFlirt","LOCALS",2700)
END

IF
    RealGlobalTimerExpired("FWAerieFlirt","LOCALS")
    !CombatCounter(0)
    !Global("AerieRomanceActive","GLOBAL",0)
    !Global("AerieRomanceActive","GLOBAL",3)
THEN
    RESPONSE #100
        RealSetGlobalTimer("FWAerieFlirt","LOCALS",150)
END

Thanks for looking!

Offline jastey

  • Planewalker
  • *****
  • Posts: 1182
  • Gender: Female
Re: Scripting hiccup, now in a TSA-approved Travel Size!
« Reply #1 on: July 20, 2017, 08:37:04 AM »
Fixed for v1.04.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: