Jump to content

Spell that affect the caster by hitting a foe.


Recommended Posts

 

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.

What I'm looking for is a spell that user has like a constant ability. "When I hit people I gain this" and not "When I cast this spell in people then I hit them I gain this". Sorry if I'm not explaining myself right. That would work for me if it's in there any way to cast a spell in others with a constant passive ability. Looks like what I need is Self Delibery, Ability Type spell that check with OnHit event if the owner is attacking someone else.

Link to comment
Share on other sites

Ah, if that's the case, you can use a cloak spell on the player to give Ability Spells to enemies around you. Here's some detailed instructions on how to do that:

 

A: Make the ability spell that will be actually used on NPC's

1: Make a new magic effect.

 

Archetype: Script

Casting Type: Constant effect

Delivery: Self

 

Put this script on the magic effect:

 

 

Spell Property MyModCasterSpell Auto
Actor Property PlayerRef Auto

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

 

Name the script something more unique.

 

2: Make a new spell. For this example I'll call it NPCOnHitAbility

Type: Ability

Casting: Constant effect

Delivery: Self

 

Put the magic effect you just made above on this spell.

 

 

B. Make a new spell that will add the ability to enemy NPC's.

1: Make a new magic effect

Archetype: Script

Casting Type: Concentration

Delivery: Aimed

 

Put this script on the magic effect:

 

 

Scriptname MyModAddSpellScript extends ActiveMagicEffect 

Spell Property NPCOnHitAbility Auto 

Event OnEffectStart(Actor akTarget, Actor akCaster) 
    akTarget.AddSpell(NPCOnHitAbility)
EndEvent

Again name the script something more unique. After compiling and attaching, be sure to hit Properties and Auto Fill All.

2: Make a new spell. For this example I'll call it AddSpellNPCOnHitAbility

Type: Spell

Casting: Concentration

Delivery: Aimed

 

Add the magic effect you just made from above to the spell. Put the conditions

HasSpell NPCOnHitAbility == 0 AND

GetRelationshipRank < 0

 

This way, the cloak will only affect NPC's who don't already have the ability, and NPC's who are enemies.

 

C: Make the cloak spell that will be put on the player.

1: Make a new magic effect

Archetype: Cloak

Casting Type: Constant Effect

Delivery: Self

 

Assoc Item 1: AddSpellNPCOnHitAbility

Set the Assoc Item 1 to AddSpellNPCOnHitAbility, which is the spell you just made above.

 

2: Make a new spell. This will be the cloak spell you put on the player. Name it whatever you like.

Type: Spell

Casting: Concentration

Delivery: Aimed

 

Put the magic effect you just made above on this spell.

The magnitude you put on the magic effect determines the radius of the cloak. I'd make it a fairly large number, Like 2000

 

That's it, put the cloak on the player and it should cast the spell from the first script whenever you hit an enemy.

 

In summary you need 3 spells.

1. The ability that goes on NPC's.

2. The AddSpell Spell that goes on the Assoc Item 1 magic effect of the cloak.

3 The actual cloak spell.

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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