ANaj Posted May 5, 2021 Share Posted May 5, 2021 so this my Script: Scriptname ABA_ShrineRenaming extends ObjectReference ABA_MASTERQUEST Property ABA_Quest_AkropolisMaster auto ObjectReference Property oItemMarker auto event onItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ObjectReference itmRemoved = DropObject(akBaseItem,aiItemCount);Drops item itmRemoved.MoveTo(oItemMarker);place it in world string oldName=itmRemoved.getDisplayName() ;Menu for Renaming string title=ABA_Quest_AkropolisMaster.strInfo[3]+oldname+ABA_Quest_AkropolisMaster.strInfo[4] UILIB_1 uilib=((ABA_Quest_AkropolisMaster as Form) as UILIB_1) String sResult = uilib.ShowTextInput(title, oldName) if sResult itmRemoved.setDisplayName(sResult); Rename item endif endevent it works fine for now, it runs on a container and when you put an item inside, it lets you rename it.Instead of placing the item in the world i want to have it returned to the player somehow. For renaming i need the objectreference of the item, but somehow akItemReference is empty, thats why i had to place it in the world. i tried to add the wolrditem to players inventory but ObjectReference.AddItem(Form akItemToAdd, int aiCount = 1, bool abSilent = false) needs a Form and not the ObjectReference. Is there another way, that the player picks it up instantly?Another thing i would like to have is, when you have opened the inventory menu and put an item inside, that it closes the menu automaticly. Couldn't think of way yet, though. Link to comment Share on other sites More sharing options...
dylbill Posted May 5, 2021 Share Posted May 5, 2021 You can use AddItem to add an object reference to a container. Just use Game.GetPlayer().AddItem(itmRemoved) Another way is to use Activate. itmRemoved.Activate(Game.GetPlayer()) ;player activates itmRemoved, picking it up. You do need the world object reference to change its name. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 5, 2021 Share Posted May 5, 2021 ObjectReferences are a subset of Form. Thus you can pass any ObjectReference into any Form parameter. Did you try it? Did it not work? I know it is possible to force close the inventory menu by disabling and then re-enabling the player controls. But in my experience it does not seem to work with the container menu. Link to comment Share on other sites More sharing options...
ANaj Posted May 5, 2021 Author Share Posted May 5, 2021 You can use AddItem to add an object reference to a container. Just use Game.GetPlayer().AddItem(itmRemoved) Another way is to use Activate. itmRemoved.Activate(Game.GetPlayer()) ;player activates itmRemoved, picking it up. You do need the world object reference to change its name.great, thanks. itmRemoved.Activate(akSourceContainer); in this case akSourceContainer is the same like Game.getPlayer()works, but the renamed item doesn't show up in inventory until i close the menu and reopen it. akSourceContainer.AddItem(itmRemoved,aiItemCount);does the trick. As soon as i put an item inside and rename it, i got it back in my inventory while the inventory menu is still open. So in my case it is not necessary to close the inventory menu through Script, but i am still curious if there is a way to do it? Link to comment Share on other sites More sharing options...
dylbill Posted May 5, 2021 Share Posted May 5, 2021 As IsharaMeradin said, disabling controls and then re-enabling them after doesn't work for container menus. It does work for just normal inventory menu: Game.DisablePlayerControls()Game.EnablePlayerControls() For container menu, I think you need to use SKSE. Input.TapKey(1) ;tap the esc key, closing the menu. Link to comment Share on other sites More sharing options...
ANaj Posted May 5, 2021 Author Share Posted May 5, 2021 (edited) ObjectReferences are a subset of Form. Thus you can pass any ObjectReference into any Form parameter. Yeah, makes sense. Input.TapKey(1) Works to close the container menu. (I am using SKSE) Thanks for the quick responses. Edited May 5, 2021 by ANaj Link to comment Share on other sites More sharing options...
dylbill Posted May 5, 2021 Share Posted May 5, 2021 No problem. Happy modding :) Link to comment Share on other sites More sharing options...
Recommended Posts