Talk:SetAngle - ObjectReference: Difference between revisions

Jump to navigation Jump to search
m
Make north marker face north.
imported>Obstipator
imported>Rasikko
m (Make north marker face north.)
Line 27: Line 27:


--[[User:Obstipator|Obstipator]] ([[User talk:Obstipator|talk]]) 2014-11-09T13:56:27 (EST)
--[[User:Obstipator|Obstipator]] ([[User talk:Obstipator|talk]]) 2014-11-09T13:56:27 (EST)
== Force an interior compass to point north. ==
This was a little experiment I tried out. Just turn the north marker so that it faces north. Since the compass is based on the north marker.. if you enter a cell with a north marker pointing east, the compass will think you are entering from the east.
<source lang="papyrus">
Function SetNorthMarkerToPointNorth() Global
; Sets the North Marker in a cell to point north.
Actor Player                = Game.GetPlayer()
Form kMarker                = Game.GetFormFromFile(0x00000003, "Skyrim.ESM") ; NorthMarkers
ObjectReference kNorthMarker = Game.FindClosestReferenceOfTypeFromRef(kMarker, Player, 120000.0)
Float fAngleZ
if Player.IsInInterior()
if kNorthMarker
; check if it's facing north
if kNorthMarker.GetAngleZ() > 0.0
; Turn the thing north.
kNorthMarker.SetAngle(0.0, 0.0, 0.0)
endif
else
return none
endif
else
return none
endif
EndFunction
</source>
Only thing is, the compass wont reset until you exit and re-enter the cell. If one were to seriously use this though, they'll need to store the marker and the marker's original z rotation prior to the change so that you can revert the changes for whatever reason. I'm thinking if it were possible to cell [GetParentCell - ObjectReference] on objects in exterior cells, it would be possible to match the inside compass to that of the inside one. --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-01-06T13:40:48 (EST)
Anonymous user

Navigation menu