Firerune999 Posted July 5, 2024 Posted July 5, 2024 Hello everyone! I don't know if this is the best place for it, but I'm trying to make some weapons cast spells upon power attacking, and i've had some success doing so, but the process is so full of details, that it got me stumped right now. The mod Colorful Magic has a version of the Bloodskal script that lets you choose which spell you want to cast for every power attack direction, and this seemed exactly what i wanted, because the original Bloodskal only has two types of spell to be cast, the horizontal and vertical wave beam. The thing is that while this script works perfectly for greatswords - i can power attack in any direction and it will cast all the spells - it doesn't fully work for one handed swords, it will only work for sideways power attacks and back power attacks. On top of that, it won't work for left handed power attacks, and since i plan to apply this behavior of casting spells on power attack for a dual wielding npc, this is a problem for me. Since i don't have access to the source scripts of Colorful Magic, i can't see how it checks for each type of power attack, so i decided to create my own script based on the vanilla Bloodskal script. I saw that it checks for power attacks, but since i'm a newbie with skyrim scripts, i'm not familiar with what corresponds to one handed right and left power attacks. Upon searching that on google, i actually found a post on reddit that tries to cover basically what i want regarding this script - a way to check for each type of power attack, including left handed and dual wield, and cast a spell accordingly. https://www.reddit.com/r/skyrimmods/comments/jvkmw8/i_found_a_way_to_apply_the_bloodskal_blade_effect/ I made some changes to the script and compiled it in CK, added it to a magic effect, added the MGEF to an ability, and created a perk that adds this ability. I added the perk to me through console to test it, but since only the npc will have access to this ability, i will add it directly to her perks. The script below is the implementation, but i added properties for two more spells to test if it would work the way i want it to, but i'm having problems with it. scriptname _MariaEduardaHurtadoWarglaiveAbility extends activemagiceffect spell property SpellToCast auto spell property SpellToCast2 auto spell property SpellToCast3 auto actor PowerAttacker event OnEffectStart(Actor akTarget, Actor akCaster) PowerAttacker = akTarget RegisterForAnimationEvent(PowerAttacker, "WeaponSwing") RegisterForAnimationEvent(PowerAttacker, "WeaponLeftSwing") RegisterForAnimationEvent(PowerAttacker, "AttackPowerStanding_FXstart") RegisterForAnimationEvent(PowerAttacker, "AttackPowerRight_FXstart") RegisterForAnimationEvent(PowerAttacker, "AttackPowerLeft_FXstart") RegisterForAnimationEvent(PowerAttacker, "AttackPowerBackward_FXstart") RegisterForAnimationEvent(PowerAttacker, "AttackPowerForward_FXstart") endEvent event OnAnimationEvent(ObjectReference akSource, string asEventName) int WeaponType = PowerAttacker.GetEquippedItemType(0) bool Rotation = PowerAttacker.GetAnimationVariableBool("bAllowRotation") bool LetsSneak = PowerAttacker.IsSneaking() if asEventName == "WeaponSwing" if (WeaponType == 6) if (PowerAttacker.GetAnimationVariableInt("iState") == 12) debug.Notification("Fixed 2-H Power Attack for axes and hammers; works with sneak.") SpellToCast.Cast(PowerAttacker) endIf elseIf ((WeaponType > 0) && (WeaponType <5)) if !LetsSneak bool LeftAttack = PowerAttacker.GetAnimationVariableBool("bLeftHandAttack") if LeftAttack && Rotation debug.Notification("Left handed Power Attack") SpellToCast.Cast(PowerAttacker) elseIf !LeftAttack && Rotation if (asEventName == "AttackPowerForward_FXstart") debug.Notification("Right handed Forward Power Attack.") SpellToCast2.Cast(PowerAttacker) elseIf (asEventName == "AttackPowerStanding_FXstart") debug.Notification("Right handed Standing Power Attack.") SpellToCast3.Cast(PowerAttacker) else debug.Notification("Right handed Power Attack.") SpellToCast.Cast(PowerAttacker) endIf endIf endIf endIf elseIf asEventName == "WeaponLeftSwing" if Rotation && !LetsSneak debug.Notification("Dual Wield Power Attack First Hit") SpellToCast2.Cast(PowerAttacker) endIf else ;every other animation event registered if WeaponType != 6 ;Necessary because for some weird ass reason, Bethesda decided to count hammers and axes power attacks to only count towards these events when sneaking debug.Notification("Greatsword power attacks") SpellToCast.Cast(PowerAttacker) endIf endIf endEvent The character i created is a demon hunter that unleashes different types of fel fire spells depending on her attacks. The behavior i want is casting spell1 when performing sideways power attacks with the right hand weapon or any power attack with left hand weapon, casting spell2 when performing a forward power attack with right weapon, and casting spell3 when performing standing power attack with right weapon. What happens, though, is that EVERY right weapon power attack casts spell 1, EVERY left hand power attack casts spell 2 (left weapon power attacks are being registered as dual wield power attacks for some reason), and the two last hits from the dual wield power attack are being registered as left hand power attacks (this causes the dual wield power attack to cast spell2 one time and spell1 TWO TIMES, which is really overpowered, so i don't want dual wield power attacks to cast spells), it's like bethesda inverted them for some reason, or my script is wrongly checking what power attack is being performed. 0705.mp4 0705(1).mp4 0705(2).mp4 Can someone help me?
traison Posted July 5, 2024 Posted July 5, 2024 Ooh, WC3 demon hunter blades I see. 8 minutes ago, Firerune999 said: Since i don't have access to the source scripts of Colorful Magic, i can't see how it checks for each type of power attack Upload the pex you think is responsible, and I'll get you the source.
Firerune999 Posted July 5, 2024 Author Posted July 5, 2024 20 minutes ago, traison said: Ooh, WC3 demon hunter blades I see. Upload the pex you think is responsible, and I'll get you the source. Sure! Here you go cccBeamSwordScript.pex
Firerune999 Posted July 5, 2024 Author Posted July 5, 2024 (edited) 55 minutes ago, traison said: cccBeamSwordScript.psc 10.06 kB · 0 downloads Thanks a lot! This script is actually more complex than i thought. I still can't make why one handed swords wouldn't cast spells on all directions using this script though. The BM costs are all 0, so this shouldn't be an issue, and if the Speed and Direction conditions are actually set right, it should work normally. I saw that the events "AttackPowerSomething_FXStart" are for greatswords only, and for other weapons, the event is WeaponSwing plus more specific conditions, which i still don't quite get, given how confuse i am with the script i posted here. Bethesda should have made every weapon register "AttackPowerSomething_FXStart", and use GetEquippedItemType to specify the weapon type, it would be much simpler, i guess. Does anyone have any insight on this? Edited July 5, 2024 by Firerune999
DarkBlade13 Posted July 5, 2024 Posted July 5, 2024 (edited) What I remember is that the power atack you play depends on the direction you move with your keys. When you do power atack while not moving it's straight. When you do power atack when moving left or right the direction changes. I saw in the creation kit wiki that you can find the power atack animation event. You can also track through script what direction players are moving by looking for the key. This would be the code for the possible keys https://ck.uesp.net/wiki/Input_Script. Then you get an is key pressed script https://ck.uesp.net/wiki/IsKeyPressed_-_Input. All together I think this should allow you to only cast spells on certain power atacks. Haven't really touched power atacks before though. If you need more aditional information or help feel free to contact me. I did write recently a script to press a key. Anyway wiki said you should use register for the key. Apparently much less heavy for the engine. https://ck.uesp.net/wiki/RegisterForKey_-_Form. Edited July 5, 2024 by DarkBlade13
traison Posted July 6, 2024 Posted July 6, 2024 1 hour ago, Firerune999 said: Does anyone have any insight on this? I'd say the solution to your problem is on line 80. 1 hour ago, Firerune999 said: Bethesda should have... ..alot of things, yes. That's why we have SKSE, because they didn't. They've made the same mistake several times already, every single time someone has to write the equivalent of OBSE, SKSE, F4SE, ...
Miauzi Posted July 6, 2024 Posted July 6, 2024 Bugdesta had put a kind of "magic beam" into a two-handed sword for the DLC "Dragonborn" - this was used in a quest to open the multi-part lock of a stone door. To do this, you had to move the 2H sword either vertically from top to bottom or sideways... which only worked if you combined the power attack with the simultaneous movement of the game character
Firerune999 Posted July 10, 2024 Author Posted July 10, 2024 On 7/5/2024 at 9:05 PM, traison said: I'd say the solution to your problem is on line 80. That was it, thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now