Jump to content

Help with giving functions in a script a duration.


Recommended Posts

I've created the following script that's supposed to neutralize a mage for x amount of time. It dispels all magic effects, nukes their Magicka to 0, and is supposed to temporarily keep them from regaining that Magicka in any significant way.


However the last part, specifically the "MagickaRateMulti" needs to have a duration. And i have no idea how to do that. Also if there is a better way to do this, like setting Magicka value to o instead of damaging it, and then stopping that function at the same time that magicka rate starts up again.

The end goal i'm going for is on start their effects are dispelled, magicka is set to 0, and regain is crippled, after x amount of time magicka rate will return to normal



Scriptname EAC_MageKillerDispel extends activemagiceffect


Function OnEffectStart (Actor akTarget, Actor akCaster); applies following functions

akTarget.DispelALLSpells()

akTarget.DamageActorValue("Magicka",10000)

akTarget.ForceActorValue("MagickaRateMult",1)

endFunction



I know that NPC mages also get a little help perk wise from the game in order to spam magic so if there's a better way to do this please let me know.


Any help would be appreciated.


Link to comment
Share on other sites

The magicka drain and regeneration limit should be applied through magic effects directly not through scripted functions. That way the actual duration for the spell will control the length of time the effect lasts and there's no possibility of quirky behavior if there's a scripting system glitch. If there's a magic effect for dispel that should be used too, but if not the simple DispelAllSpells function call at effect start will be fine.

Link to comment
Share on other sites

That's what i ended up doing but now i have another problem. If all effects happen at the same time, then the dispel one dispels the other 2 effectively making them do nothing. So i need to figure out a way to control the timing of the effects somehow

Link to comment
Share on other sites

You could make it two spells, with the first one doing the scripted dispel and then letting the script force the actor to cast a the second spell that holds the other two effects. You can make the second spell zero cost but I'm not sure that's even needed if you force the NPC to cast it via script.

Link to comment
Share on other sites

So something like this? This would be the most complicated script i've written so i'm sorry if the syntax is awful. Also wasn't sure what type of property that would be. Thank you for all the help by the way!



Scriptname EAC_MageKillerDispel extends activemagiceffect


SPELL Property MageKillerSecondaryEffects Auto


Function OnEffectStart (Actor akTarget, Actor akCaster); applies following functions

akTarget.DispelALLSpells()

debug.messagebox("dispelled")

RegisterForSingleUpdate(1.0)

endFunction


EventOnUpdate()

MageKillerSecondaryEffects.cast(Self,Self)

debug.messagebox("Secondary spell casted")

EndEvent


Edit: So i know this doesnt compile (Gets an error of "(11,13): no viable alternative at input '(' "

but am i on the right track at least?



Link to comment
Share on other sites

  • Recently Browsing   0 members

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