I'm having some trouble with some scripts I'm working on. What I'm trying to do is create a suit that will add a custom 50% Chameleon Ability spell while the Player is sneaking. I have a script that mostly works, but if the suit is removed while in sneak mod, the ability remains. So I've scripted the suit to add a token and scripted the token to add the Ability. The problem with this setup is that as soon as I exit the Inventory Screen after equipping the suit, I get a big ugly CTD. :banghead:
The script for the suit is:
scn VStealthSuitScriptBegin OnEquip Player Player.AddItem VStealthToken 1EndBegin OnUnEquip Player Player.RemoveItem VStealthToken 1 Player.RemoveSpell VChameleon50; added to make sure the spell is removedEnd
The script for the Token is:
scn VStealthTokenScriptBegin GameMode If Player.GetEquipped VStealthSuit == 1 If player IsSneaking == 1 Player.addspell VChameleon50 Elseif Player IsSneaking == 0 Player.RemoveSpell VChameleon50 Endif EndifEnd
I'm not sure what's causing the CTD. What would be the best (non OBSE) way to fix this? This is for part of http://www.gamesas.com/bgsforums/index.php?showtopic=1055275&hl= and I
really don't want to make it OBSE dependent.