Jump to content

Making a power Toggle-able?


DracoX09

Recommended Posts

I have spells for my mod Bound Elemental Arrows, but was hoping I could make them into powers so the character could conjure the arrows with a bow equipped. Unfortunately just changing them into powers doesn't really work very well as the magic effect stays on the character for the full duration, and if the power is cast again the arrows are removed but the effect is not, and then using the power again won't do anything until the effect ends. Is there a way that I can just make the powers toggle like night-eye?

Link to comment
Share on other sites

Is it a spell or an ability?

Assuming it's a spell:

 

Scriptname GenericPowerSpellToggleScript extends activemagiceffect  

Spell Property SpellToBeToggled Auto

MagicEffect Property OneMagicEffectOfToggleSpell Auto

Actor Property PlayerRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	If akCaster == PlayerRef
		If PlayerRef.HasMagicEffect(OneMagicEffectOfToggleSpell)
			PlayerRef.DispelSpell(SpellToBeToggled)
		Else
			SpellToBeToggled.Cast(PlayerRef, PlayerRef)
		EndIf
	EndIf
EndEvent

 

 




Assuming it's an ability:

 

Scriptname GenericAbilityToggleScript extends activemagiceffect  

Spell Property AbilityToBeToggled Auto

String Property AbilityMessageOn Auto
String Property AbilityMessageOff Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	If akTarget.HasSpell(AbilityToBeToggled)
		akTarget.DispelSpell(AbilityToBeToggled)
		akTarget.RemoveSpell(AbilityToBeToggled)
		Debug.Notification(AbilityMessageOff)
	Else
		akTarget.AddSpell(AbilityToBeToggled, False)
		Debug.Notification(AbilityMessageOn)
	EndIf
EndEvent

 

 

Edited by Fantafaust
Link to comment
Share on other sites

I mean the original spell/ability. These scripts have to be put on a new magic effect, and a new spell, which of course can be a lesser power.
That's how all the toggle abilities in my mods work.

It's a new magic effect and new lesser power spell per toggle, btw.

So it'll basically be like this:
Spell1MagicEffect
Spell1
Spell1ToggleEffect
Spell1TogglePower - Player gets this one

And so on for all your spells.

Edited by Fantafaust
Link to comment
Share on other sites

I mean the original spell/ability. These scripts have to be put on a new magic effect, and a new spell, which of course can be a lesser power.

That's how all the toggle abilities in my mods work.

 

It's a new magic effect and new lesser power spell per toggle, btw.

 

So it'll basically be like this:

Spell1MagicEffect

Spell1

Spell1ToggleEffect

Spell1TogglePower - Player gets this one

 

And so on for all your spells.

 

Thank you so much! Again! Really wish I knew more about scripts and making mods, hopefully I'll learn more as I go on. You sir, are awesome!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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