Jump to content

What's wrong with this code?


Kish

Recommended Posts

Posted

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.

Posted

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?

Posted

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?

Posted

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.

Posted

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.

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

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.

Posted

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.

Posted

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.

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

Archived

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

×
×
  • Create New...