FrankFamily Posted July 22, 2015 Share Posted July 22, 2015 (edited) So, in my recent artifacts of boethiah mod i used silverperk script to add a perk to the player when equipping a weapon (and in theory remove said perk when unequipping it). And an user reported having the perk (and it's effects) after unequipping the weapon. I've "solved" the issue adding conditions to the perk's entry points and effects of abilities added by the perk so that even if you have the perk forever it's effects are only active while having the appropiate perk equipped. But i still wonder why it doesn't remove the perk. The script is the following: I've also noticed Wuuthrad has another spell which is exactly the same, they could have used this one. Scriptname SilverSwordScript extends ObjectReference Perk Property SilverPerk auto Event OnEquipped(Actor akActor) akActor.AddPerk(SilverPerk) EndEvent Event OnUnEquipped(Actor akActor) akActor.RemovePerk(SilverPerk) EndEventBoth Wuuthrad perk and silverperk have conditions to limit their functionality to when you have the appropiate weapon equipping, so it seems bethesda knew it wasn't removing the perk, since if it did those conditions woulndn't be needed. Using the console in-game to remove the perk appears to work properly, so something is wrong with the script. creationkit.com states that addperk and remove perk do nothing for NPCs but it appears removeperk doesn't even work for the player... So, anyone knows why it's not working properly or a posible workaround for it? EDIT: In dragonborn soulrender and the other scimitar use a different script that appears to work (unlike silverperk and Wuuthrad's) since their perks don't have any condition at all, the only difference is using game.getplayer() instead of akactor even if akactor is the player.I'm going to do some testing to confirm this. Scriptname DLC2defaultAddPerkOnEquipScript extends ObjectReference {Generic script for adding a Perk to the player when an item is equipped.} Perk property PerkToAdd Auto Event OnEquipped(Actor akActor) if (akActor == Game.GetPlayer()) Game.GetPlayer().AddPerk(PerkToAdd) EndIf EndEvent Event OnUnequipped(Actor akActor) if (akActor == Game.GetPlayer()) Game.GetPlayer().RemovePerk(PerkToAdd) EndIf EndEvent Edited July 22, 2015 by FrankFamily Link to comment Share on other sites More sharing options...
icecreamassassin Posted August 13, 2015 Share Posted August 13, 2015 OnEquip and OnUnequip do not appear to function 100% of the time when the item is not manually equipped or unequipped by the player (i.e. a script adds or removes it). I have the same issue that any script added ability given by weapons or armor are retained by the player if they place the item on display in the museum. I fixed the problem by adding a OnContainerChanged() event to said items which seems to be working Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if akOldContainer == Game.GetPlayer() Game.GetPlayer().RemovePerk(PerkToAdd) endif EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts