Will scripts work in a cloak spell?

Post » Wed Jun 20, 2012 5:30 pm

This is not working in my cloak spell that is given to the player:


Scriptname aadpAquireActors extends activemagiceffectspell Property ActorCombatAbility AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)actor Target = akTargetif !Target.IsDead() && !target.IsDisabled()		 if (Target.Hasspell(ActorCombatAbility) == 0)		   Target.Addspell(ActorCombatAbility)		   Debug.messagebox("spell now on " + target)		 endifendifendevent


There is NO example of a vanilla cloak spell that also has a script, so I am concerned that scripts will not work in cloak spells.
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm

Post » Wed Jun 20, 2012 5:01 pm

Try:
ScriptName aadpAquireActors extends activemagiceffect Spell Property ActorCombatAbility AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)	If akTarget.IsDead()	ElseIf akTarget.IsDisabled()	ElseIf !akTarget.HasSpell(ActorCombatAbility)		akTarget.AddSpell(ActorCombatAbility)		Debug.MessageBox("spell now on " + akTarget)	EndIf	EndEvent
?

HasSpell() is a Bool function, so it could be the '0'.
User avatar
Jamie Lee
 
Posts: 3415
Joined: Sun Jun 17, 2007 9:15 am

Post » Wed Jun 20, 2012 10:36 pm

Thanks http://www.gamesas.com/user/408976-justinother/ but that did not work either.

Here is the strange part, I get the debug message for the player (object 00014) but not for any other actor. So my version is working but it only worked on the actor it was placed on. And yet it should NOT work on the actor it was placed on because that actor (the player in this case) is the one that is given the cloak spell to radiate.

So I suspect that scripts like this are NOT passed on to the targets of the cloak spell. And any script on a cloak spell will only effect the actor that it is radiating from.
User avatar
Shaylee Shaw
 
Posts: 3457
Joined: Wed Feb 21, 2007 8:55 pm

Post » Thu Jun 21, 2012 4:34 am

I think you might have misunderstood how cloak spells work. When the player casts a cloak spell, he is casting an effect on himself, so any attached scripts will be run on the player.

But a cloak spell works by damaging other actors. It does this by applying the spell in the "assoc. items" to whoever comes into contact with the cloaking spell. So what you should really do is put a script on the spell that you assign to the assoc. items.

Actually, I just wrote an article earlier today on the wiki explaining http://www.creationkit.com/Dynamically_Attaching_Scripts from the threads I've read here. The example I used for actors uses a cloak spell.
User avatar
Andrew
 
Posts: 3521
Joined: Tue May 08, 2007 1:44 am

Post » Thu Jun 21, 2012 12:05 am

I think you might have misunderstood how cloak spells work. When the player casts a cloak spell, he is casting an effect on himself, so any attached scripts will be run on the player.

But a cloak spell works by damaging other actors. It does this by applying the spell in the "assoc. items" to whoever comes into contact with the cloaking spell. So what you should really do is put a script on the spell that you assign to the assoc. items.

Actually, I just wrote an article earlier today on the wiki explaining http://www.creationkit.com/Dynamically_Attaching_Scripts from the threads I've read here. The example I used for actors uses a cloak spell.

One question about this method: What is the range? The standard cloak spell range is pretty low, is that hardcoded or does it depend on the range of the spell the cloak "fires"? If so, I could restructute my auras like that (maybe make them more streamlined).
User avatar
Alexandra Ryan
 
Posts: 3438
Joined: Mon Jul 31, 2006 9:01 am

Post » Wed Jun 20, 2012 3:33 pm

One question about this method: What is the range? The standard cloak spell range is pretty low, is that hardcoded or does it depend on the range of the spell the cloak "fires"? If so, I could restructute my auras like that (maybe make them more streamlined).

The range of a cloak spell depends on the magnitude of the cloak effect. I used a magnitude of 192 feet (4096 units, the length of a cell). I put a script on the applied spell that gave me the distance of the actor from the caster on effect start and it works fine. Haven't tried longer ranges though.
User avatar
Oscar Vazquez
 
Posts: 3418
Joined: Sun Sep 30, 2007 12:08 pm

Post » Thu Jun 21, 2012 2:32 am

The AssocItem1 in your cloak is the actual effect that is applied to the other NPCs...put your script there, not in the cloak itself.

That's how Jzargo's "Supercloak" scrolls work.
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm

Post » Wed Jun 20, 2012 7:08 pm

I recently made a cloak spell as well and was also confused by the range.

The best thing to do is to find the spell FireCloak, look at the magic effect it has and copy that, look at the spell mentioned in Item 1 and copy that, and copy the second magic effect referenced in that second spell.

Notice that the first magic effect is the cloak that goes on yourself, and the second magic effect is the damaging effect that goes on your enemies. If you untick the no area checkbox on the first magic effect and then jack up the area in the spell itself, the cloak will actually apply to anyone within that area that meets the conditions, which is NOT what you want, you don't want to be giving people the cloak, you want to be damaging them with the cloak.


Now here is the interesting and misleading part. To make your cloak reach out and hit people at longer ranges, you leave the "no area" checkbox in the cloak magic effect ticked, and you go into the spell, and increase the magnitude of the effect. The magnitude, for cloak effects, is actually the "range."


Your script actually needs to go on the second magic effect, which is the spell that your cloak magic effect will continually cast on enemies that are within the appropriate range.


A note on conditions. The conditions that define the type of target you want to apply the script or damage to with the cloak go in the SECOND magic effect.
User avatar
Heather beauchamp
 
Posts: 3456
Joined: Mon Aug 13, 2007 6:05 pm


Return to V - Skyrim