How to add a script to a spell effect...

Post » Tue Jun 19, 2012 1:46 am

I know this is probably really obvious, and I could probably figure it out through trial and error, but I figured what’s the harm in asking?

Basically, I want to create a spell, a targeted, concentrated spell, which applies a scripted effect for 15 seconds to the target.

Question 1) How do I actually link the script up to the spell?

As I said, I want this to be a targeted concentration spell. Like flames for example, where the spray effect happens constantly as long as you hold the button.

I want the script to apply a 15 sec duration at the first “tick” of the spray effect on a qualifying target. Subsequent ticks will NOT refresh this timer until it has run out. I could probably accomplish this by a simple check whether the spell effect of the spray was already on the target and if so, not re-apply.

However, for every second of “spray” on that target, I want to add to a separate counter. If that counter reaches 10 before the 15sec spell timer runs out, I want to put a different ability type spell on that target actor.

Well, that’s the basics. More questions will follow progress on this part!
User avatar
Isaac Saetern
 
Posts: 3432
Joined: Mon Jun 25, 2007 6:46 pm

Post » Tue Jun 19, 2012 12:52 pm

Scripts are attached to the 'Magic Effect' object that the spell calls.
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Tue Jun 19, 2012 4:47 pm

I struggled with something similar for a while. Concentration spells don't interact with scripts in the way I think they should.
You can check out my Nexus http://forums.nexusmods.com/index.php?/topic/565749-spell-script-not-working-as-intended/page__p__4585684__fromsearch__1#entry4585684.

I thought you should just be able to slap a second scripted effect onto a target to "watch" it for damage using a while loop. But the while loop would only stay active for 1 tick of the spell. I never actually achieved my original goal, but I managed to get a spell that is close to what I want.

For my crappy workaround you'll need: a scripted ability(or 15 sec duration, self target, fire and forget), and a scripted concentration spell

You'll want a script on your concentration spell effect that checks if the target has your spell effect and adds it if not.
something like
Scriptname ConcSpellscript extends ActiveMagicEffectMagicEffect Property YourEffect auto ;the magic effect attached to your 15 second spellSpell Property YourSpell autoEvent OnEffectStart(actor akTarget, actor akCaster)if akTarget.HasMagicEffect(YourSpell) != 1 ;doesn't have effect  YourSpell.Cast(akTarget, akTarget)endifEndEvent

Then take a look at the script at the end of my Nexus thread for the 15 second spell's script. You can gut most of it (since you'll just want a counter). If you need some help with that, post the script you're working with and I'll try to give you some pointers.
User avatar
Pixie
 
Posts: 3430
Joined: Sat Oct 07, 2006 4:50 am

Post » Tue Jun 19, 2012 2:20 pm

Very helpful, thank you! I think for many the hangup was getting the idea there is no place on the actual spell or effect themselves to add the script as a property. "Limbo scripts." That is definitely a new concept, unless you count Morrowind's global scripts.

Going by the Papyrus tutorials you would expect there would be a way to add them as Properties to spells much like with the object reference example they gave. This makes much more sense now!
User avatar
Saul C
 
Posts: 3405
Joined: Wed Oct 17, 2007 12:41 pm

Post » Tue Jun 19, 2012 3:42 pm

EDIT: Never mind.
User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am


Return to V - Skyrim