Custom timer script not working

Post » Sun Feb 09, 2014 3:20 pm

Hi,

I wanted to make the following modification to the shield 'Spell Breaker': instead of giving a passive bonus (30% chance of spell reflection) it now provides an active bonus: 100% chance of spell absorption provided that the shield is raised just before being hit by an incoming spell.

This is the script I wrote:

ScriptName aatlSpellBreakerTweakScriptfloat timerbegin gamemode	if iscontrolpressed 6		player.addspell aatlMaxAbsorbAbility		if (timer < 2)			set timer to timer + getSecondsPassed		else			player.removespell aatlMaxAbsorbAbility			set timer to 0		endif	endifend		

The script only works partially:

aatlMaxAbsorbAbility is a spell of type ability that grants the player 100% spell absorption. This ability is correctly added to the player upon pressing the block button. So far, so good.

Unfortunately, the ability doesn't get removed after 2 seconds of being added (which is what I want to achieve with the timer). In fact, when the ability is added, it never gets removed.

Can anybody see what I'm doing wrong?

Thanks in advance!

User avatar
^~LIL B0NE5~^
 
Posts: 3449
Joined: Wed Oct 31, 2007 12:38 pm

Return to IV - Oblivion