Jump to content

[LE] Help getting NPC to play animations when spell is cast


mmft93

Recommended Posts

I'm making a custom spell thats supposed to make the player and the target play a random kill animation. The problem is sometimes the animation plays other times nothing at all happens. I can't get it to work 100% of the time so i have come to the experts. Here is my script that I have made for the spell.

 

scriptname MMFTSpellDanceofDeath2 extends ActiveMagicEffect
Idle Property akIdle0 Auto
Idle Property akIdle1 Auto
Idle Property akIdle2 Auto
Idle Property akIdle3 Auto
Idle Property akIdle4 Auto
Spell Property akSpell Auto
Spell Property akSpell2 Auto
Float DamAugment
Event OnEffectStart(Actor akTarget, Actor akCaster)
DamAugment = Game.GetPlayer().getAV("OneHanded*5")
akSpell.Cast(Game.GetPlayer(), Game.GetPlayer())
Game.GetPlayer().MoveTo(aktarget)
int random = Utility.RandomInt(0, 4)
If Random == 0
Game.GetPlayer().PlayIdleWithTarget(akIdle0, akTarget)
Utility.Wait(2)
akTarget.DamageAV("Health", DamAugment)
Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)
AkSpell2.Cast(RandomActor1, RandomActor1)
EndIf
If Random == 1
Game.GetPlayer().PlayIdleWithTarget(akIdle1, akTarget)
Utility.Wait(2)
akTarget.DamageAV("Health", DamAugment)
Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)
AkSpell2.Cast(RandomActor1, RandomActor1)
EndIf
If Random == 2
Game.GetPlayer().PlayIdleWithTarget(akIdle2, akTarget)
Utility.Wait(2)
akTarget.DamageAV("Health", DamAugment)
Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)
AkSpell2.Cast(RandomActor1, RandomActor1)
EndIf
If Random == 3
Game.GetPlayer().PlayIdleWithTarget(akIdle3, akTarget)
Utility.Wait(2)
akTarget.DamageAV("Health", DamAugment)
Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)
AkSpell2.Cast(RandomActor1, RandomActor1)
EndIf
If Random == 4
Game.GetPlayer().PlayIdleWithTarget(akIdle4, akTarget)
Utility.Wait(2)
akTarget.DamageAV("Health", DamAugment)
Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)
AkSpell2.Cast(RandomActor1, RandomActor1)
EndIf
EndEvent
Can anyone tell me what's wrong with it please and thank you.

 

Link to comment
Share on other sites

Yes. The game will teleport actor2 in front of the player. Ant that might look rather strange if the player is turned away.

 

Also I tried to remember if the killmoves are suppressed if an enemy is close by. Because the actors cannot respond while a killmove is executed. But I cannot remember, it's too long ago I made these tests.

Link to comment
Share on other sites

OK, thanks you've been a big help. I use Violen Kill Move Mod, it lets me turn off the need to be the last enemy for a kill move to trigger, so I don't think that is a problem not 100% sure though. I'm not to good at figuring out the math to properly place the actors where they need to be. The kill moves where the actors need to be in a bleed-out state seem to work the best, so for now I think that will do. I'll continue to mess around with the placement though I'm almost positive that's what the issue was.

Link to comment
Share on other sites

Using the "Cast" script, it's nearly impossible to accomplish anything because it is so buggy. The wiki states that using the script will bypass player animations and that you should use the "magic (procedure)" instead.

 

I have played around with this quite a bit and sometimes it works, but mostly it won't. Another problem I was having with it is that it doesn't target appropriately and ends up just casting in whatever direction the actor is facing, which might work for you.

 

You could try to replace "cast" with "DoCombatSpellApply" and see if that works any better.

Link to comment
Share on other sites

I'll give it a try. It's a spell that they cast on themselves. I noticed like you said it would cast the spell wherever the player is looking, which usually made the spell miss. That's why instead I had the target actors cast the damage spell on themselves. Then the original spell the player casts is supposed to just trigger the animation. I didn't know about the bypassing animations part, thanks I'll give the "DoCombatSpellApply" a try see how it works out.

Link to comment
Share on other sites

NPC will always cast spells right in front of them, using the NPC's field of view which is fixed to all NPCs to a specified angle and the targeting field to a specific range. (not the length but width).

The "cast" (targeting) is mostly used and works fine for static objects like traps or activators or whatever static you want to cast magic.

In order for an NPC to cast to a specific target you need to use "scenes".

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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