Jump to content

Level drain stat


Salk

Recommended Posts

Hello!

How do I use correctly CheckStat to detect LEVELDRAIN?

 

What I am trying to do is to apply protection from level drain via spell (#GDRIMM) and then remove them if Player1's levels are restored (#GIMMOFF).

 

IF
     TriggerOverride(Player1, Global("#GNOLDR","LOCALS",1))
     CheckStat(Player1,0,LEVELDRAIN)
THEN
   RESPONSE #100
     ActionOverride(Player1,SetGlobal("#GNOLDR","LOCALS",0))
     ActionOverride(Player1,ReallyForceSpellRES("#GIMMOFF",Myself)) // No such index
END
IF
     CheckStatGT(Player1,0,LEVELDRAIN)
     HPLT(Player1,21)
     TriggerOverride(Player1, Global("#GNOLDR","LOCALS",0)) 
THEN
  RESPONSE #100
     ActionOverride(Player1,SetGlobal("#GNOLDR","LOCALS",1))
     ActionOverride(Player1,ReallyForceSpellRES("#GDRIMM",Myself)) // No such index
END

 

This seems to work fine but everything gets messed up if the game is loaded in between states. That is, saving the game with a level drained Player 1 and then load it, the first script block will return true when instead it shouldn't.

 

Any remedy?

 

Thanks!

Link to comment

Hello!

 

Adding !OnCreation makes it actually worse. The script blocks never trigger.

 

The reason of all those Override is that those blocks are in baldur.bcs.

 

I changed the LOCALS to GLOBAL but the problem persists.

 

IF
CheckStat(Player1,0,LEVELDRAIN)
Global("#GNOLDR","GLOBAL",1)
THEN
RESPONSE #100
ActionOverride(Player1,ReallyForceSpellRES("#GIMMOFF",Myself)) // No such index
SetGlobal("#GNOLDR","GLOBAL",0)
END


IF
CheckStatGT(Player1,0,LEVELDRAIN)
HPLT(Player1,21)
Global("#GNOLDR","GLOBAL",0) 
THEN
RESPONSE #100
ActionOverride(Player1,ReallyForceSpellRES("#GDRIMM",Myself)) // No such index
SetGlobal("#GNOLDR","GLOBAL",1)

On reloading both blocks trigger and that means CheckStat fails... :(

Link to comment

I am not sure what Triggeroverride is, I don't see it in the iesdp, but which trigger is going true when it shouldn't? Is it checking Level Drain and after a load it resets to 0? Obviously a bug as the player is still level drained.

 

Hello!

How do I use correctly CheckStat to detect LEVELDRAIN?

 

What I am trying to do is to apply protection from level drain via spell (#GDRIMM) and then remove them if Player1's levels are restored (#GIMMOFF).

 

IF
     TriggerOverride(Player1, Global("#GNOLDR","LOCALS",1))
     CheckStat(Player1,0,LEVELDRAIN)
THEN
   RESPONSE #100
     ActionOverride(Player1,SetGlobal("#GNOLDR","LOCALS",0))
     ActionOverride(Player1,ReallyForceSpellRES("#GIMMOFF",Myself)) // No such index
END
IF
     CheckStatGT(Player1,0,LEVELDRAIN)
     HPLT(Player1,21)
     TriggerOverride(Player1, Global("#GNOLDR","LOCALS",0)) 
THEN
  RESPONSE #100
     ActionOverride(Player1,SetGlobal("#GNOLDR","LOCALS",1))
     ActionOverride(Player1,ReallyForceSpellRES("#GDRIMM",Myself)) // No such index
END

 

This seems to work fine but everything gets messed up if the game is loaded in between states. That is, saving the game with a level drained Player 1 and then load it, the first script block will return true when instead it shouldn't.

 

Any remedy?

 

Thanks!

Link to comment

TriggerOverride() seems to be a helper construct used by WeiDU to combine the very special NextTriggerObject() with a subsequent trigger.

For example,

  TriggerOverride(Player1, Global("MYVAR","LOCALS",1))

should be semantically equal to

  NextTriggerObject(Player1)
  Global("MYVAR","LOCALS",1)

NextTriggerObject() is supported by TobEx and the Enhanced Edition games.

Link to comment

 

I am not sure what Triggeroverride is, I don't see it in the iesdp, but which trigger is going true when it shouldn't? Is it checking Level Drain and after a load it resets to 0? Obviously a bug as the player is still level drained.

 

Yes... both

 

CheckStat(Player1,0,LEVELDRAIN)

 

and

 

CheckStatGT(Player1,0,LEVELDRAIN)

 

would return true. Funny enough CheckStatLT(Player1,0,LEVELDRAIN) wouldn't...

Link to comment

I did a simple test adding this to baldur.bcs:

IF    
    Global("#GTEST","GLOBAL",0)
    CheckStat(Player1,0,LEVELDRAIN)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@1000)                     // Step1
        SetGlobal("#GTEST","GLOBAL",1)
END

IF    
    Global("#GTEST","GLOBAL",1)
    CheckStatGT(Player1,0,LEVELDRAIN)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@1001)                     // Step2
        SetGlobal("#GTEST","GLOBAL",0)
END

 

At game start I read "Step1" (CHECK 1 works). I save (SAVE1). I get level drained and I read "Step2" (CHECK 2 works). I save (SAVE2). I restore my drained levels and I read "Step1" (CHECK 3 works). I save (SAVE3).
No problems here.
But if I load SAVE2: I read immediately "Step1" and just after "Step2". This means CheckStat(Player1,0,LEVELDRAIN) and CheckStatGT(Player1,0,LEVELDRAIN) return both true unless I am missing something and in this case I'd love to learn what it is.
Is there a way to check the value of the LEVELDRAIN stat with Near Infinity?
Link to comment

Where is it in balder.bcs? Try putting a wait in both of them for like 30 seconds in case something is getting set after your script is run.

 

If both are being run, the first does not run a second time, thus, it seems like leveldrain may be delayed in being populated from the save file?

Link to comment

Archived

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

×
×
  • Create New...