1) First, you need to create two BASE actor effects, one that controls steathbox application, the other checking if player wants to re-equip stealthboy on expiration. Call the first effect StealthBoyForCombat, effect archetype Script, second effect gets the ID RenewStealthBoyBaseEffect, also script-based. StealthBoyForCombat is then applied to the player when she "ingests" stealthboy (for 240 seconds with StealthGirl perk, 120 seconds otherwise). Now here's the code for the base effects:
scn DispelStealthOnCombatshort nInCombatbegin ScriptEffectStartAddspell StealthBoyCaution ;create a StealthBoyCaution ABILITY (in the actor effect list, 100 sneak, 75% chameleon)endbegin ScriptEffectUpdateif GetSelf != player ;only do this for player charreturnendifif IsInCombat && nInCombat == 0 ;if player is in combat, dispel the effectset nInCombat to 1dispel StealthBoyCautionelseif IsInCombat == 0 && nInCombat == 1set nInCombat to 0Addspell StealthBoyCaution ;re-add the spell when player drops out of combatendifENDbegin ScriptEffectFinishdispel StealthBoyCaution ;remove the stealthboy ability when the stealthboy ingestible effect expiresif GetSelf != playerreturnendifif getitemcount StealthBoy > 0 ;display the "do you want to re-use the stealthboy?" message if stealthboy user=player charaddspell RenewStealthBoyAbilityendifEND
RenewStealthBoyAbility takes care of re-applying the stealthboy effect to the player if she clicks the "Yes" button. Here's the code for the base effect, applied by the RenewStealthBoyAbility to the player:
scn RenewStealthBoyEffectshort nCounterbegin ScriptEffectStartshowmessage StealthBoyRenewMessage ;show message "do you want to re-use stealthboy -yes/no?"endbegin gamemodeif GetButtonPressed == 0 ;if player clicks "yes", re-equip the stealthboy. Yes, it's equipped like armorequipitem StealthBoyendifdispel RenewStealthBoyAbility ;remove the ability regardless of what button the player clicksEND
here's a screenshot:
http://s467.photobucket.com/albums/rr40/WRFan/ScreenShot61.jpg
