Jump to content

MoveTo won't move to.


antstubell

Recommended Posts

Quite a large script but main issue from what I can tell is for some reason the player will not move. Hopefully something simple I just can't see after hours of working on this. Video shows exactly what is and isn't happening.

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2153146&parId=B60C11D037429D8E%21191&o=OneUp

 

 

imageSpaceModifier property FadeToBlackImod auto
imageSpaceModifier property FadeToBlackHoldImod auto
imageSpaceModifier property FadeToBlackBackImod auto

Actor Property PlayerREF Auto
Cell Property MyCell1 Auto
Cell Property MyCell2 Auto
Float Property Delay Auto
Float Property Delay2 Auto
GlobalVariable Property MyGlobal Auto; the player is IN or OUT of the coffin variable
GlobalVariable Property LiftPos Auto
ObjectReference Property Movhere1 Auto
ObjectReference Property Movhere2 Auto
ObjectReference Property CoffinMorgue Auto
ObjectReference Property CoffinHosp Auto
Sound property MySnd01 Auto
String Property Mytext Auto
String Property CellName1 Auto
String Property CellName2 Auto

Event OnActivate(ObjectReference akActionRef)

Cell ThisCell = PlayerREF.GetParentCell()

If MyGlobal.GetValue() != 1; move coffin if player is not inside it
MoveEmptyCoffin()
EndIf

If ThisCell == MyCell1 && MyGlobal.GetValue() == 1; player in morgue coffin, move player to hospital
LiftPos.SetValue(1)
Cell1()
EndIf

If ThisCell == MyCell2 && MyGlobal.GetValue() == 1; player in hospital coffin, move player to morgue
LiftPos.SetValue(2); start position of coffin
Cell2()
EndIf

EndEvent
; ----------------------------------------
Function Cell1(); Morgue
Debug.Notification ("You’re in " + CellName1)

EndFunction
; ----------------------------------------
Function Cell2(); Hospital Upper
Debug.Notification ("You’re in " + CellName2)
FadeToBlackImod.apply()
MySnd01.play(Self)
CoffinMorgue.Enable()
PlayerREF.MoveTo(MovHere1)
Utility.wait(Delay); wait for fade, sfx and other coffin to enable
FadeToBlackImod.PopTo(FadeToBlackHoldImod)
Utility.wait(Delay2); time in blackout
CoffinHosp.Disable()
FadeToBlackHoldImod.PopTo(FadeToBlackBackImod); fade back from black
LiftPos.SetValue(1); lift now in morgue

EndFunction
; --------------------------------------------------------------
Function MoveEmptyCoffin()
;Debug.Notification ("Moving Empty Coffin")
If LiftPos.GetValue() == 2; lift in hospital
FadeToBlackImod.apply()
MySnd01.play(Self)
Utility.wait(Delay); wait for fade and sfx
CoffinHosp.Disable()
CoffinMorgue.Enable()
FadeToBlackImod.PopTo(FadeToBlackHoldImod)
Utility.wait(Delay2); time in blackout
FadeToBlackHoldImod.PopTo(FadeToBlackBackImod); fade back from black
LiftPos.SetValue(1); lift now in morgue

ElseIf LiftPos.GetValue() == 1; lift in morgue
FadeToBlackImod.apply()
MySnd01.play(Self)
Utility.wait(Delay); wait for fade and sfx
CoffinHosp.Enable()
CoffinMorgue.Disable()
FadeToBlackImod.PopTo(FadeToBlackHoldImod)
Utility.wait(Delay2); time in blackout
FadeToBlackHoldImod.PopTo(FadeToBlackBackImod); fade back from black
LiftPos.SetValue(2); lift now in hospital
EndIf

EndFunction



 

Edited by antstubell
Link to comment
Share on other sites

A) Place 2 'Load Doors' and use them to move the player, activate 1st to go down > activate 2nd to go up, you don't need to have the doors visible just the 'Door's Markers' placed where there are suppose to, and your script does the rest.



MyDoor.Activate(PlayerREF)



B) In order to move the player you need to script it like this:



Game.FadeOutGame(False, True, 2.0, 1.0) ; No Need For imageSpaceModifier
PlayerREF.MoveTo(MovHere1)
Game.EnableFastTravel()
Game.FastTravel(MovHere1)

And for not calling GAME put in the top of your script

Import Game


FadeOutGame(False, True, 2.0, 1.0)
PlayerREF.MoveTo(MovHere1)
EnableFastTravel()
FastTravel(MovHere1)




Have a nice day.

Link to comment
Share on other sites

The difference between moving an npc and moving the player from one cell to another is:

- Npcs when they are moved they just occupy a point reference in the 3d space and nothing more.

- While, when the player is moved the game engine needs to unload & LOAD the cell that the players will occupy, the "FastTravel" does all the necessary 'LOADING' of the cell, otherwise the player will be moved to an empty cell.

* The functions i posted is what 'Load Doors' actually do.


* I try to explain it as simple as i could, i hope i was clear, if i wasn't don't hesitate for further explanation.

Link to comment
Share on other sites

I was looking at those two functions just recently:

 

playerRef.moveTo(ref) will move the player to the given ref in any cell or worldspace

 

game.fastTravel(ref) will move the player to the fast travel location IN THE SAME CELL OR WORLDSPACE ONLY. It will also encourage followers to travel with you - the moveTo won't.

 

Hence if you want to travel without using a door to a new worldspace with your followers you'll need to do first moveTo then fastTravel.

 

I suspect what may have happened with you above is that an older version of your scripts properties might be burned into your save and 'movHere1' might not be set to the value the appears in the editor, but an older value - this has caught me more times than I'd like to say. Try a Debug.Notification("Moving to:"+movHere1.getFormId()) before you call moveTo to check which ref it's going to. Or try with an older save before you added the script to the button.

 

Cheers - dafydd99

Link to comment
Share on other sites

Rasikko and dafydd99 are correct.

As for using the "MoveTo()" function alone in the player, i did that only once and the game CTD, so i immediately scripted as i posted above.

No further testings was than to that part of my mod with only the "MoveTo()" > player.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...