gob2 Posted July 15, 2017 Share Posted July 15, 2017 I would like to make a specific item that when picked up the player gets teleported to a particular place in a different cell and the item is removed. Looking for advice on how to do that. Thank you. Link to comment Share on other sites More sharing options...
stonefisher Posted July 16, 2017 Share Posted July 16, 2017 Try attaching this script to your object. Not sure itll work mind you. Scriptname item_teleport_script extends ObjectReference itemtype property cursedobject auto const Marker property BobsHouseMarker auto const Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().MoveTo(BobsHouseMarker) Game.GetPlayer().RemoveItem(cursedobject) endif EndEvent Link to comment Share on other sites More sharing options...
JonathanOstrus Posted July 16, 2017 Share Posted July 16, 2017 (edited) Try attaching this script to your object. Not sure itll work mind you.Scriptname item_teleport_script extends ObjectReference itemtype property cursedobject auto const Marker property BobsHouseMarker auto const Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().MoveTo(BobsHouseMarker) Game.GetPlayer().RemoveItem(cursedobject) endif EndEvent I think the more widely accepted method would be to remove self then teleport. Scriptname item_teleport_script extends ObjectReference Marker property BobsHouseMarker auto const Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() ; since we already validated the activating ref is the player we can reuse it instead of wasting cycles re-calling Game.GetPlayer() again. akActionRef.RemoveItem(self) akActionRef.MoveTo(BobsHouseMarker) endif EndEvent Edited July 16, 2017 by BigAndFlabby Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 16, 2017 Share Posted July 16, 2017 I don't think onActivate is the best method to use for detecting when specific item is added to player, as it may is added from container or is just given to player. I recommend to use onContainerChanged. Like this (attach to your object): ObjectReference Property mymarker auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If akNewContainer == Game.getplayer() Game.getplayer().removeitem(self,1,true) Game.getplayer().Moveto(mymarker) EndifEndevent Don't forget to fill mymarker property with the needed reference (it may be marker or any other reference) Link to comment Share on other sites More sharing options...
JonathanOstrus Posted July 16, 2017 Share Posted July 16, 2017 I don't think onActivate is the best method to use for detecting when specific item is added to player, as it may is added from container or is just given to player. I recommend to use onContainerChanged. Like this (attach to your object): ObjectReference Property mymarker auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)If akNewContainer == Game.getplayer()Game.getplayer().removeitem(self,1,true)Game.getplayer().Moveto(mymarker)EndifEndevent Don't forget to fill mymarker property with the needed reference (it may be marker or any other reference) Well OP did say "picked up". Though you're right. The onContainerChanged will ensure that it enters the player inventory. Link to comment Share on other sites More sharing options...
gob2 Posted July 16, 2017 Author Share Posted July 16, 2017 Thank you. I will try these out. Link to comment Share on other sites More sharing options...
Recommended Posts