Jump to content

Help with adding cooldown effect to spells


Shaydow

Recommended Posts

I'm attempting to add a cool down to a castable spell yet I can't seem to figure out how. Using Wait doesn't work as the spell can just be recast again. I do not want to make it a shout. The only way I have currently been able to implement it is to have the script remove the spell, then use the wait function, followed by re-adding the spell. This is less than ideal however since if the player has the spell as a favorite, whenever it is removed then added again the spell is removed from favorites and must be re-added.

 

Anyone know any other way to add a cooldown to a castable? Thanks in advance.

Link to comment
Share on other sites

  • 3 weeks later...

I made a similar mechanic a while back. Try the following:

1) Active Magic Effect, constant, self (basically an ability)

2) States; one active (normal, where you can cast) and one "cooldown" state (where you can't)

2.1) Within your active state, use the OnSpellCast event, then within the event calculate the cooldown timer (I'm assuming it's based on the spell you're casting or something) and use GoToState("cooldown")

2.2.) Within the cooldown state, use the event OnBeginState, then within it use a while loop (while thisVariable > 0) then within the loop, use Utility.Wait(1.0) then decrement thisVariable by one (thisVariable -= 1)

2.2.2) Use another OnSpellCast event inside the cooldown state, and within it, use the Spell.InterruptCast() to prevent yourself from casting

2.3) Outside the while loop use the GoToState("active") since it means the cooldown is over

 

Hope it helps.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...