Begin Uvi_MeireeScriptShort NoLoreShort FirstGreetingShort doOnceShort RandShort facefixShort VampWanderShort TestVarShort TeleportIf ( servant_meiree_sweeper->GetHealth <= 0 ) If ( GetDisabled == 0 ) Disable Endif ReturnEndifIf ( doOnce == 0 ) If ( GetItemCount emb_memitem_mychilde > 0 ) Set TestVar to 1 Set uvi_meiree_vampire to 1 Set doOnce to 1 Elseif ( doOnce == 1 ) If ( uvi_meiree_vampire == 0 ) AiWander 256 5 0 40 20 10 0 20 PositionCell -724 -102 -256 0 "Tel Uvirith, Servant's Quarter" Set VampWander to 0 Set doOnce to -1 Endif EndifEndifIf ( VampWander == 0 ) If ( GetForceSneak == 1 ) ClearForceSneak Endif If ( GetSpell Uvi_comp_lev == 1 ) RemoveSpell Uvi_comp_lev Endif If ( GetSpell uvi_half_chameleon == 1 ) RemoveSpell uvi_half_chameleon Endif Set VampWander to -1Elseif ( VampWander == 1 ) ;levitating If ( GetForceSneak == 1 ) ClearForceSneak Endif If ( GetSpell Uvi_comp_lev == 0 ) AddSpell Uvi_comp_lev Endif If ( GetSpell uvi_half_chameleon == 1 ) RemoveSpell uvi_half_chameleon Endif Set VampWander to -1Elseif ( VampWander == 2 ) ;sneaking If ( GetForceSneak == 0 ) ForceSneak Endif If ( GetSpell Uvi_comp_lev == 1 ) RemoveSpell Uvi_comp_lev Endif If ( GetSpell uvi_half_chameleon == 0 ) AddSpell uvi_half_chameleon Endif Set VampWander to -1EndifIf ( uvi_meiree_vampire == 1 ) If ( facefix == 1 ) ;fixes disappearing head issue Equip uvi_helm_dummy RemoveItem uvi_helm_dummy 1 Set facefix To 0 Return EndIfElse If ( VampWander > 0 ) Set VampWander to 0 EndifEndifIf ( GetCurrentAiPackage > 1 ) Set VampWander to 0 ReturnEndifIf ( CellChanged == 1 ) If ( uvi_meiree_away == 1 ) Enable set facefix to 1 Return Endif If ( uvi_meiree_vampire == 0 ) If ( GameHour >= 18 ) Enable Elseif ( GameHour <= 6 ) Enable Else Disable Endif Return Elseif ( uvi_meiree_vampire == 1 ) Enable Set facefix to 1 If ( uvi_meiree_away == -1 ) AiWander 256 5 0 40 20 10 0 20 0 0 0 0 PositionCell -724 -102 -256 0 "Tel Uvirith, Servant's Quarters" Set VampWander to 0 Set uvi_meiree_away to 1 Return Endif Set Teleport to 1 EndifEndifIf ( Teleport == 1 ) Set Rand to Random 100 If ( Gamehour >= 21 ) Set TestVar to 2 AiWander 1024 5 0 0 10 40 0 10 0 20 0 0 If ( Rand >= 90 ) PositionCell 1104 52 28 270 "Tel Uvirith, Tower Lower" Set VampWander to 1 ;levitating Elseif ( Rand >= 80 ) PositionCell 799 -31 1095 0 "Tel Uvirith, Tower Upper" Set VampWander to 1 ;levitating Elseif ( Rand >= 70 ) PositionCell 4292 -1065 -1011 0 "Tel Uvirith, Tower Dungeon" Set VampWander to 2 ;sneaking Elseif ( Rand >= 60 ) PositionCell 2028 195 -912 0 "Tel Uvirith, Tower Dungeon" Set VampWander to 2 ;sneaking Elseif ( Rand >= 50 ) PositionCell 4719 4207 -1679 100 "Tel Uvirith Dungeon, Deep Tunnels" Set VampWander to 1 ;levitating Elseif ( Rand >= 30 ) PositionCell 3183 3899 -2259 180 "Tel Uvirith Dungeon, Deep Tunnels" Set VampWander to 0 Elseif ( Rand >= 0 ) PositionCell 79 181 317 180 "Tel Uvirith, Tower Lower" Set VampWander to 0 Endif Elseif ( GameHour <= 5 ) Set TestVar to 3 AiWander 1024 5 0 0 10 40 0 10 0 20 0 0 If ( Rand >= 90 ) PositionCell 1104 52 28 270 "Tel Uvirith, Tower Lower" Set VampWander to 1 ;levitating Elseif ( Rand >= 80 ) PositionCell 799 -31 1095 0 "Tel Uvirith, Tower Upper" Set VampWander to 1 ;levitating Elseif ( Rand >= 70 ) PositionCell 4292 -1065 -1011 0 "Tel Uvirith, Tower Dungeon" Set VampWander to 2 ;sneaking Elseif ( Rand >= 60 ) PositionCell 2028 195 -912 0 "Tel Uvirith, Tower Dungeon" Set VampWander to 2 ;sneaking Elseif ( Rand >= 50 ) PositionCell 4719 4207 -1679 100 "Tel Uvirith Dungeon, Deep Tunnels" Set VampWander to 1 ;levitating Elseif ( Rand >= 30 ) PositionCell 3183 3899 -2259 180 "Tel Uvirith Dungeon, Deep Tunnels" Set VampWander to 0 Elseif ( Rand >= 0 ) PositionCell 79 181 317 180 "Tel Uvirith, Tower Lower" Set VampWander to 0 Endif Else Set TestVar to 4 AiWander 256 5 0 40 20 10 0 20 PositionCell -724 -102 -256 0 "Tel Uvirith, Servant's Quarter" Set VampWander to 0 Endif Set Teleport to 0EndifEnd
Now my problem is mainly with the CellChanged function. It seems to only move the npc if you are entering the cell, not exiting it. In order to get her to move, I need to leave the cell and re-enter it before she will do it. This is not optimal. I need her to move when I leave. I had also considered using GetDistance, but that would only end up with her vanishing before you get close to her in that cell, so you would probably never see her again. Is there any better way of doing this?