baldy3456 Posted December 30, 2020 Author Share Posted December 30, 2020 I have sett everything up as described above and I am running into an issue.The magic effect is not changing when I sneak. I set them to visible in UI and I only seem to get the Sneaking == 0 one and never the Sneaking == 1. I am not sure where I am going wrong. It could be in the setting on the magic effects or in the condition. The Magic effect Condition for Sneaking True is Target PL, Function Name IsSneaking, Function Info NONE, Comp ==, Value 1.00, AND.That seems correct to me but I can not get this to work. I know the ability is equipping too because the Sneaking equals false shows up with the spell equipped. Link to comment Share on other sites More sharing options...
dylbill Posted December 30, 2020 Share Posted December 30, 2020 (edited) Ahh gotcha, it does sound like a cool concept! I'd be willing to help out from time to time. For your ability magic effect make it: Archetype: Script Casting Type: Constant Effect Delivery: Self Make the spell Type: Ability Casting: Constant Effect Delivery: Self I did a simple test with the script. I set the SpellToCheck to the frostbite spell and the SpellToEquip to the flames spell in one magic effect with the IsSneaking == 0 , and the opposite in another magic effect with the condition IsSneaking == 1. You can have it run of subject so other NPC's can make use of it. It equips the flames spell when sneaking if the frostbite spell is already equipped and vice versa when not sneaking. To add the ability you need to use AddSpell somehow when equipping your main spell. I just did it with the console for the test. I also use a controller, but I use antiMicro to custom map my controller to keyboard keys, that way I can still use hotkeys. I use a playstation controller and set up the left trigger as a modifier for hotkeys. So if I'm holding the left trigger, the main controller keys hit the number keys 1 - 9 and some others. Edited December 30, 2020 by dylbill Link to comment Share on other sites More sharing options...
baldy3456 Posted December 30, 2020 Author Share Posted December 30, 2020 Okay so the scripts are working but only on equip. So if I equip the Custom flame spell while not sneaking it is equips. If I equip the same spell while sneaking it forces the Custom Rune spell. The opposite happens when equipping the Custom rune spell. Also the spells adding the Ability works. I did not have to add that in with commands. I did add the Rune spell though. I will test if this works with out adding that in my spell list.How do I have this work outside of forcing the player to re-equip? The Function I am looking for is I equip this spell while not sneaking and when I sneak it forces the new spell to equip with no button presses.Thanks again for the help though this is the farthest I got and very promising. Link to comment Share on other sites More sharing options...
baldy3456 Posted December 30, 2020 Author Share Posted December 30, 2020 Should I use something like OnUpdate - ActiveMagicEffect? It seems like that is looping while an Effect is active. I am not sure exactly how I would change the script to account for that though. The description says to be carful to make sure the Effect is removed or this will continue to run. Is this something that would be bad practice to have running? It also looks like there is is an OnBeginState and OnEndState event that may be useful. Link to comment Share on other sites More sharing options...
dylbill Posted December 30, 2020 Share Posted December 30, 2020 Hey, the ability should be a separate spell than your actual equipped spells, which is why you would need to add it via script. I set up a script on a reference alias in a new quest with the OnObjectEquipped event. Here is an example of how it would work: https://www.mediafire.com/file/m6aoz0ya6a2rl7p/Test_Mod_Spell_Equip_Conditions.zip/file I set up two spells in that example. If you're not sneaking, and flames is equipped, it equips frostbite and vice versa. It automatically switches spells when sneaking or exit from sneaking. I did the same with firebolt and ice spike. The two ability spells are TestModAbility, uses TestModFx and TestModFx02 magic effects. TestModAbility01 uses TestModFx03 and TestModFx04. The ReferenceAlias Script is on the PlayerAlias in the TestModQuest. Try it out, hope that helps! Link to comment Share on other sites More sharing options...
baldy3456 Posted December 30, 2020 Author Share Posted December 30, 2020 Thanks for making this test! I tested it and it worked.I opened it in the editor but was unable to see the script. I could only edit the properties. That set up looks pretty similar to mine accept your properties had that Ability called out as ThisAbility. I did have my ability separate from my Fire spell. I just was using the Equip Ability field in the Magic Effect of the Custom Fire spell to apply the ability. I am assuming that having it applied with the spell unequipped is what I was missing.I was not able to se the script to see why the TestModFX magic effect's Script had to reference the ability that contained TestModFX and TestModFX02. There also seems to be some noticeable lag when switching equipped spells. Is there a way around that. I only ask because with the set up I have now the Switch is quite fast but requires a re-equip. I ran into some issues with scripts not firing with the right hand or if I equip spells across both hand (Double tapping the Quick select button) Link to comment Share on other sites More sharing options...
dylbill Posted December 30, 2020 Share Posted December 30, 2020 (edited) No problem. For all of my scripting I use this mod: https://www.nexusmods.com/fallout4/mods/49071. You can also just open the source scripts with a text editor. For getting rid of the lag, using animation events is better. After a little bit of testing I got it to work. So for your ability, use only one magic effect with no conditions on it and attach this script: Scriptname TestMod_MagicEffectA extends ActiveMagicEffect Spell Property ThisAbility Auto ;The ability this magic effect is on Spell Property SneakSpell Auto Spell Property NonSneakSpell Auto Actor Target Event OnEffectStart(Actor akTarget, Actor akCaster) Debug.Notification(Self.GetBaseObject().GetName() + " Started on " + akTarget.GetDisplayName()) SwitchSpells(akTarget) Target = akTarget ; Sneaking Animation Events ; Non-combat: ; Enter sneaking while standing: tailSneakIdle ; Enter sneaking while moving: tailSneakLocomotion ; Leave sneaking while standing: tailMTIdle ; Leave sneaking while moving: tailMTLocomotion ; ; During Combat: ; Enter sneaking while standing: tailSneakIdle ; Enter sneaking while moving: tailSneakLocomotion ; Leave sneaking while standing: tailCombatIdle ; Leave sneaking while moving: tailCombatLocomotion RegisterForAnimationEvent(akTarget, "tailSneakIdle") RegisterForAnimationEvent(akTarget, "tailSneakLocomotion") RegisterForAnimationEvent(akTarget, "tailMTIdle") RegisterForAnimationEvent(akTarget, "tailMTLocomotion") RegisterForAnimationEvent(akTarget, "tailCombatIdle") RegisterForAnimationEvent(akTarget, "tailCombatLocomotion") EndEvent Event OnAnimationEvent(ObjectReference akSource, String asEventName) SwitchSpells(Target) EndEvent Function SwitchSpells(Actor akTarget) Spell RightSpell = akTarget.GetEquippedSpell(1) Spell LeftSpell = akTarget.GetEquippedSpell(0) If akTarget.IsSneaking() If RightSpell == NonSneakSpell akTarget.EquipSpell(SneakSpell, 1) ;equip spell in right hand Endif If LeftSpell == NonSneakSpell akTarget.EquipSpell(SneakSpell, 0) ;equip spell in left hand Endif Else If RightSpell == SneakSpell akTarget.EquipSpell(NonSneakSpell, 1) ;equip spell in right hand Endif If LeftSpell == SneakSpell akTarget.EquipSpell(NonSneakSpell, 0) ;equip spell in left hand Endif Endif If RightSpell != SneakSpell && LeftSpell != SneakSpell && RightSpell != NonSneakSpell && LeftSpell != NonSneakSpell akTarget.RemoveSpell(ThisAbility) Endif EndFunctionHere's a list of animation events you can use: https://www.creationkit.com/index.php?title=Animation_Events Also using the Equip Ability in the magic effect seems to work, so no need to use the reference alias script to add the ability. Edit: That debug line requires skse, you can comment it out if you need to. Oh and name the script something more unique. Edited December 30, 2020 by dylbill Link to comment Share on other sites More sharing options...
baldy3456 Posted December 31, 2020 Author Share Posted December 31, 2020 Thank you! I will try to implement this on my end. It makes a lot of sense to use animation evens. Those look like they are called first and the event happens as the animation happens so that would be great! So as I continue to work on this I will be trying to implement a few other Contextual spell changes. I am curious if any of these conditions would fit with this framework or would they be too complex to implement. I am looking to use Sneaking, Dual casting (Same spell equipped in both hands) Combo (Reading the spell in one hand to change the spell in another hand), Spells can cast at and actor vs Ground vs Dead actor vs friendly / aggressive actor, and Lastly using equipped perks or abilities given through a menu after opening a custom Spell tome. Link to comment Share on other sites More sharing options...
dylbill Posted December 31, 2020 Share Posted December 31, 2020 All of that sounds possible except equipping different spells based on your target. This is because you won't know what your target is until the spell is already cast on them. You can use conditions on the magic effect so only certain effects work on certain targets, but it won't change the spell art as we've seen. Link to comment Share on other sites More sharing options...
baldy3456 Posted December 31, 2020 Author Share Posted December 31, 2020 Okay that still works I think. The target specific spells were always going to use the same casting art / Animation and would only have a unique on hit effect for Actors.So for example I want to try to have sneaking one handed fire casting make a Rune on the ground by default but if the target is a living actor is casts a burn effect at melee range. Is that a reasonable direction? This would be similar to how the Spell Siphon Mod has different on hit effects for Ground vs Living actor vs Dead Actor. I also want to thank you again for all your help and advice! I know I am pretty green but I appreciate your help a lot. Link to comment Share on other sites More sharing options...
Recommended Posts