Toggle-able Abilities?

Post » Sun May 16, 2010 6:28 am

Is there some way to make toggle-able spells and abilities? Like for khajiit night-eye race ability instead of casting every 30 sec, just "cast" to turn on night-eye and then "cast" again to turn it off?
User avatar
elliot mudd
 
Posts: 3426
Joined: Wed May 09, 2007 8:56 am

Post » Sun May 16, 2010 6:19 pm

It can be done. It requires two spells, however, the first being the ability that you want to turn on and off, the second being a scripted lesser power (cast on self of cource) that turns it on and off. Give the lesser power spell to the player, and in it's script put:
scn YourScriptNameshort DoOnceref CasterBegin ScriptEffectStartset Caster to GetSelfif ( DoOnce == 0 )Caster.AddSpell YourAbillityset DoOnce to 1elseCaster.RemoveSpell YourAbilityset DoOnce to 0End

If you're using OBSE, you can check if the spell is present instead of using DoOnce. Unfortunately, vanilla oblivion doesn't have a function that detects a spell's presence.
User avatar
CArla HOlbert
 
Posts: 3342
Joined: Wed Feb 21, 2007 11:35 pm

Post » Sun May 16, 2010 3:17 pm

the normal script function "isspelltarget" also works like the OBSE "hasspell" function, at least in this situation. I am sure there are some differences, but this works here:

scn YourScriptName

ref caster

begin scripteffectstart
set caster to getself
if caster.isspelltarget YourAbility
caster.addspell YourAbility
else
caster.removespell YourAbility
endif
end
User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am


Return to IV - Oblivion