PCDug Posted September 22, 2016 Share Posted September 22, 2016 (edited) TLDR;When using the move to function the object is moved to the right marker but with the wrong rotation (the rotation remains the same as the one in the starting point) Hi,I'm having a bit of trouble with the MoveTo function not doing what it's supposed to do in my script. Game.FadeOutGame(false, true, 4.0, 3.0)CurrentPos.Disable()MBFuelCOuntGlobal.SetValue(MBCurrentFuel-MBRequiredFuel)MBCoolantCOuntGlobal.SetValue(MBCurrentCoolant-MBRequiredCoolant)GameHour.SetValue(MBHour+((Distance/7140000)*30))MBDriveSound.Play(Game.GetPlayer())DestPos.Enable()MBDoor.MoveTo(mDestPos, abMatchRotation = true)MBDoorMarker.MoveTo(mDestPos,70.0 * Math.Sin(mDestPos.GetAngleZ()), 70.0 * Math.Cos(mDestPos.GetAngleZ()), - 80.0,abMatchRotation = true)CurrentPos=DestPos The last section of this script is supposed to move a door and an xmarker around the world (the destination is always an xmarkerHeading).The moveTo function works ok for the MBDoorMarker property (the xmarker is moved to the destination with a slight translation and faces the right way.The MBDoor property however gets moved to the right spot but retains it's original rotation (it does not allign with the xmarkerheading rotation). Why is the rotation change working for the moved xmarker but not for the moved door? Edited September 22, 2016 by PCDug Link to comment Share on other sites More sharing options...
EveningTide Posted September 22, 2016 Share Posted September 22, 2016 Firstly MoveTo is latent, and nothing else is going to happen until the move is finished. There is possibly a queue issue going on there between the two moves.You can try adding "Utility.wait(0.2)" after the first move. Link to comment Share on other sites More sharing options...
PCDug Posted September 22, 2016 Author Share Posted September 22, 2016 Firstly MoveTo is latent, and nothing else is going to happen until the move is finished. There is possibly a queue issue going on there between the two moves. You can try adding "Utility.wait(0.2)" after the first move.Thank I'll try that.What boggles me is that move object should match the markerheading rotation by default,I mean,that worked in my other mod. ElseIf aiButton == 1DriveSound.Play(Game.GetPlayer())Game.FastTravel(mabf)Car.MoveTo(abf)VanFuelUnit.RemoveItem(FuelUnit, 1, True) Doing this moved a static car to the xmarkerheading (near abernathy farm in this case).It did the same for other 32 location and the car would always be in the correct orientation. Link to comment Share on other sites More sharing options...
PCDug Posted September 22, 2016 Author Share Posted September 22, 2016 Update:Scratch that,the xmarkers land on the marker heading with the wrong rotation too.I really don't get why it used to work and now it doesn't. Link to comment Share on other sites More sharing options...
EveningTide Posted September 22, 2016 Share Posted September 22, 2016 I am thinking the "pointer" of the XmarkerHeading isn't used as a point of reference for rotation at all. Link to comment Share on other sites More sharing options...
PCDug Posted September 22, 2016 Author Share Posted September 22, 2016 (edited) I am thinking the "pointer" of the XmarkerHeading isn't used as a point of reference for rotation at all.Recent versions of this mod of mine http://www.nexusmods.com/fallout4/mods/15994/? use the moveto function and xmarkerheading to do what it does.It worked fine for that mod. The sole purpose of xmarker headings is to be directional.The pointer is just a visual rappresentation.They are just static items after all.They don't do anything special.I use them just to be cohesive with the rest of the game.If I use moveto on a reference and point it to a marker rotated say (0,90,0) according to the wiki by default the reference moved to it should match that 3d orientation.But for some reason these references get moved but not rotated.I'll have to check the whole script again for some dumb mistake i guess.Here it is just for funsies.(NOT completed) Scriptname PCDugMBTravelScript extends ObjectReference Quest Property MBPositionQuest AutoMessage Property MBTravelMessage01 AutoMessage Property MBTravelMessage02 AutoMessage Property MBTravelMessage03 AutoMessage Property MBNoFuelMessage AutoMessage Property MBNoCoolantMessage AutoSound Property MBDriveSound AutoGlobalVariable Property GameHour AutoGlobalVariable Property MBFuelCOuntGlobal AutoGlobalVariable Property MBCoolantCountGlobal Autofloat Property Distance Autofloat Property MBHour Autofloat Property MBRequiredFuel Autofloat Property MBRequiredCoolant Autofloat Property MBCurrentFuel Autofloat Property MBCurrentCoolant AutoQuest Property MBFuelQuest AutoQuest Property MBCoolantQuest Auto ObjectReference Property MBDoor AutoObjectReference Property MBDoorMarker Auto ObjectReference Property CurrentPos AutoObjectReference Property DestPos AutoObjectReference Property mDestPos Auto ObjectReference Property abf Auto <-------These are initially disabled references of a vehicle placed around the world.ObjectReference Property acg AutoObjectReference Property air AutoObjectReference Property bkh AutoObjectReference Property cst AutoObjectReference Property csc AutoObjectReference Property cps AutoObjectReference Property ctc AutoObjectReference Property cvt AutoObjectReference Property cpm AutoObjectReference Property dmc AutoObjectReference Property egs AutoObjectReference Property egt AutoObjectReference Property fnf AutoObjectReference Property gdn AutoObjectReference Property ggn AutoObjectReference Property gtn AutoObjectReference Property hma AutoObjectReference Property jmp AutoObjectReference Property kpl AutoObjectReference Property mwc AutoObjectReference Property nhb AutoObjectReference Property obs AutoObjectReference Property onc AutoObjectReference Property opz AutoObjectReference Property rrk AutoObjectReference Property sct AutoObjectReference Property slg AutoObjectReference Property smp AutoObjectReference Property spc AutoObjectReference Property srl AutoObjectReference Property stc AutoObjectReference Property tfb AutoObjectReference Property tpb AutoObjectReference Property vlt AutoObjectReference Property wwh AutoObjectReference Property ist Auto ObjectReference Property mabf Auto <-------These are xmarker headings placed where i want the door to be movedObjectReference Property macg AutoObjectReference Property mair AutoObjectReference Property mbkh AutoObjectReference Property mcst AutoObjectReference Property mcsc AutoObjectReference Property mcps AutoObjectReference Property mctc AutoObjectReference Property mcvt AutoObjectReference Property mcpm AutoObjectReference Property mdmc AutoObjectReference Property megs AutoObjectReference Property megt AutoObjectReference Property mfnf AutoObjectReference Property mgdn AutoObjectReference Property mggn AutoObjectReference Property mgtn AutoObjectReference Property mhma AutoObjectReference Property mjmp AutoObjectReference Property mkpl AutoObjectReference Property mmwc AutoObjectReference Property mnhb AutoObjectReference Property mobs AutoObjectReference Property monc AutoObjectReference Property mopz AutoObjectReference Property mrrk AutoObjectReference Property msct AutoObjectReference Property mslg AutoObjectReference Property msmp AutoObjectReference Property mspc AutoObjectReference Property msrl AutoObjectReference Property mstc AutoObjectReference Property mtfb AutoObjectReference Property mtpb AutoObjectReference Property mvlt AutoObjectReference Property mwwh AutoObjectReference Property mist Auto Event OnActivate(ObjectReference akActionRef)MBFuelQuest.Start()MBCoolantQuest.Start()MBPositionQuest.Start()MBPositionQuest.Setstage(100)Menu()EndEventFunction Menu(Int aiButton = 0)aiButton = MBTravelMessage01.show() If aiButton == 0 <-------to choose the destinationDestPos=CurrentPosElseIf aiButton == 1DestPos=abfmDestPos=mabfElseIf aiButton == 2DestPos=acgDestPos=acgElseIf aiButton == 3DestPos=airmDestPos=mairElseIf aiButton == 4DestPos=bkhElseIf aiButton == 5DestPos=cpsElseIf aiButton == 6DestPos=cstmDestPos=mcstElseIf aiButton == 7DestPos=istElseIf aiButton == 8DestPos=cscElseIf aiButton == 9DestPos=ctcElseIf aiButton == 10DestPos=cvtElseIf aiButton == 11DestPos=cpmElseIf aiButton == 12DestPos=dmcElseIf aiButton == 13DestPos=egsElseIf aiButton == 14DestPos=egtElseIf aiButton == 15DestPos=fnfElseIf aiButton == 16DestPos=gdnElseIf aiButton == 17DestPos=ggnElseIf aiButton == 18DestPos=gtnElseIf aiButton == 19aiButton = MBTravelMessage02.show() If aiButton == 0DestPos=CurrentPosElseIf aiButton == 1DestPos=hmaElseIf aiButton == 2DestPos=jmpElseIf aiButton == 3DestPos=kplElseIf aiButton == 4DestPos=mwcElseIf aiButton == 5DestPos=nhbElseIf aiButton == 6DestPos=obsElseIf aiButton == 7DestPos=oncElseIf aiButton == 8DestPos=opzElseIf aiButton == 9DestPos=rrkElseIf aiButton == 10DestPos=sctElseIf aiButton == 11DestPos=slgElseIf aiButton == 12DestPos=smpElseIf aiButton == 13DestPos=spcElseIf aiButton == 14DestPos=srlElseIf aiButton == 15DestPos=stcElseIf aiButton == 16DestPos=tfbElseIf aiButton == 17DestPos=tpbElseIf aiButton == 18DestPos=vltElseIf aiButton == 19aiButton = MBTravelMessage03.show()If aiButton == 0DestPos=CurrentPosElseIf aiButton == 1DestPos=wwh EndIfEndIfEndIf If DestPos != CurrentPos MBHour = GameHour.GetValue()Distance=(CurrentPos.Getdistance(DestPos))MBCurrentFuel=MBFuelCOuntGlobal.GetValue()MBCurrentCoolant=MBCoolantCountGlobal.GetValue()MBRequiredFuel=(Distance/14280)MBRequiredCoolant=(Distance/7140) If MBCurrentFuel >= MBRequiredFuelIf MBCurrentCoolant >= MBRequiredCoolant Game.FadeOutGame(false, true, 4.0, 3.0)CurrentPos.Disable() <-----disables vehicle reference at current positionMBFuelCOuntGlobal.SetValue(MBCurrentFuel-MBRequiredFuel)MBCoolantCOuntGlobal.SetValue(MBCurrentCoolant-MBRequiredCoolant)GameHour.SetValue(MBHour+((Distance/7140000)*30))MBDriveSound.Play(Game.GetPlayer())DestPos.Enable() <----enables the vehicle reference at the destination MBDoor.MoveTo(mDestPos, abMatchRotation = true) <-----moves door to the destination marker heading (DOES NOT ROTATE THE THING FOR SOME RESON) MBDoorMarker.MoveTo(mDestPos,70.0 * Math.Sin(mDestPos.GetAngleZ()), 70.0 * Math.Cos(mDestPos.GetAngleZ()), - 80.0,abMatchRotation = true) <-------moves another marker heading in front of the door (AGAIN,DOES NOT ROTATE IT) CurrentPos=DestPos ElseaiButton = MBNoCoolantMessage.show()If aiButton == 0 ElseaiButton = MBNoFuelMessage.show()If aiButton == 0 EndIfEndIfEndIfEndIfEndIf MBFuelQuest.Stop()MBCoolantQuest.Stop() EndFunction Edited September 22, 2016 by PCDug Link to comment Share on other sites More sharing options...
steve40 Posted September 23, 2016 Share Posted September 23, 2016 Try using a different syntax: MBDoor.MoveTo(mDestPos,0,0,0,true) Otherwise, have you tried using MoveToNode, I can confirm that matching rotation works for this. It could save you from having to use all those messy markers as well. Link to comment Share on other sites More sharing options...
PCDug Posted September 23, 2016 Author Share Posted September 23, 2016 (edited) Try using a different syntax: MBDoor.MoveTo(mDestPos,0,0,0,true) Otherwise, have you tried using MoveToNode, I can confirm that matching rotation works for this. It could save you from having to use all those messy markers as well.I already tried the full syntax (destination x,y,z offset,abmatchrotation=)id does not workI'll look into the movetonode,I could really use getting rid of 30+ properties. EDIT-If someone is wondering why I don't use moveTo for the vehicle itself the answer is that MoveTo does not work on static collections. Edited September 23, 2016 by PCDug Link to comment Share on other sites More sharing options...
EveningTide Posted September 23, 2016 Share Posted September 23, 2016 (edited) If push come to shove, take a somewhat longer/complicated route(well you seem to know your way around math so might be easier) can use http://www.creationkit.com/fallout4/index.php?title=SetAngle_-_ObjectReference to turn the thing around yourself. Edited September 23, 2016 by EveningTide Link to comment Share on other sites More sharing options...
PCDug Posted September 23, 2016 Author Share Posted September 23, 2016 If push come to shove, take a somewhat longer/complicated route(well you seem to know your way around math so might be easier) can use http://www.creationkit.com/fallout4/index.php?title=SetAngle_-_ObjectReference to turn the thing around yourself.Now that I think about it I should be able to do something like objecttorotate.setangle(TargetRef.GetangleX(),TargetRef.GetangleY(),TargetRef.GetAngleZ())I just need to check if that syntax is a thing or not. Link to comment Share on other sites More sharing options...
Recommended Posts