Klehron Posted November 5, 2021 Share Posted November 5, 2021 Hello,I'm trying to create a mod for myself and have some issue. Hopefull someone can help me:I already found a simular issue here but the solution doesn't work for me. I have an item in the inventory (it is a portalstone), it can be activated (equiped) directly in the inventory. Than an activator (also a portalstone) will be placed in front of the player. This currently works fine. At the end the object from the inventory should be removed. but this doesn't happen. Later I want to add a second portalstone to teleport the player between both placed stones. Here is the script for placemet: ScriptName PortalStoneItemScript extends ObjectReference Int Property StoneId auto PortalStoneQuestScript property PortalQuest auto ObjectReference property PortalstoneRef auto Sound Property PlacementSound auto Message Property ConfirmPlacementMsg auto ObjectReference currentContainer = None function OnInit() self.Disable(false) utility.wait(0.500000) self.Enable(false) self.BlockActivation(true) endFunction Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If (akNewContainer != none) currentContainer = akNewContainer Endif EndEvent Function OnEquipped(actor akActor) If akActor == game.GetPlayer() Game.DisablePlayerControls(False, False, False, False, False, True) int button = ConfirmPlacementMsg.Show() If button == 0 PortalstoneRef.MoveTo(akActor, 0.000000, 0.000000, 0.000000, true) PortalstoneRef.Enable(true) PortalstoneRef.BlockActivation(true) PortalstoneRef.SetActorOwner(akActor.GetActorBase()) float angelZ = PortalstoneRef.GetAngleZ() float angelDiff = PortalstoneRef.GetHeadingAngle(game.GetPlayer() as ObjectReference) PortalstoneRef.SetAngle(0, 0, angelZ + angelDiff) PlacementSound.Play(akActor as ObjectReference) If StoneId == 1 PortalQuest.StoneAPlaced = true ElseIf StoneId == 2 PortalQuest.StoneBPlaced = true EndIf self.Disable(false) self.Delete() if (currentContainer != none) debug.notification("currentContainer: " + currentContainer.GetName()) ; we are in some container currentContainer.RemoveItem(Self.GetBaseObject(), currentContainer.GetItemCount(Self.GetBaseObject()), true) else debug.notification("currentContainer: none") Game.GetPlayer().RemoveItem(Self.GetBaseObject(), Game.GetPlayer().GetItemCount(Self.GetBaseObject()), true) ; ^ just in case. Self.Disable() endif utility.wait(0.500000) Game.EnablePlayerControls(False, False, False, False, False, True) EndIf EndIf EndFunction What do I wrong or it is not possible to remove an item from the inventory by itself? Maybe something is missing and someone can help me. Link to comment Share on other sites More sharing options...
Sphered Posted November 6, 2021 Share Posted November 6, 2021 Item type matters. Keys for example cannot be dropped or removed from inventory until used on the door. Other item types like MiscObject, when dropped, will behave differently vs other types In the end it depends on your main goal, and the degree that you care how that goal gets accomplished. For porting, I personally would prefer a spell or hotkey approach aka not use inventory at all. Kinda depends what theme you are going for and how you want it to work Link to comment Share on other sites More sharing options...
Recommended Posts