Yovaneth Posted January 15, 2006 Posted January 15, 2006 I think there is a fault in the IWD version of the Infinity Engine which is preventing the following blocks of code from operating correctly. This is supposed to be the IWD version of the BG2 thief hide'n'detect trick. Summary: 1. This is a complete test script. 2. In its current layout it will operate once correctly; that is, the thief will keep running the Hide block until hidden and then run the FindTraps block. When the FindTraps timer times out, the thief runs the Hide block correctly but never executes the actual Hide() command. 3. If the Hide and FindTraps blocks are reversed and the Continue() command at the end of the actual Hide block is uncommented, again the script runs correctly once, but ever after locks into the FindTraps command. I would be grateful for confirmation that there does appear to be a problem with this version of the IE when running this code. Either that, or I've really screwed up somewhere! -Y- //************************************************************************ //Pop off the timer initialisation so we can use GlobalTimerExpired //************************************************************************* IF Global("Initialise_timers","LOCALS",0) THEN RESPONSE #100 SetGlobalTimer("gh_Thief","LOCALS",0) SetGlobal("Initialise_timers","LOCALS",1) Continue() END // ********************************************************************** // * Segment Name: gs_HideAndDetect.baf // ********************************************************************** // * HIDE AND DETECT TRICK // * [Allows a Thief character to be BOTH hidden and detecting Traps 90% of the time] // * [Only done when >75%HP to avoid not getting healed by gs_HealOther] // * Only a thief script will have this snippet so class test commented out // * Enable/disable Hide'n'Detect IF HotKey(H) Global("dai_SetHide","LOCALS",0) THEN RESPONSE #100 SetGlobal("dai_SetHide","LOCALS",1) FloatMessage(Myself,4188) //Leaving shadows END // * FindTraps segment *************** // * If not already detecting traps, and hidden, detect traps and start the timer IF Global("dai_SetHide","LOCALS",0) ActionListEmpty() CombatCounter(0) //and combat is over // OR(5) // ClassEx(Myself,CLERIC_THIEF) // ClassEx(Myself,FIGHTER_MAGE_THIEF) // ClassEx(Myself,FIGHTER_THIEF) // ClassEx(Myself,THIEF) // ClassEx(Myself,MAGE_THIEF) !ModalState(Myself,DETECTTRAPS) // ModalState(Myself,STEALTH) //Bolloxed - definately bolloxed beyond use StateCheck(Myself,STATE_NOT_VISIBLE) //Used instead of ModalState THEN RESPONSE #100 FloatMessage(Myself,4927) //Find traps SetGlobalTimer("gh_Thief","LOCALS",25) SetGlobal("ys_test","LOCALS",0) //Reset temp. testing flag FindTraps() Continue() END // * Hide segment *************** // * If not already hidden, and I'm not damaged -> hide! IF Global("dai_SetHide","LOCALS",0) ActionListEmpty() OR(2) CombatCounter(0) //and combat is over GlobalTimerExpired("gh_Thief","LOCALS") // OR(5) // ClassEx(Myself,CLERIC_THIEF) // ClassEx(Myself,FIGHTER_MAGE_THIEF) // ClassEx(Myself,FIGHTER_THIEF) // ClassEx(Myself,THIEF) // ClassEx(Myself,MAGE_THIEF) !StateCheck(Myself,STATE_NOT_VISIBLE) //and not invisible/impinvis/hiding HPPercentGT(Myself,75) THEN RESPONSE #100 FloatMessage(Myself,19928) //I must hidemyself SetGlobal("ys_test","LOCALS",1) //Temp. test flag to trigger the next block Continue() END //Separated from the above block just in case multiple commands are affecting the //RESPONSE execution. Can be re-integrated if required IF Global("ys_test","LOCALS",1) THEN RESPONSE #100 Hide() // Continue() END
cirerrek Posted January 16, 2006 Posted January 16, 2006 Here is what I get with a similar code snippet // ********************************************************************** // *      Segment Name: gs_HideAndDetect.baf // ********************************************************************** // * HIDE AND DETECT TRICK // * [Allows a Thief character to be BOTH hidden and detecting Traps 90% of the time] // * [Only done when >75%HP to avoid not getting healed by gs_HealOther] // * If not already detecting traps, and hidden, detect traps and start the timer IF  ActionListEmpty()  CombatCounter(0)                // and combat is over  Or(5)   ClassEx(Myself,THIEF)   ClassEx(Myself,FIGHTER_THIEF)   ClassEx(Myself,FIGHTER_MAGE_THIEF)   ClassEx(Myself,MAGE_THIEF)   ClassEx(Myself,CLERIC_THIEF)  !ModalState(Myself,DETECTTRAPS)  ModalState(Myself,STEALTH) THEN  RESPONSE #100   FloatMessage(Myself,8945)  // say "Find Traps"   StartTimer(25,21) //   SetGlobalTimer("gh_Thief","LOCALS",18)      FindTraps() END // * If timer expired, and I'm not damaged -> hide! IF  ActionListEmpty()  CombatCounter(0)             // and combat is over  TimerExpired(25) //  GlobalTimerExpired("gh_Thief","LOCALS")  HPPercentGT(Myself,75)  CheckStatGT(Myself,50,STEALTH) // and I have a decent chance of success THEN  RESPONSE #100   FloatMessage(Myself,19928)     // say "I must hide myself"   Hide() END // * If not already hidden, and I'm not damaged -> hide! IF  ActionListEmpty()  CombatCounter(0)            // and combat is over  Or(5)   ClassEx(Myself,THIEF)   ClassEx(Myself,FIGHTER_THIEF)   ClassEx(Myself,FIGHTER_MAGE_THIEF)   ClassEx(Myself,MAGE_THIEF)   ClassEx(Myself,CLERIC_THIEF)  !StateCheck(Myself,STATE_NOT_VISIBLE)  // and not invisible/impinvis/hiding  HPPercentGT(Myself,75)  CheckStatGT(Myself,50,STEALTH)  // and I have a decent chance of success THEN  RESPONSE #100   FloatMessage(Myself,19944)  // say "Hide in Shadows Succeeded"   Hide() END 1. Message Floated Hide in Shadows Succeeded (block 3) Action Character Hides 2. Message Floated Find Traps (block 1) Action Chartacter Activates Find Traps Notes for the home viewers. Once you switch to looking for traps, you automatically "Leave Shadows". Then you have about 3 rnds (18 seconds) in which to search for traps before you become visiable again. Once you become visible again, block 3 would apply. And it does. 3. Message Floated Hide in Shadows Succeded (block 3) Action No Action as far as I can tell But you don't start hiding in shadows again, so something appears to be up with the Hide() action. 4. Message Floated I must hide myself (block 2) Action No Action as far as I can tell 5. Message Floated (Repeats endlessly from this point on) Hide in Shadows Succeeded (block 3) Action No Action as far as I can tell As you can see from some of the comments, I tried it both ways...using SetGlobalTimer and SetTimer, just to see if there was a difference, but the results of the test were the same. Conclusion? Something about Hide() is whacked in IWD?:D Thanks, Cirerrek
Yovaneth Posted January 16, 2006 Author Posted January 16, 2006 That duplicates exactly what I was seeing. The odd thing is that Hide() works and FindTraps() works, but not if you try to run them one after another. It's as if executing FindTraps() prevents the future execution of Hide(), yet if you hit the Stealth GUI button, away goes the thief. As you say: A bit more research needed; maybe delaying the block executions by a short timer might help.....maybe. -Y-
Avenger Posted January 16, 2006 Posted January 16, 2006 I'm not sure what's wrong, but the block containing !Modalstate(a) Modalstate(b) is superfluous. Modalstate could be either a or b (or c or d) but never both. Also, i guess you know this: 1. Hide() fails if you are seen by any enemy. 2. Hide() fails when it was tried only recently (the hide button is disabled). It could be that in bg2 the above conditions are checked higher level (closer to the gui), and not enforced in the scripting core. Also, if Yovaneth's guessing about Hide don't work while Findtraps is active, try to insert a NoAction() when you set the variable for a subsequent Hide(). Noaction() is supposed to clear the modal state. And an observation: in iwd2 when you come out of hiding, you are still invisible for a while. So instead of Hiding while finding traps, you might want to find traps AFTER hiding. Hope some of the above remarks help
cirerrek Posted January 16, 2006 Posted January 16, 2006 I'm not sure what's wrong, but the block containing !Modalstate(a) Modalstate(b) is superfluous. Modalstate could be either a or b (or c or d) but never both. Also, i guess you know this: 1. Hide() fails if you are seen by any enemy. 2. Hide() fails when it was tried only recently (the hide button is disabled). It could be that in bg2 the above conditions are checked higher level (closer to the gui), and not enforced in the scripting core. Also, if Yovaneth's guessing about Hide don't work while Findtraps is active, try to insert a NoAction() when you set the variable for a subsequent Hide(). Noaction() is supposed to clear the modal state. And an observation: in iwd2 when you come out of hiding, you are still invisible for a while. So instead of Hiding while finding traps, you might want to find traps AFTER hiding. Hope some of the above remarks help <{POST_SNAPBACK}> Right, about the double modal state check being superfluous. 1. I don't believe there are any enemies where I am testing (Kuldahar) 2. The stealth button re-activates itself before the end of the snippet, so that shouldn't be the issue. And an observation: in iwd2 when you come out of hiding, you are still invisible for a while. So instead of Hiding while finding traps, you might want to find traps AFTER hiding. Do you mean that after you are fully visible on screen you are still considered invisible for a time? If that is the case then Yovaneth's suggestion about a Delay() might do the trick. Hope some of the above remarks help Very helpful. Thank you Avenger
Yovaneth Posted January 16, 2006 Author Posted January 16, 2006 I'm not sure what's wrong, but the block containing !Modalstate(a) Modalstate(b) is superfluous. Modalstate could be either a or b (or c or d) but never both. True, but in this case they are both required. ModalState(STEALTH) is doing the state check and !ModalState(DETECTTRAPS) is being used to stop the block re-triggering after the trap-finding has started. 1. Hide() fails if you are seen by any enemy.2. Hide() fails when it was tried only recently (the hide button is disabled). Neither has been a factor in the testing. Until the FindTraps() block is triggered for the first time, the Hide() block re-triggers constantly (as it is supposed to do) until the thief hides. Then it all falls over.... Also, if Yovaneth's guessing about Hide don't work while Findtraps is active, try to insert a NoAction() when you set the variable for a subsequent Hide().Noaction() is supposed to clear the modal state. On the 'Try' list for tonight! Hope some of the above remarks help Yup! -Y-
Yovaneth Posted January 17, 2006 Author Posted January 17, 2006 Well, I tried again last night and my final Hide() try was this:- //----snip----/// THEN RESPONSE #100 NoAction() ClearAllActions() Wait(2) Hide() END Same result; either Hide() doesn't like FindTraps() or FindTraps() doesn't like Hide(). QED: it's buggered. Damn. -Y-
Recommended Posts
Archived
This topic is now archived and is closed to further replies.