BG2:EE Ranger immediately leaves shadows on successful hide

Hi, first post (be gentle!) and sorry if it's in the wrong place. I've got a problem with a script, which should be automatically hiding my ranger and keeping him hidden. However, upon a successful hide, he immediately starts to unhide, meaning he's not all all that great at creeping around...

As you can see from the image above, he's already leaving shadows before reporting that he's hidden. I extracted the hiding part out of my super-long script to check the specifics, and this is the block on it's own, still exhibiting the behaviour:

As you can see from the image above, he's already leaving shadows before reporting that he's hidden. I extracted the hiding part out of my super-long script to check the specifics, and this is the block on it's own, still exhibiting the behaviour:
// ======================================== // STEALTH // ======================================== IF ActionListEmpty() !StateCheck(Myself,STATE_INVISIBLE) !ButtonDisabled(BUTTON_THIEVING) !ButtonDisabled(BUTTON_STEALTH) !ModalState(DETECTTRAPS) !ModalState(TURNUNDEAD) !ModalState(STEALTH) OR(3) Class(Myself,THIEF_ALL) Class(Myself,RANGER_ALL) Class(Myself,MONK) OR(2) CheckStatGT(Myself,50,HIDEINSHADOWS) CheckStatGT(Myself,50,STEALTH) OR(2) Range(Player1(Myself), 8) Global("pg_MovementOff","LOCALS",1) !GlobalTimerNotExpired("pg_Timer_AttemptedToHide","LOCALS") THEN RESPONSE #100 SetGlobalTimer("pg_Timer_AttemptedToHide","LOCALS",12) DisplayStringHead(Myself,95157) // Attempting to hide in shadows Hide() ENDIs it a case of too much going on, or things happening in the wrong order?
0
Comments
Range(Player1(Myself),8)
should be
Range(Player1,8)