DovahbearIsNuts Posted April 2, 2016 Share Posted April 2, 2016 Hi, does somebody know how I can write a script which equips/unequips an armour piece on my character, upon casting a spell? And also prevents the user from unequiping, or dropping the armour piece for the duration of the spell? Many thanks. Link to comment Share on other sites More sharing options...
NexusComa Posted April 3, 2016 Share Posted April 3, 2016 So you want a Holy Grail script that can pull off a Holy Grail using a Holy Grail and also a Holy Grail prevent or a Holy Grail for the duration of the Holy Grail ... Link to comment Share on other sites More sharing options...
DovahbearIsNuts Posted April 3, 2016 Author Share Posted April 3, 2016 Umm... Translation? :ermm: :ermm: :ermm: A simple yes or no answer would have been nice. :confused: :confused: :confused: Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 3, 2016 Share Posted April 3, 2016 You can't prevent the user from unequipping an item, as far as I know. The best you can do is have the script re-equip the item if the spell's effect is still going on. However, there is a known issue with equipping gear via script. Any enchantments, at least those added by the player, will not take effect. This is because the equip command uses the base object as opposed to the exact specific reference. Link to comment Share on other sites More sharing options...
DovahbearIsNuts Posted April 4, 2016 Author Share Posted April 4, 2016 (edited) Could I just simply attach a script to each individual piece of summoned armour which labels each armour piece as a quest item? Also can I for example summon a set of Bound Daedric Armour (unenchanted), and prevent each individual piece from being enchanted by using the "MagicDisallowEnchanting" keyword in the creation kit?Oblivion had a similar effect/mechanic. Edited April 4, 2016 by DovahbearIsNuts Link to comment Share on other sites More sharing options...
JetSteele Posted April 4, 2016 Share Posted April 4, 2016 EquipItem Type your function like this:Game.GetPlayer().EquipItem(ItemName, true) This will prevent you from taking the item off. Then you just need to run an UnequipItem function on the player on the effectfinish and that will allow you to have that type of effect. I'd put the effect as a script archetype instead of a bound weapon one since I'm not sure how it would run so stick to script archetype and use the oneffectstart and oneffectfinish events to add or remove the armour. Oh and make sure to run an AddItem and RemoveItem functions to add and remove the item from the player before you equip it to remove any possibility of bugs. Link to comment Share on other sites More sharing options...
DovahbearIsNuts Posted April 4, 2016 Author Share Posted April 4, 2016 (edited) @ JetSteele, thanks for the advice! But there's one problem... I've "never" written a script of my own from scratch, and trying to understand it all from a novice perspective is a little overwhelming! Update: I've found the script showed below on the nexus, how would I go about altering it to make it work with my own bound armour?Scriptname BoundArmorScript extends ActiveMagicEffect Armor Property boundArmorPieceHeavy Auto Armor Property boundArmorPieceLight Auto SPELL Property spellBoundShield Auto EffectShader Property boundEffect Auto EffectShader Property boundEffect2 Auto Armor Property boundArmorPiece Auto Event OnEffectStart(Actor ckTarget, Actor ckCaster) if (Game.GetPlayer().GetActorValue("LightArmor") > Game.GetPlayer().GetActorValue("HeavyArmor")) boundArmorPiece = boundArmorPieceLight else boundArmorPiece = boundArmorPieceHeavy endif Utility.Wait(0.2) Game.GetPlayer().EquipItem(boundArmorPiece, false, true) boundEffect.Play(ckCaster) boundEffect2.Play(ckCaster) EndEvent Event OnEffectFinish(Actor ckTarget, Actor ckCaster) if (Game.GetPlayer().GetEquippedShield() == boundArmorPiece) Game.GetPlayer().EquipSpell(spellBoundShield, 0) else Game.GetPlayer().RemoveItem(boundArmorPiece, 1, true) endif EndEvent Edited April 4, 2016 by DovahbearIsNuts Link to comment Share on other sites More sharing options...
JetSteele Posted April 4, 2016 Share Posted April 4, 2016 Armor Property BoundArmorTorso Auto Armor Property BoundArmorBoots Auto Armor Property BoundArmorHands Auto Armor Property BoundArmorHead Auto Event OnEffectStart(Actor akTarget, Actor akCaster) akCaster.AddItem(BoundArmorTorso, 1, true) akCaster.AddItem(BoundArmorBoots, 1, true) akCaster.AddItem(BoundArmorHands, 1, true) akCaster.AddItem(BoundArmorHead, 1, true) akCaster.EquipItem(BoundArmorTorso, true, true) akCaster.EquipItem(BoundArmorBoots, true, true) akCaster.EquipItem(BoundArmorHands, true, true) akCaster.EquipItem(BoundArmorHead, true, true) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akCaster.UnequipItem(BoundArmorTorso, false, true) akCaster.UnequipItem(BoundArmorBoots, false, true) akCaster.UnequipItem(BoundArmorHands, false, true) akCaster.UnequipItem(BoundArmorHead, false, true) akCaster.RemoveItem(BoundArmorTorso, 1, true) akCaster.RemoveItem(BoundArmorBoots, 1, true) akCaster.RemoveItem(BoundArmorHands, 1, true) akCaster.RemoveItem(BoundArmorHead, 1, true) EndEventI wrote this as if the spell gave you a full set of armor, you can remove pieces if you don't need them in the spell. This one is really basic and just adds or removes the armor pieces if you want effects added to the player as visuals for when the armor is equipped we can work that into the script later. Link to comment Share on other sites More sharing options...
DovahbearIsNuts Posted April 5, 2016 Author Share Posted April 5, 2016 @JetSteele, many thanks. I've implemented the script, tested it, and it works fine. Now there's still the small problem of preventing the spell caster from unequiping/dropping the armour while the spell is still in effect. How would I go about doing this? Would it require a separate script for the armour? Link to comment Share on other sites More sharing options...
JetSteele Posted April 6, 2016 Share Posted April 6, 2016 Try making the armor non-playable. That will remove the armor from the inventory selection screen however since you are equipping it with a script it should still equip on the player when cast. I've tried this with a ring and it worked with me I assuming it should work with armor as well. After this let me know if the armor can be switched by trying to put something else on and I'll see about what else can be done. I've got some ideas on fixing that if this doesn't work. Link to comment Share on other sites More sharing options...
Recommended Posts