tehkangthai Posted August 19, 2019 Share Posted August 19, 2019 Scriptname VagabondCloakPerkEquipUnequip extends activemagiceffect perk property PerkToAdd1 auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.AddPerk(PerkToAdd1, true) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.RemovePerk(PerkToAdd1) EndEvent I cant seem to figure out what is wrong with this script, I'm a total beginner with papyrus script, so please advice me! I'm trying to make a scripted magic effect, whereby a perk will be added to the player that equips an item with this effect, and then when the said item is removed, the perk will be removed since the magic effect will be removed as well. Link to comment Share on other sites More sharing options...
maxarturo Posted August 19, 2019 Share Posted August 19, 2019 (edited) " whereby a perk will be added to the player that equips an item with this effect, and then when the said item is removed " 1) The " Magic Effect " or " Spell " is for and attached to the item ( weapon or armor, i guess ). Here you are done, no need for script. 2) To add and remove the " Perk " you will need to add a script to that weapon - armor that has the MagicEffect and will fire the " Add Perk " when equip, example : EXTENDS ObjectReference perk property PerkToAdd1 auto Event OnEquipped(Actor akActor) if akActor == Game.GetPlayer() Game.GetPlayer().AddPerk(PerkToAdd1) endIf endEvent Event OnUnequipped(Actor akActor) if akActor == Game.GetPlayer() Game.GetPlayer().RemovePerk(PerkToAdd1) endIf endEvent They are independent of each other, but you need both for it to work as you might want. EDIT : Typo... Edited August 19, 2019 by maxarturo Link to comment Share on other sites More sharing options...
RichWebster Posted August 20, 2019 Share Posted August 20, 2019 If it were me I would avoid using a script for just one perk, and just select your perk from the Perk To Apply drop-down list in the magic effect. Link to comment Share on other sites More sharing options...
tehkangthai Posted August 20, 2019 Author Share Posted August 20, 2019 (edited) If it were me I would avoid using a script for just one perk, and just select your perk from the Perk To Apply drop-down list in the magic effect. That was how I did it initially, but then after playing around abit, I realise that my perk is not removed when the said item is unequiped, but on further investigation, I realised it is not the perk equip/removal, it was how the magic effect was setup. So basically what i was trying to do was to make an item with an enchanment on it that would give the nightingale shadowclaok kinda effect, except, it is not 120secs per day, instead, it is an ability that is constant on the player as long as the player has the item with said enchanment equiped, the player is able to activate invisibility when sneak, and deactivate invisibility when not sneaking. Upon further playtesting, I found that my effect lingers around even with the item unequipped. I can become invisible as long as I sneak and as long as I dont break the invisibility by activating something. If I do however, I will no longer to be able to go invisible when I sneak. I will need to re-equip the said item to get the effect. It is not a big issue, but a rather incomplete creation compare to my ideal version. Which only if you equip, you get to be invisible when sneaking, and if you unequip you will not be able to. Edited August 20, 2019 by tehkangthai Link to comment Share on other sites More sharing options...
Recommended Posts