mmft93 Posted April 29, 2019 Share Posted April 29, 2019 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 AutoIdle Property akIdle1 AutoIdle Property akIdle2 AutoIdle Property akIdle3 AutoIdle Property akIdle4 AutoSpell Property akSpell AutoSpell Property akSpell2 AutoFloat 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 == 0Game.GetPlayer().PlayIdleWithTarget(akIdle0, akTarget)Utility.Wait(2)akTarget.DamageAV("Health", DamAugment)Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)AkSpell2.Cast(RandomActor1, RandomActor1)EndIfIf Random == 1Game.GetPlayer().PlayIdleWithTarget(akIdle1, akTarget)Utility.Wait(2)akTarget.DamageAV("Health", DamAugment)Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)AkSpell2.Cast(RandomActor1, RandomActor1)EndIfIf Random == 2Game.GetPlayer().PlayIdleWithTarget(akIdle2, akTarget)Utility.Wait(2)akTarget.DamageAV("Health", DamAugment)Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)AkSpell2.Cast(RandomActor1, RandomActor1)EndIfIf Random == 3Game.GetPlayer().PlayIdleWithTarget(akIdle3, akTarget)Utility.Wait(2)akTarget.DamageAV("Health", DamAugment)Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)AkSpell2.Cast(RandomActor1, RandomActor1)EndIfIf Random == 4Game.GetPlayer().PlayIdleWithTarget(akIdle4, akTarget)Utility.Wait(2)akTarget.DamageAV("Health", DamAugment)Actor RandomActor1 = Game.FindRandomActorFromRef(Game.GetPlayer(), 1000)AkSpell2.Cast(RandomActor1, RandomActor1)EndIfEndEvent Can anyone tell me what's wrong with it please and thank you. Link to comment Share on other sites More sharing options...
fore Posted April 29, 2019 Share Posted April 29, 2019 You have to take into consideration how the actors stand. At least some of the killmoves check (in the behavior files) if the killer is in front or behind his victim. Link to comment Share on other sites More sharing options...
mmft93 Posted April 29, 2019 Author Share Posted April 29, 2019 Oh ok, that makes sense. In other words I can't just use Game.GetPlayer().MoveTo(aktarget) I have to set them into position. Thanks Fore Link to comment Share on other sites More sharing options...
fore Posted April 29, 2019 Share Posted April 29, 2019 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 More sharing options...
mmft93 Posted April 30, 2019 Author Share Posted April 30, 2019 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 More sharing options...
jucoking Posted April 30, 2019 Share Posted April 30, 2019 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 More sharing options...
mmft93 Posted May 1, 2019 Author Share Posted May 1, 2019 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 More sharing options...
maxarturo Posted May 1, 2019 Share Posted May 1, 2019 (edited) 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 May 1, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts