Koalmex Posted December 30, 2017 Share Posted December 30, 2017 I have a script on an item, someone knows some script to unequip that item, something like UnEquip (ThisItem)Thanks you Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 30, 2017 Share Posted December 30, 2017 The function you are looking for is called UnequipItem. Link to comment Share on other sites More sharing options...
Koalmex Posted December 30, 2017 Author Share Posted December 30, 2017 (edited) The function you are looking for is called UnequipItem. Thanks youBut what is the variable that I should use to indicate the current item? Edited December 30, 2017 by Koalmex Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 30, 2017 Share Posted December 30, 2017 Depends upon what it is you are trying to do and where the script is actually located. There are two things that you need: 1. the actor wearing the object 2. the object itself Examples:If only the player can ever wear the object and the object is the one holding the script... Game.GetPlayer().UnequipItem(Self)If only the player can ever wear the object and a player alias on a quest is the one holding the script... Self.GetReference().UnequipItem(MyItem) ;where MyItem is a property variable that you have assigned the desired object If only the player can ever wear the object and the script is held on any other form/record... Game.GetPlayer().UnequipItem(MyItem) ;where MyItem is a property variable that you have assigned the desired object I am not going to say it is impossible but it is much more difficult to obtain some random actor that might be wearing the item just so you can unequip it. Thus it depends on what it is you are wanting to do as well as where the script is located as to how you get the necessary information. Link to comment Share on other sites More sharing options...
Koalmex Posted December 30, 2017 Author Share Posted December 30, 2017 Depends upon what it is you are trying to do and where the script is actually located. There are two things that you need: 1. the actor wearing the object 2. the object itself Examples:If only the player can ever wear the object and the object is the one holding the script... Game.GetPlayer().UnequipItem(Self)If only the player can ever wear the object and a player alias on a quest is the one holding the script... Self.GetReference().UnequipItem(MyItem) ;where MyItem is a property variable that you have assigned the desired object If only the player can ever wear the object and the script is held on any other form/record... Game.GetPlayer().UnequipItem(MyItem) ;where MyItem is a property variable that you have assigned the desired object I am not going to say it is impossible but it is much more difficult to obtain some random actor that might be wearing the item just so you can unequip it. Thus it depends on what it is you are wanting to do as well as where the script is located as to how you get the necessary information. Yes, the item has the script, but it does not work :(When I equip the item to activate the script, nothing happens. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 31, 2017 Share Posted December 31, 2017 Is the item you are working with already in the player's inventory when adding this script? if so, drop it and delete it. Console in a new instance. If that doesn't work, test on a new game or a save that has not seen your mod. Reason being is that some changes will not take affect on objects which have already been saved to the save file. This may be one of them. Link to comment Share on other sites More sharing options...
Koalmex Posted December 31, 2017 Author Share Posted December 31, 2017 Is the item you are working with already in the player's inventory when adding this script? if so, drop it and delete it. Console in a new instance. If that doesn't work, test on a new game or a save that has not seen your mod. Reason being is that some changes will not take affect on objects which have already been saved to the save file. This may be one of them. Nothing :( Link to comment Share on other sites More sharing options...
Evangela Posted December 31, 2017 Share Posted December 31, 2017 I'm going out on a limb here.. but I think there's a conflict with the names. The form(the item), the name of the form, and the script are using the same name. Change these names(the Form can keep the name) and try again. Link to comment Share on other sites More sharing options...
Koalmex Posted December 31, 2017 Author Share Posted December 31, 2017 I'm going out on a limb here.. but I think there's a conflict with the names. The form(the item), the name of the form, and the script are using the same name. Change these names(the Form can keep the name) and try again. I tried and that is not the problem :( Link to comment Share on other sites More sharing options...
Roadhouse699 Posted December 31, 2017 Share Posted December 31, 2017 First, indent the line with the unequipitem function in it. if that doesn't work, Try changing the extends from "ObjectReference" to "Armor" If that doesn't work, try making the armor a property and using this:Game.GetPlayer().Unequipitem(property name) If none of that works and you're feeling like using a script loophole, you could always make the item a property and use this:Game.GetPlayer().Removeitem(property name, 1)Game.GetPlayer().Additem(property name, 1) Link to comment Share on other sites More sharing options...
Recommended Posts