blessposter Posted May 28, 2016 Share Posted May 28, 2016 hihi, currently i am evaluating some stuff for my mod idea and need some information which i didn't get through the script reference. 1.) is it possible to get the exact current position of the player and store it like { x, y, z } 2.) additionally to the position i need the rotation of the player (north or south) in a float or anything like that. I am not really trained in papyrus scripting, so i would be very thankfully for any help. tyty Link to comment Share on other sites More sharing options...
Surilindur Posted May 28, 2016 Share Posted May 28, 2016 (edited) You can get player from Game.GetPlayer() as an actor. Actor script extends ObjectReference, so you should be able to use all the methods of ObjectReference with an Actor. There seem to be structs as a new thing in Papyrus now, too, with Fallout 4, I have not looked at them too closely myself yet, but maybe you could use one to store all your info? See this page: http://www.creationkit.com/fallout4/index.php?title=ObjectReference_ScriptAnd maybe this: http://www.creationkit.com/fallout4/index.php?title=Actor_ScriptAnd this for structs: http://www.creationkit.com/fallout4/index.php?title=Struct_Reference For example like this: Struct PlayerPos float fPosX = 0.0 float fPosY = 0.0 float fPosZ = 0.0 float fAngX = 0.0 float fAngY = 0.0 float fAngZ = 0.0 EndStruct PlayerPos Function GetPlayerInfo() Actor rPlayer = Game.GetPlayer() PlayerPos rTemp = new PlayerPos rTemp.fPosX = rPlayer.X rTemp.fPosY = rPlayer.Y rTemp.fPosZ = rPlayer.Z rTemp.fAngX = rPlayer.GetAngleX() rTemp.fAngY = rPlayer.GetAngleY() rTemp.fAngZ = rPlayer.GetAngleZ() Return rTemp EndFunctionLike I said, I have not done anything real with those Papyrus structs yet. They seem to be a bit limited, though, I tried to initialise the values inside the struct to the relevant info directly using those commands now placed in that separate function, but it refused to compile. You can do more testing to see if there is a more reasonable way to do things. But that might be one idea. If that helps. Another option would be to use an array. Hopefully that helps a little. Happy scripting. :thumbsup: Edited May 28, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
FrankFamily Posted May 28, 2016 Share Posted May 28, 2016 (edited) To add to that and asumming what i know about papyrus scripting applies to fallout 4, some corrections need to be made to the Z angle to get accurate north-south-etc direction while in interiors, not sure if its needed for what you want to do but just in case.. straight copy of a fragment of the script of a compass for skyrim i started developing a while ago but never finished: Float MyAngle = PlayerRef.GetAngleZ() ; north=0, east=90, south=180, west=270 If PlayerRef.IsInInterior() ObjectReference NorthMarkerRef = Game.FindClosestReferenceOfTypeFromRef(NorthMarker, PlayerRef, 10000.0); find a north marker (i guess they exist in fallout 4 just like in skyrim) If NorthMarkerRef MyAngle -= (NorthMarkerRef.GetAngleZ()) NorthMarkerRef = None If MyAngle < 0 MyAngle += 360 Endif Endif Endif Edited May 28, 2016 by FrankFamily Link to comment Share on other sites More sharing options...
blessposter Posted May 28, 2016 Author Share Posted May 28, 2016 omg thank you^^ so much information in this short time! i will take a look thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts