Salk Posted July 28, 2015 Share Posted July 28, 2015 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
lynx Posted July 28, 2015 Share Posted July 28, 2015 If it somehow runs immediately, before effects are applied (that'd be weird), you could try adding a !OnCreation() to the first block. What's with all the overrides btw? Link to comment
Salk Posted July 28, 2015 Author Share Posted July 28, 2015 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
Salk Posted July 28, 2015 Author Share Posted July 28, 2015 Then there's nothing I can do? I guess I can move everything to DPLAYER3.BCS... Link to comment
lynx Posted July 28, 2015 Share Posted July 28, 2015 No idea — I've only ever written one script and it was a hotkey triggered one for testing. Link to comment
wolpak Posted July 28, 2015 Share Posted July 28, 2015 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
Fiann of the Silver Hand Posted July 28, 2015 Share Posted July 28, 2015 TriggerOverride isn't in my trigger.ids. Could you explain where it's coming from? Link to comment
argent77 Posted July 28, 2015 Share Posted July 28, 2015 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
Fiann of the Silver Hand Posted July 28, 2015 Share Posted July 28, 2015 Right, I've got that one. Didn't know about the weidu bit. Thanks. Link to comment
Salk Posted July 29, 2015 Author Share Posted July 29, 2015 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
Fiann of the Silver Hand Posted July 29, 2015 Share Posted July 29, 2015 So after loading the game, the STAT is no longer set at 1? Link to comment
Salk Posted July 29, 2015 Author Share Posted July 29, 2015 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
Fiann of the Silver Hand Posted July 29, 2015 Share Posted July 29, 2015 Is this problem unique to level drain, or do all effects that set a STAT get messed up like this from loading a save? I'm surprised this hasn't been an issue for any AI tweaks/mods. Link to comment
wolpak Posted July 29, 2015 Share Posted July 29, 2015 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.