Jump to content

Returning to Orginal Location <Papyrus Question>


labyrinth999

Recommended Posts

I am trying to create a script that when the player equips an item they are transported to a set destination and on the removal of the item they are transported back to the the original destination. My current script allows for the transportation to a set destination when the item is worn or removed. However I want to be able to store the location of the player at the moment the item is equipped and to return to that location when its removed. Below is my current script

Scriptname TeleRing extends ObjectReference  

ObjectReference property EquipTeleport auto
ObjectReference property UnEquipTeleport auto
Event OnEquipped(Actor akActor)
ObjectReference Player = Game.GetPlayer()
Player.MoveTo(EquipTeleport)
endEvent

Event OnUnequipped (Actor akActor)
ObjectReference Player = Game.GetPlayer()
Player.MoveTo(UnEquipTeleport)
endEvent

 

I tried to use GetCurrentLocation, however I am not sure how to use the function at least I haven't been able to get a script to compile. Any suggestions and advice would be helpful.

Link to comment
Share on other sites

GetCurrentLocation() returns a location, which is sort of like a property for cells. For example, all of the shops in Solitude would correspond to SolitudeLocation. It can be useful in tracking crimes, for example. But it isn't useful for determining the player's actual physical location in the world.

 

Instead, you might want to take a look at FindClosestReferenceOfTypeFromRef or FindClosestReferenceOfAnyTypeInListFromRef. You can have the game find the closest Xmarker or Xmarkerheading to the player, for example. Or any number of things you can think of.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...