Jump to content

Need help! How do I add a cooldown to a spell?


morogoth35

Recommended Posts

A couple thoughts:

 

"Silence and cooldown are under the same spell(hide from UI if you want) is cast, the silence spell hits the actor, does its thing, the cooldown effect that is on the player is in effect and the condition for silence can't be used as long as the cooldown is active."

 

If i'm understanding the sentence properly then it's not right i think. All effects on a spell must have the same casting type and delivery so one can't hit the actor and the other the player.

 

Then, afaik conditions on spells/magic effect would cause the effect to simply not do anythign on the target but you can still cast it and therefore you'd waste mana. Cooldown should prevent casting. I did spell cooldown in my paladin mod and what i did was:

 

> Have a perk added with the spell (i had it already for other effects of the armor), could also be permanently added to the player too.

the perk basically uses mod spell cost to increase the spell cost of the spell in question if the caster has a magic effect with an special keyword.

 

> The spell has the effect that does its thing and then the cooldown effect that lasts longer and has the special keyword, trigering the perk for the duration of the cooldown.

 

So while on cooldown time you can't cast it because the cost is infinite (99999). Only works for the player but "Delay time" on the magic effect should do that for npcs according to the wiki, never used it though.

 

You'd still have the different delivery problem, since in my case the spell was casted on self (summon).

 

Another option would be to have the cooldown effect on the target and just check for that on the effect, simple but you'd waste mana on targets that are on cooldown.

 

So for this scripts might be needed i think. Sure you can't balance it another way like spell cost or casting time?

Link to comment
Share on other sites

If i'm understanding the sentence properly then it's not right i think. All effects on a spell must have the same casting type and delivery so one can't hit the actor and the other the player.

 

 

 

Correct, but there is already a vanilla script precisely for casting an effect on self so that effects can have multiple target types, therefore there is no need to write your own script or include a bsa with your mod (unless you need a bsa for other purposes of course).

 

Then, afaik conditions on spells/magic effect would cause the effect to simply not do anythign on the target but you can still cast it and therefore you'd waste mana.

 

 

 

If the spell is set to autocalculate then the cost will not include effects that are conditioned not to fire, so the magicka cost will be 0 if all effects are conditioned not to fire.

 

I have typically added a second effect with the opposite conditions and 0 cost which displays a message that the spell cannot be cast for XYZ reason and plays the spell failure sound effect so the player has some feedback about why their spell didn't work. And of course they will have the cooldown effect in their active effects list.

Edited by lofgren
Link to comment
Share on other sites

A couple thoughts:

 

"Silence and cooldown are under the same spell(hide from UI if you want) is cast, the silence spell hits the actor, does its thing, the cooldown effect that is on the player is in effect and the condition for silence can't be used as long as the cooldown is active."

 

If i'm understanding the sentence properly then it's not right i think. All effects on a spell must have the same casting type and delivery so one can't hit the actor and the other the player.

 

Then, afaik conditions on spells/magic effect would cause the effect to simply not do anythign on the target but you can still cast it and therefore you'd waste mana. Cooldown should prevent casting. I did spell cooldown in my paladin mod and what i did was:

Fired through a simple script. I left it open in case there's a clever way to do it without a script. I thought it was a given that you can't mix and match and it would have to be forced someway.

 

Edit:

 

A secondary cooldown magic effect that fires at the same time as the actual effect

I did say that and left it open to the OP to force it.

Edited by Elias555
Link to comment
Share on other sites

If the spell is set to autocalculate then the cost will not include effects that are conditioned not to fire, so the magicka cost will be 0 if all effects are conditioned not to fire.

 

I have typically added a second effect with the opposite conditions and 0 cost which displays a message that the spell cannot be cast for XYZ reason and plays the spell failure sound effect so the player has some feedback about why their spell didn't work. And of course they will have the cooldown effect in their active effects list.

 

Ah, right, didn't thought it. I should admit in the past i've sometimes set a fixed cost instead of properly setting the base costs, more on enchantments than spells though but still.

 

Fired through a simple script. I left it open in case there's a clever way to do it without a script. I thought it was a given that you can't mix and match and it would have to be forced someway.

 

Ah ok, said it just in case. Didn't know about the script lofgren mentioned though, I should check vanilla scripts more often.

Link to comment
Share on other sites

Here's how I do it when the magic effect is different:

Scriptname AceCooldownAddingScript extends activemagiceffect  

Spell Property CoolDownSpell Auto
Actor Property PlayerRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

;Empty here

Endevent


Event OnEffectFinish(Actor akTarget, Actor akCaster)

	CoolDownSpell.Cast(PlayerRef)
	
EndEvent

You need to tick no recast(depends on how the spell works, you might not need this) and add conditions to the magic effect of both the cooldown and the main effect with HasMagicEffect cooldownspellname == 0 on the player. On the main effect you can also add HasMagicEffect MainSpellName == 0 on the player. That prevents the player from spamming the spell before the cooldown spell fires.

Choose the method you prefer.

Link to comment
Share on other sites

"Correct, but there is already a vanilla script precisely for casting an effect on self so that effects can have multiple target types, therefore there is no need to write your own script or include a bsa with your mod (unless you need a bsa for other purposes of course)." What is the script called?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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