FafnirEtherion Posted February 17, 2017 Share Posted February 17, 2017 Hey guys ! I am working on a new Skyrim mod ( want a preview ? ;) ) , but I have no idea how to script whatsoever ! Tutorials weren't as useful as I thought they would be, so I ask here if somehow could help me how to script a very simple script : Basically, I would want to add some spells to the player once he equips a piece of armor, and remove the spells as he removes the armor... I've seen so many mods using this king of script, but I can't seem to replicate it :/ Any help would be greatly appreciated !Thanks for reading, guys ^^ ! Link to comment Share on other sites More sharing options...
Masterofnet Posted February 17, 2017 Share Posted February 17, 2017 (edited) All you have to do is take a look at the scripts on the Silver Swords or the Ring of Namira, The Ebony Mail, Hircine's Ring etc. This should also be useful if you are working with Scripts. http://www.creationkit.com/index.php?title=Category:Script_Objectshttps://www.creationkit.com/index.php?title=While Edited February 17, 2017 by Masterofnet Link to comment Share on other sites More sharing options...
FafnirEtherion Posted February 18, 2017 Author Share Posted February 18, 2017 These items are adding passive effects to the character, not usable, castable spells :/ ! But thanks for the links ! These will be useful Link to comment Share on other sites More sharing options...
FrankFamily Posted February 18, 2017 Share Posted February 18, 2017 Look a bit further, you can literaly change "perk" for "spell" in the silver sword script and thats it. That said, i personally prefer to put that in a magic effect instead of in the item itself because onequip/onunequip sometimes fail to trigger. Straight copy from my paladin mod, this attached to a magic effect on the item's enchantment. scriptName FFPAASpellAdder extends ActiveMagicEffect spell property SpellToAdd auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.AddSpell(SpellToAdd, true) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.RemoveSpell(SpellToAdd) EndEvent Link to comment Share on other sites More sharing options...
Masterofnet Posted February 18, 2017 Share Posted February 18, 2017 (edited) I have used onequip and onuneqpup extensively and have never had it fail. The silver swords had some issues but those were caused by the script itself not the event. Can anyone confirm onequip/onunequip failing to trigger? Edited February 19, 2017 by Masterofnet Link to comment Share on other sites More sharing options...
FrankFamily Posted February 19, 2017 Share Posted February 19, 2017 From having used it for sensitive stuff that depend on a perfect execution of both events i can say that they sometimes fail to trigger, causing issues (missmatch between having the spell/perk it adds and the object being actually equipped or not). With a perk you can always just add a condition to it so that its only active while said item is equipped, as a second check but for other stuff it can get messy. If you are adding an enchantment tying it to oneffectstart/finish is much safer. But, its a recommendation, feel free to believe or not. Link to comment Share on other sites More sharing options...
Undivide Posted February 19, 2017 Share Posted February 19, 2017 I've had on(un)equip fail to trigger for me a few times in the past as well. Link to comment Share on other sites More sharing options...
Masterofnet Posted February 19, 2017 Share Posted February 19, 2017 Interesting, I used to use a script that kept track of ever piece of armor a player equipped and unequipped. The purpose of it was to prevent the player from un-equipping armor during combat. It never failed once. Thanks for the information. Link to comment Share on other sites More sharing options...
lofgren Posted February 19, 2017 Share Posted February 19, 2017 OnEquip will fail if you have multiple copies of the same form in your inventory. It will only fire for the first one you acquired. Link to comment Share on other sites More sharing options...
Masterofnet Posted February 19, 2017 Share Posted February 19, 2017 So if you are considering using OnEquip on an item that is not unique you could possibly run into problems. That explains why it has never failed on me. Also, I need to clarify my early statement regarding the armor. I was not using onequip and on unequip. I was using OnObjectEquipped(Form akBaseObject, ObjectReference akReference)OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)and I can tell you it does not miss. What if you have the event on a quest alias? Would that be a possible issue if it was not a unique item? Link to comment Share on other sites More sharing options...
Recommended Posts