Jump to content

Spell that affect the caster by hitting a foe.


Recommended Posts

Recently I started using CK, and I don't know how to do this.

 

What I need to do to make a Contact Delibery spell to affect the caster, instead of apply the effect on enemies reached by the attack, or how can I do reference to a generic actor (like enemies, or actors from certain faction) inside Self Delibery spells, that is not Subject or Target? (in this case, "Subject" and "Target" it's the same). The effect that I want to get in the caster does not matter. Thanks in advance for your responses.

Edited by Guest
Link to comment
Share on other sites

Hey, so if I'm understanding correctly, when you cast the spell, you want it to affect caster, but only if it hit a certain type of enemy? If so, you can keep the spell as is with Contact Delivery and put the condition GetFactionRank SomeFaction > 0 on the subject. Then you can put a script the your spell's magic effect that casts another spell on the caster:

Scriptname MyModCasterScript extends ActiveMagicEffect 

Spell Property MyModCasterSpell Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    MyModCasterSpell.Cast(akCaster, akCaster) ;the caster casts the MyModCasterSpell on himself
EndEvent

Make sure the spell used in the script is different that the spell the original caster uses. Also, name the spell in the script the ID name you gave it in the creation kit. Also name the script something unique to your mod.

 

Compile the script, put it on your magic effect, then click properties and Auto Fill All. For compiling scripts I prefer to use Skyrim script compiler pro final: https://www.nexusmods.com/skyrimspecialedition/mods/31700/

Edited by dylbill
Link to comment
Share on other sites

hi, thanks for the sugerence. Second spell is casting when I get the first one, and not when I hit an actor. It would be easier to me if you explain the script. I have very little experience in coding, but I think I undestand most of the code. I don't think that the issue is in the script, I probably did something wrong, or Contact Delivery spells don't work like I think they do. Especially, what do you mean when you say "Spell Property MyModCasterSpell Auto" or "Auto Fill All"?

 

(sorry if I have some error writing, I don't fully dominate English)

Edited by Guest
Link to comment
Share on other sites

It it's casting the spell then it's filled correctly. Basically, the script uses assets in the Creation Kit. After compiling and attaching, you have to fill the script properties with the correct assets. If they are named the same in the script as in the creation kit, clicking Auto Fill All will automatically fill the script property with the correct creation kit asset.

 

Maybe you need to change the delivery type to aimed and use a spell projectile. Look at the projectile the spell Heal Other uses, as it's invisible.

Link to comment
Share on other sites

If that's the case, I would make your spell have a duration, a minute or something, and then use the OnHit event in the script. So, you cast the spell on an NPC, then when you hit the NPC with a weapon, it casts your boost spell on yourself. This would happen every time you hit the NPC while the spell is still active on them.

 

The script would look like this:

 

Scriptname MyMyCasterScript extends ActiveMagicEffect 

Spell Property MyModCasterSpell Auto
Actor Caster

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Caster = akCaster ;saves the Caster NPC for later use with the OnHit event
EndEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) 
    If (akAggressor as actor) == Caster && abHitBlocked == false ;If this npc was hit by the Caster and the hit was not blocked. 
        MyModCasterSpell.Cast(Caster, Caster) ;the caster casts the MyModCasterSpell on himself
    Endif
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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