porroone Posted February 14, 2012 Share Posted February 14, 2012 So im currently working on a dragon ride that flies, I got some kind of flying working but it just works on the z-plane and increasing the y-plane, so basically it flies, problem comes that while riding I've been only able to get 2 conditional, IsRunning that apparently only works in player and IsSprinting which works with the dragon (GOD KNOWS WHY), so basically the only movement I can get is flying both forward and up at the same time which gets kind of annoying. My question is how to get the players view angle while he's riding so I can use those angles to tilt the dragon up or down, maybe even roll lol. Here's is my code, its full of debug s***, and stuff that doesnt work very well right now since im doing tests on variables, but maybe somebody can point me in the right direction. Thanks. Scriptname _DragonScript extends Actor import Utility import form import debug import math import idle Actor Property Dragon auto Actor Property Player auto idle property MTIdle_Hover auto float ay float xp float yp float zp float height float direction float speed float toggle float dtime _RAngle property MasterScript auto _RAngle scriptVar auto State Idle Event OnActivate(ObjectReference Dragon) RegisterForUpdate(0.1) GoToState("FlightMode") dtime = 0 Enable() PlayAnimation(MTIdle_Hover) endEvent endState State FlightMode Event OnUpdate() scriptVar = masterScript toggle = 0 if Dragon.IsSprinting() speed = 50 zp = Dragon.GetPositionX() height = Dragon.GetAngleY()*Speed zp = zp - height xp = Dragon.GetPositionX() yp = Dragon.GetPositionY() direction = Dragon.GetAngleZ() if direction < 90 && toggle == 0 toggle = 1 yp = yp + (90 - direction)*speed xp = xp + (direction)*speed endif if direction < 180 && toggle == 0 toggle = 1 direction = direction - 90 yp = yp + (-direction)*speed xp = xp + (90 - direction)*speed endif if direction < 270 && toggle == 0 toggle = 1 direction = direction - 180 yp = yp + (direction - 90)*speed xp = xp + (-direction)*speed endif if toggle == 0 toggle = 1 direction = direction - 270 yp = yp + (direction)*speed xp = xp + (direction - 90)*speed endif if dtime < 20 dtime += 1 else dtime = 0 Debug.Notification(xp) endif TranslateTo(xp,yp,zp,xp,yp,zp,speed,0) else StopTranslation() endIf endEvent endState Link to comment Share on other sites More sharing options...
Recommended Posts