Jump to content

Player.MoveTo (marker) not moving to correct location?


Sweet6Shooter

Recommended Posts

So I'm using this script to move the player from a new worldspace called Dry Canyon (yes, that modder's resource) to the Dead Money end of DLC marker, in the abandoned BOS bunker.

 

Everything in the script seems to be working correctly, except the final line that's supposed to move the player. They do get moved, but only like ~20 yards away, to what I believe to be the center of the cell that the activator is in. It runs into this issue, regardless of whether the Dead/Disabled checks are in the script.

 

Any ideas what's up? It's the same function that the original Dead Money transition to mojave script used, I'm not sure why it's acting so strangely.

 

I originally was just using the vanilla NVDLC01EndMarker for the moveto, but I tried adding my own and referencing that, and it didn't change anything. The new marker is literally right next to the original.

scn sDMSCPTDryCtoMojave

short sButtons
float sEnds
float sSurvs
float sIngestPenalty
float sSleepPenalty



begin onActivate

    if (IsActionRef player == 1)
        showMessage sDMMSGLeaveDryCtoMojave
    endif
end

begin menumode 1001
    set sButtons to GetButtonPressed
    if sButtons == -1
        return
    elseif sButtons == 0
        RemoveImageSpaceModifier FriendOfTheNightInteriorISFX
        RemoveImageSpaceModifier FriendOfTheNightISFX
        player.DispelAllSpells ; Removes all chem effects.
        PipBoyRadioOff ; Turn off PipBoy radio.
        if player.getitemcount sDMWeapFlareGunDryC == 0
            player.additem sDMWeapFlareGunDryC 1
        endif

        if sDMCarMerRef.GetDead == 1
            if sDMCarMerRef.GetDisabled == 0
                sDMCarMerRef.disable
                sDMCarMerRef.markfordelete
                sDMCarBrahminRef.disable
                sDMCarBrahminRef.markfordelete
            endif
        endif
        if sDMCarBrahminRef.GetDead == 1
            if sDMCarBrahminRef.GetDisabled == 0
                sDMCarMerRef.disable
                sDMCarMerRef.markfordelete
                sDMCarBrahminRef.disable
                sDMCarBrahminRef.markfordelete
            endif
        endif
        if (sDMCarMerRef.GetDisabled == 1 || sDMCarBrahminRef.GetDisabled == 1 || sDMCarMerRef.GetDead == 0 || sDMCarBrahminRef.GetDead == 0)
            set sIngestPenalty to 200
            set sSleepPenalty to 200
            set sEnds to player.getpermanentactorvalue Endurance
            set sSurvs to player.getpermanentactorvalue Survival
            set sEnds to 1 - (sEnds/10)
            set sSurvs to 1 - (sEnds/100)
            set sIngestPenalty to (sIngestPenalty * sEnds * sSurvs)
            set sSleepPenalty to (sSleepPenalty * sEnds * sSurvs)
            player.damageAV hunger sIngestPenalty
            player.damageAV dehydration sIngestPenalty
            player.damageAV SleepDeprevation sSleepPenalty

        endif
        set GameHour to (GameHour + 18)
        playerref.moveto sDMPostDryCMarker
    elseif sButtons == 1
        return
    endif

end
Link to comment
Share on other sites

OK, gotta try this myself. I did this once for my Oblivion mod. Should work the same here....

 

EDIT: It works for me. Did you put a

PrintC"Test Here"

right before the MoveTo command to make sure it actually does it?

Edited by GamerRick
Link to comment
Share on other sites

Yeah, if I add a printc below and above it, both print to the console

I also double checked the marker reference on the script entry in xEdit, and it's going to the right marker.

EDIT: Also, putting the command in the console takes me to the correct location.

Link to comment
Share on other sites

I have no clue. I looked in the GECK and found vanilla scripts doing the same thing to advance the time. None I looked at did a moveto right after tho.

 

What happens if you do the moveto first and then set the GameHour? Being single-threaded, they both get processed at the same time in that frame (or render loop) before then next frame is even drawn with the player moved to the new position. According to the Wiki page for the MoveToMarker command:

If this function is used to move the player, the function will queue up a movement request which will NOT process immediately and will NOT halt script execution.

So, it's worth a try.

 

Another thing you may have to do is put the two commands such that they occur in different invocations of the script's GameMode block.

Link to comment
Share on other sites

Oh wait. You are doing the MoveTo within a MenuMode block. I think that's a nono. It should be in a GameMode block, which requires the player to exit the menus first. So, you could set a flag, instead of doing the MoveTo in the MenuBlock and create a GameMode block to check that flag and do the moeveto there.

Edited by GamerRick
Link to comment
Share on other sites

Please allow me to edit your script to solve this problem and fix another I see. The MenuMode 1001 block will run every frame the game is showing a message, regardless if it's your message or someone else's.

 

EDIT(7/18) - Add additional code for followers. I added the code for followers to the GameMode block. It's from a vanilla script that I copied into mine.

scn sDMSCPTDryCtoMojave
short sButtons
float sEnds
float sSurvs
float sIngestPenalty
float sSleepPenalty
short bShowMenu    ; Aded by GamerRick
short bMovePlayer   ; Aded by GamerRick

begin onActivate
    if (IsActionRef player == 1)
        set bShowMenu to 1
        showMessage sDMMSGLeaveDryCtoMojave
    endif
end

;Added by GamerRick to move the player.
begin GameMode
    if bMovePlayer  
        set bMovePlayer to 0
        playerref.moveto sDMPostDryCMarker
        set rCompanion to 0

        If (VNPCFollowers.bBooneHired == 1)
            set rCompanion to CraigBooneRef 
        ElseIf (VNPCFollowers.ArcadeHired == 1)
            set rCompanion to ArcadeREF
        ElseIf (VNPCFollowers.bCassHired == 1)
            set rCompanion to RoseofSharonCassidyRef
        ElseIf (VNPCFollowers.bVeronicaHired == 1)
            set rCompanion to VeronicaRef 
        ElseIf (VNPCFollowers.RaulHired == 1)
            set rCompanion to RaulRef
        EndIf

        if rCompanion
            rCompanion.moveto sDMPostDryCMarker
        endif

        set rCompanion to 0

        If (VNPCFollowers.RexHired == 1)
            set rCompanion to RexRef 
        ElseIf (VNPCFollowers.bEDEHired == 1)
            if EDE1Ref.GetDisabled == 0
                set rCompanion to EDE1Ref
            elseif EDE2Ref.GetDisabled == 0
                set rCompanion to EDE2Ref
            elseif EDE3Ref.GetDisabled == 0
                set rCompanion to EDE3Ref
            endif
        endif

        if rCompanion
             rCompanion.moveto sDMPostDryCMarker
        endif

    endif
end

begin menumode 1001
    if bShowMenu == 0   ; Prevent script from running for any message but ours
      return
    else
      set bShowMenu to 0
    endif
    set sButtons to GetButtonPressed
    if sButtons == -1
        return
    elseif sButtons == 0
        RemoveImageSpaceModifier FriendOfTheNightInteriorISFX
        RemoveImageSpaceModifier FriendOfTheNightISFX
        player.DispelAllSpells ; Removes all chem effects.
        PipBoyRadioOff ; Turn off PipBoy radio.
        if player.getitemcount sDMWeapFlareGunDryC == 0
            player.additem sDMWeapFlareGunDryC 1
        endif
        if sDMCarMerRef.GetDead == 1
            if sDMCarMerRef.GetDisabled == 0
                sDMCarMerRef.disable
                sDMCarMerRef.markfordelete
                sDMCarBrahminRef.disable
                sDMCarBrahminRef.markfordelete
            endif
        endif
        if sDMCarBrahminRef.GetDead == 1
            if sDMCarBrahminRef.GetDisabled == 0
                sDMCarMerRef.disable
                sDMCarMerRef.markfordelete
                sDMCarBrahminRef.disable
                sDMCarBrahminRef.markfordelete
            endif
        endif
        if (sDMCarMerRef.GetDisabled == 1 || sDMCarBrahminRef.GetDisabled == 1 || sDMCarMerRef.GetDead == 0 || sDMCarBrahminRef.GetDead == 0)
            set sIngestPenalty to 200
            set sSleepPenalty to 200
            set sEnds to player.getpermanentactorvalue Endurance
            set sSurvs to player.getpermanentactorvalue Survival
            set sEnds to 1 - (sEnds/10)
            set sSurvs to 1 - (sEnds/100)
            set sIngestPenalty to (sIngestPenalty * sEnds * sSurvs)
            set sSleepPenalty to (sSleepPenalty * sEnds * sSurvs)
            player.damageAV hunger sIngestPenalty
            player.damageAV dehydration sIngestPenalty
            player.damageAV SleepDeprevation sSleepPenalty
        endif
        set GameHour to (GameHour + 18)
; Removed by GamerRick        playerref.moveto sDMPostDryCMarker
        set bMovePlayer to 1 ; Added by GamerRick
    elseif sButtons == 1
        return
    endif
end
Edited by GamerRick
Link to comment
Share on other sites

Welcome. Did that script work? I am learning too as I help. I was wondering if setting the GameHour when the game is paused (menu state) would be a problem too, due to what that might set off as the game adjusts to the sudden time change.

Edited by GamerRick
Link to comment
Share on other sites

  • Recently Browsing   0 members

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