Moveto Papyrus script problem

Post » Sun Apr 21, 2013 2:11 pm

I'm having trouble with this script - It does everything I want it to, except rotate the boat to face the direction the xmarkerheading is facing. This script is triggered by activating a switch in an interior cell and moves the exterior to a random location (one of 5 right now) but the boat exterior is always facing east.

Scriptname STL_Transit extends ObjectReferenceFormlist Property STL_BoatLocations AutoObjectReference Property STL_Boat AutoObjectReference Property STL_BoatextDoor AutoObjectReference Property STL_Boatdoormarker AutoInt Property RandomLoc  AutoSound Property STLBoatLanding AutoEvent OnActivate(ObjectReference akActionRef)  Int LocationIndex = STL_BoatLocations.GetSize()  Utility.Wait(0.1)  RandomLoc = Utility.RandomInt(0, LocationIndex - 1)  Utility.Wait(0.1)  Debug.MessageBox("Going somewhere")  Utility.Wait(0.1)  GoToState ("BoatMove")EndEventState BoatMoveEvent OnBeginState()  ObjectReference STL_LandLOC = STL_BoatLocations.GetAt(RandomLoc) as ObjectReference  STLBoatLanding.Play(self)  Utility.Wait(0.1)  STL_Boat.Disable()  STL_BoatextDoor.Disable()  Utility.Wait(0.1)  STL_Boat.MoveTo(STL_LandLOC)  STL_BoatextDoor.MoveTo(STL_LandLOC)  Utility.Wait(0.1)  float anglez = STL_Boat.GetAngleZ() + 0.0  ;or +90 for right, -90 for left, 0 for in front  float distance = 50.0  float offsetx = distance * math.sin(anglez)  float offsety = distance * math.cos(anglez)  Utility.Wait(0.1)  STL_BoatDoorMarker.MoveTo(STL_LandLOC, offsetx,  offsety, 0)  Utility.Wait(0.1)  STL_Boat.Enable()  STL_BoatextDoor.Enable()  Utility.Wait(0.1)  ;Debug.MessageBox("Landed")EndEventEndState
User avatar
rebecca moody
 
Posts: 3430
Joined: Mon Mar 05, 2007 3:01 pm

Return to V - Skyrim