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, I can only turn around if I stop moving . 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...
brunnwag Posted February 14, 2012 Share Posted February 14, 2012 Hey good luck, i cant help you as im no scripter :P, also if you want you could join our team as our mod kinda centres on dragon riding :) and we need a few more scripters. Brunnwag Link to comment Share on other sites More sharing options...
jimhsu Posted February 14, 2012 Share Posted February 14, 2012 Not sure what the problem is, but that syntax you're using with translateto is not going to work: you need to put the angles in as well. http://www.creationkit.com/TranslateTo_-_ObjectReference Link to comment Share on other sites More sharing options...
jimhsu Posted February 14, 2012 Share Posted February 14, 2012 (edited) Do you have the player attached to the mount? Maybe be able to test it out later as I'm familiar with how the Akatosh mount did things. Update: I do see that you've used the code mostly from the Akatosh mount. Given the variety of new functions available, I'd try rewriting it to take advantage of many of the new functions we have (namely, the trig). Edited February 14, 2012 by jimhsu Link to comment Share on other sites More sharing options...
porroone Posted February 14, 2012 Author Share Posted February 14, 2012 Ignore that code, yes is the akatosh one, i used it to see how the angles work in-game and I can only get the z-plane angle so the TranslateTo function will only get that angle, even if I set Player.GetAngleX,y,z on the translate argument it keeps returning 0, my guess is the dragon overrides the player view angle. I also tried the SetAngle function with the player's angle and even if looked up or down the dragon only moved in the z-plane. If you see on the script im also calling another script, one I've set on the player's to return the angles, that doesnt work either, right now im checking the code behind actor, objectreference and game, since I see some functions there that arent displayed on the Papyrus Reference page. Link to comment Share on other sites More sharing options...
porroone Posted February 14, 2012 Author Share Posted February 14, 2012 Funny thing is I think its related to the 3rd person camera, since if I set it to first person (while not riding ofc) and ask the script to do a Notication with that angle, the angles work great I get 0 while in center view, 90 while looking up and -90 while looking down. Link to comment Share on other sites More sharing options...
jimhsu Posted February 14, 2012 Share Posted February 14, 2012 (edited) Funny thing is I think its related to the 3rd person camera, since if I set it to first person (while not riding ofc) and ask the script to do a Notication with that angle, the angles work great I get 0 while in center view, 90 while looking up and -90 while looking down. From console testing, GetAngle in 3rd person only updates if the character is doing *something*. Moving forward does count. Don't know if it's the same with the papyrus imp.GetAngle x does not work on horses, period. Edited February 14, 2012 by jimhsu Link to comment Share on other sites More sharing options...
porroone Posted February 14, 2012 Author Share Posted February 14, 2012 Yep that much I know, ive been messing with the setvehicle function, if I can somehow create an object with the animations and the model of a dragon, use the function to enable player controls on it I might be able to do it, otherwise I need some external function but I have no idea on how to add libs on papyrus, that would make things much simplier so if anybody knows something about I would appreciate the help. Link to comment Share on other sites More sharing options...
Recommended Posts