Jump to content


Photo

What's wrong with this code?


13 replies to this topic

#1 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 30 December 2011 - 09:55 AM

Jaheira's script includes this block which I wrote:

IF
InParty(Myself)
Global("KishJaheiraFighterStronghold","GLOBAL",1)
GlobalTimerExpired("KPPlotTime","GLOBAL")
!Global("KeepPlot","GLOBAL",9)
CombatCounter(0)
!Global("KishKeepInactive","GLOBAL",1)
!GlobalTimerNotExpired("KishJaheiraImpatient","GLOBAL")
OR(3)
Global("Chapter","GLOBAL",2)
Global("Chapter","GLOBAL",3)
Global("Chapter","GLOBAL",6)
!AmIInWatchersKeepPleaseIgnoreTheLackOfApostophe()
!Global("KishKeepFinished","GLOBAL",1)
!AreaCheck("AR1306")
!AreaCheck("AR1307")
!AreaCheck("AR1304")
!AreaCheck("AR1305")
THEN
RESPONSE #100
SetInterrupt(FALSE)
StartDialogueNoSet(Player1)
END

and this is in the mod's .d file:

CHAIN IF WEIGHT #-1 ~GLOBAL("KishJaheiraFighterStronghold","GLOBAL",1)
GlobalTimerExpired("KPPlotTime","GLOBAL")
!GlobalTimerNotExpired("KishJaheiraImpatient","GLOBAL")
Global("KishJaheiraComplained","GLOBAL",0)
!Global("KeepPlot","GLOBAL",9)
!Global("KishKeepInactive","GLOBAL",1)
OR(3)
Global("CHAPTER","GLOBAL",2)
Global("CHAPTER","GLOBAL",3)
Global("CHAPTER","GLOBAL",6)
!InWatchersKeep()
!InActiveArea("AR1306")
!InActiveArea("AR1307")
!InActiveArea("AR1304")
!InActiveArea("AR1305")
!Global("KishKeepFinished","GLOBAL",1)~ THEN JAHEIRAJ DeArniseKeepHurry
~We should check on affairs at my keep.~
END
++ ~We're too busy right now, Jaheira.~ EXTERN JAHEIRAJ DeArniseKeepDelay
++ ~Of course, we'll go there right away.~ EXTERN JAHEIRAJ DeArniseKeepRightAway
++ ~I have no time for that.~ EXTERN JAHEIRAJ DeArniseKeepDelay

and certainly appears to be being appended properly to JAHEIRAJ. However, when her script tries to execute this, it crashes the game.
"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan

#2 berelinde

berelinde

    The Typo Queen

  • Gibberlings
  • 8594 posts
  • Location:New Jersey, USA

Posted 30 December 2011 - 10:55 AM

What happens when you advance this global by one before the SDNS()? Global("KishJaheiraFighterStronghold","GLOBAL",1)

And then use Global("KishJaheiraFighterStronghold","GLOBAL",2) as the only trigger in the D?
Must. Write. Faster.

cmorgan: "None of us get old around here, just more proficient at doing more stuff with less braincells!"

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum

#3 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 30 December 2011 - 12:35 PM

I can't change that variable, it's used too many other places in the mod. I tried changing the script to:

IF
InParty(Myself)
Global("KishJaheiraFighterStronghold","GLOBAL",1)
GlobalTimerExpired("KPPlotTime","GLOBAL")
!Global("KeepPlot","GLOBAL",9)
CombatCounter(0)
!Global("KishKeepInactive","GLOBAL",1)
!GlobalTimerNotExpired("KishJaheiraImpatient","GLOBAL")
OR(3)
Global("Chapter","GLOBAL",2)
Global("Chapter","GLOBAL",3)
Global("Chapter","GLOBAL",6)
!InWatchersKeep()
!Global("KishKeepFinished","GLOBAL",1)
!InActiveArea("AR1306")
!AreaCheck("AR1307")
!AreaCheck("AR1304")
!AreaCheck("AR1305")
THEN
RESPONSE #100
SetInterrupt(FALSE)
IncrementGlobal("KishJaheiraGoToKeep","GLOBAL",1)
Wait(3)
StartDialogueNoSet(Player1)
END

and the .d file to:

CHAIN IF WEIGHT #-1 ~Global("KishJaheiraGoToKeep","GLOBAL",1)~ THEN JAHEIRAJ DeArniseKeepHurry
~We should check on affairs at my keep.~
END
++ ~We're too busy right now, Jaheira.~ EXTERN JAHEIRAJ DeArniseKeepDelay
++ ~Of course, we'll go there right away.~ EXTERN JAHEIRAJ DeArniseKeepRightAway
++ ~I have no time for that.~ EXTERN JAHEIRAJ DeArniseKeepDelay

but while it looks much more elegant now (thanks), it still crashes the game exactly the same way.

On a separate but not entirely unrelated note, is it impossible for a CHAIN to check for a variable which was set earlier in the CHAIN? That is,

== JAHEIRAJ IF ~PartyGoldGT(499)~ THEN ~Something.~ DO ~SetGlobal("KishJaheiraPaidMerchant","GLOBAL",1)~
== JAHEIRAJ IF ~PartyGoldLT(500)~ THEN ~Something different.~ DO ~SetGlobal("KishJaheiraPaidMerchant","GLOBAL",2)
IncrementGLOBAL("KPRevolt","GLOBAL",1)~
== KPMERC01 IF ~GLOBAL("KishJaheiraPaidMerchant","GLOBAL",1)
CheckStatGT("Jaheira",14,CHR)~ THEN ~Reply.~ DO ~TakePartyGold(500)~
== KPMERC01 IF ~GLOBAL("KishJaheiraPaidMerchant","GLOBAL",1)
CheckStatLT("Jaheira",15,CHR)~ THEN ~Different reply.~

doesn't work. The lines that check for KishJaheiraPaidMerchant never fire. Is there a way to fix this?

Edited by Kish, 30 December 2011 - 12:42 PM.

"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan

#4 berelinde

berelinde

    The Typo Queen

  • Gibberlings
  • 8594 posts
  • Location:New Jersey, USA

Posted 30 December 2011 - 12:46 PM

I don't think this is doing it, but I'm not used to seeing !InActiveArea("AR1306") used like that. Isn't the object between the quotes usually a DV or Player2 or something? I see that you used !AreaCheck("AR1306") above and still got the crash, so that isn't it.


I'm wondering if the SetInterrupt(FALSE) without a SetInterrupt(TRUE) is causing the problem. Sorry if I'm missing something important, but I'm not seeing any other reason why this should be causing a crash.
Must. Write. Faster.

cmorgan: "None of us get old around here, just more proficient at doing more stuff with less braincells!"

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum

#5 cmorgan

cmorgan

    journeyman investigator

  • Gibberlings
  • 6911 posts
  • Gender:Male
  • Location:Glencoe, IL, USA

Posted 30 December 2011 - 01:42 PM

GREAT to see you modding again!!!!

Unfortunately, with the setting a variable and then referring to it within the same dialog, there is no way to do it. If it passes through two states first, it has a better chance, but it is still flaky. Ascension64 made a part of ToBEX (a bit like TimeSlip's oblivion engine extensions for modders) that sets dialog actions to take effect immediately, but apparently there are some problmes with doing that as well. So, the suggestion is to either filter through two states (and ocassionally have it fail for no reason) or to make the dialogs successive.

for
IF
InParty(Myself)
Global("KishJaheiraFighterStronghold","GLOBAL",1)
GlobalTimerExpired("KPPlotTime","GLOBAL")
!Global("KeepPlot","GLOBAL",9)
CombatCounter(0)
!Global("KishKeepInactive","GLOBAL",1)
!GlobalTimerNotExpired("KishJaheiraImpatient","GLOBAL")
OR(3)
Global("Chapter","GLOBAL",2)
Global("Chapter","GLOBAL",3)
Global("Chapter","GLOBAL",6)
!InWatchersKeep()
!Global("KishKeepFinished","GLOBAL",1)
!InActiveArea("AR1306")
!AreaCheck("AR1307")
!AreaCheck("AR1304")
!AreaCheck("AR1305")
THEN
RESPONSE #100
SetInterrupt(FALSE)
IncrementGlobal("KishJaheiraGoToKeep","GLOBAL",1)
Wait(3)
StartDialogueNoSet(Player1)
END
I have been having one hell of a time getting stuff like !GlobalTimerNotExpired("KishJaheiraImpatient","GLOBAL") to fire, even though it should. But it doesn't crash stuff.

try breaking it up and seeing if that helps:

IF
GlobalTimerExpired("KishJaheiraImpatient","GLOBAL")
GlobalTimerExpired("KPPlotTime","GLOBAL")
Global("KishJaheiraFighterStronghold","GLOBAL",1)
!Global("KeepPlot","GLOBAL",9)
!Global("KishKeepInactive","GLOBAL",1)
!Global("KishKeepFinished","GLOBAL",1)
OR(3)
Global("Chapter","GLOBAL",2)
Global("Chapter","GLOBAL",3)
Global("Chapter","GLOBAL",6)
!InWatchersKeep()
THEN
RESPONSE #100
  SetGlobal("KishJaheiraGoToKeep","GLOBAL",2)
END

IF
Global("KishJaheiraGoToKeep","GLOBAL",2)
!AreaCheck("AR1307")
!AreaCheck("AR1304")
!AreaCheck("AR1305")
!AreaCheck("AR1306")
THEN RESPONSE #100
StartDialogueNoSet(Player1)
END

or even better, set it so the smaller blocks increment the var to 3, so that you can troubleshoot. That should give you an idea of what is not firing correctly. In the worst case scenario, troubleshoot by setting even smaller blocks that set an independent variable (or use DisplayStringHead) and you should be able to track down which thing is not working.
I love deadlines. I love the whooshing noise they make as they go by. - Douglas Adams

#6 Daulmakan

Daulmakan

    Comfortably numb

  • Members
  • 531 posts
  • Location:The Houses of the Holy

Posted 30 December 2011 - 04:25 PM

NPC Strongholds is back on? Neat.
I ain't evil, I'm just good looking.


#7 devSin

devSin
  • Fixpackers
  • 3017 posts
  • Gender:Male

Posted 30 December 2011 - 07:38 PM

I don't think this is doing it, but I'm not used to seeing !InActiveArea("AR1306") used like that. Isn't the object between the quotes usually a DV or Player2 or something?

This is likely what's crashing. It wants an object in the current area, not the current area.

I'm wondering if the SetInterrupt(FALSE) without a SetInterrupt(TRUE) is causing the problem. Sorry if I'm missing something important, but I'm not seeing any other reason why this should be causing a crash.

Nah, interrupt state reverts as soon as the queue is empty. You don't really ever need to TRUE unless you know the queue is not empty.

#8 cmorgan

cmorgan

    journeyman investigator

  • Gibberlings
  • 6911 posts
  • Gender:Male
  • Location:Glencoe, IL, USA

Posted 30 December 2011 - 07:49 PM

Doggone - I never saw that. I am so used to seeing *Area("resref") I looked right over it :D
I love deadlines. I love the whooshing noise they make as they go by. - Douglas Adams

#9 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 30 December 2011 - 09:48 PM

Thanks! I seem to have gotten it working now. You were very helpful; I'll have more questions, I'm sure.

As for NPC Strongholds, it's still on hiatus. It's not going to be out in 2011; I wouldn't bet anything I wasn't willing to lose that it will be out in 2012.
"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan

#10 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 29 January 2012 - 11:22 AM

Same question. What's wrong with this code?

IF
True()
THEN
RESPONSE #100
CutSceneId(Player1)
Wait(1)
FadeToColor([20.0],0)
Wait(1)
LeaveAreaLUAPanic("AR1100","",[2122.1482],4)
LeaveAreaLUA("AR1100","",[2122.1482],4)
ActionOverride(Player2,LeaveAreaLUA("AR1100","",[2159.1447],4))
ActionOverride(Player3,LeaveAreaLUA("AR1100","",[2172.1513],4))
ActionOverride(Player4,LeaveAreaLUA("AR1100","",[2209.1476],4))
ActionOverride(Player5,LeaveAreaLUA("AR1100","",[2208.1535],4))
ActionOverride(Player6,LeaveAreaLUA("AR1100","",[2244.1499],4))
MultiPlayerSync()
Wait(1)
FadeFromColor([20.0],0)
Wait(1)
SetGlobal("OgronAttackStarted","AR1100",1)
CreateCreature("RORCL01",[1854.1387],14) // Orog Leader
CreateCreature("RORCA01",[1758.1453],14) // Orc Archer
CreateCreature("RORCA01",[1822.1481],14) // Orc Archer
CreateCreature("RORCS01",[1750.1534],14) // Orog
CreateCreature("RORCS01",[1663.1536],14) // Orog
CreateCreature("RORCS01",[1613.1450],14) // Orog
Wait(1)
ActionOverride("Valygar",Attack("rorcl01"))
ActionOverride("Rorcl01",Attack("Valygar"))
EndCutSceneMode()
END

It's a cutscene. It works almostperfectly, but Valygar doesn't attack the orog leader and the orog leader doesn't appear to be looking at Valygar in particular.
"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan

#11 argent77

argent77
  • Members
  • 254 posts
  • Gender:Male

Posted 29 January 2012 - 12:06 PM

My guess is that you need to use the death variables in your last two actions, and the DV for RORCL01 is "ROGRON".

Imagination is more important than knowledge. Knowledge is limited; imagination encircles the world. - Albert Einstein

 

My contributions:


#12 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 29 January 2012 - 01:11 PM

Thanks. That's the same death variable as for all the other orogs, though. If I used that, either one of them at random would attack Valygar or they all would (neither is really a problem) but also, Valygar would attack one of them at random.
"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan

#13 plainab

plainab

    Sasha al'Therin

  • Members
  • 1717 posts
  • Gender:Male
  • Location:Lost on the Sword Coast

Posted 29 January 2012 - 02:20 PM

Thanks. That's the same death variable as for all the other orogs, though. If I used that, either one of them at random would attack Valygar or they all would (neither is really a problem) but also, Valygar would attack one of them at random.

If the Orog leader is a unique creature with it's own file have your mod reassign it a different scripting variable name. if it is not unique, have your mod create a unique version and use that instead. This way you can have your cutscene do what you need done...
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm

#14 Kish

Kish
  • Modders
  • 716 posts
  • Gender:Not Telling
  • Location:Rohnert Park, CA

Posted 05 February 2012 - 07:12 AM

Thanks.
"You are what you do. Choose again, and change."
--Miles Vorkosigan

"The really unforgivable acts are committed by calm men in beautiful green silk rooms, who deal death wholesale, by the shipload, without lust, or anger, or desire, or any redeeming emotion to excuse them but cold fear of some pretended future. But the crimes they hope to prevent in the future are imaginary. The ones they commit in the present--they are real."
--Aral Vorkosigan



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users