Jump to content

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


Sweet6Shooter

Recommended Posts

So I ended up adjusting the hardcore penalties into the gamemode block along with the transit lines. The issue at the moment seems to be that the gamemode part of the script isn't firing, even when it's variable is set to 1. It's successfully checking the gamemode, but it doesn't want to recognize fExit being 1.

scn sDMSCPTDryCtoMojave

short sButtons
float sEnds
float sSurvs
float sIngestPenalty
float sSleepPenalty
short fExit
ref rCompanion
short bShowMenu

begin onActivate

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

begin menumode 1001
	if bShowMenu != 1
		return
	elseif bShowMenu == 1
		set sButtons to GetButtonPressed
		set bShowMenu to 0
		if sButtons == -1
			return
		elseif sButtons == 0
			set fExit to 1
		elseif sButtons == 1
			return
		endif
	endif

end

begin gamemode
printc "gamemode checked"
if fExit == 1
printc "fexit is 1"
		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
        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 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
		player.moveto sDMPostDryCMarker
;		set GameHour to (GameHour + 18)
set fExit to 0
endif
end
Link to comment
Share on other sites

Oops. I don't know. It's an object script. So, it should run every frame while it is in the same cell as the player.

 

Maybe see if it does this:

elseif sButtons == 0
   PrintC'Setting fExit now"
   set fExit to 1
Edited by GamerRick
Link to comment
Share on other sites

Wait, hang on, it works out fine, but I have to remove that menumode condition criteria you put in. Something about it makes the script not work right, and there aren't any other issues with the menu popping up or doing things it shouldn't during other messages.

 

EDIT: And it also fixes the gamehour change crash. Excellent!

Link to comment
Share on other sites

This ended up being the final script that worked correctly:

scn sDMSCPTDryCtoMojave

short sButtons
float sEnds
float sSurvs
float sIngestPenalty
float sSleepPenalty
short fExit
ref rCompanion

begin onActivate

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

begin menumode 1001
		set sButtons to GetButtonPressed
		if sButtons == -1
			return
		elseif sButtons == 0
			set fExit to 1
		elseif sButtons == 1
			return
		endif
end


begin gamemode
if fExit == 1
		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
        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 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
		player.moveto sDMPostDryCMarker
		set GameHour to (GameHour + 18)
endif
end
Link to comment
Share on other sites

Oh yea. The menumode loops until you press a button. So, it needs to be able to keep running until they do:

begin menumode 1001
if bShowMenu != 1
  return
elseif bShowMenu == 1
  set sButtons to GetButtonPressed
  ; Remove this here set bShowMenu to 0
  if sButtons == -1
   return
  elseif sButtons == 0
   set bShowMenu to 0    ; add it here
   set fExit to 1
  elseif sButtons == 1
   set bShowMenu to 0    ; and here
   return
  endif
endif
end

It's still important so that you don't go reading keypresses and reacting to them whenever anyone displays a menu.

Edited by GamerRick
Link to comment
Share on other sites

For some reason, doing that crashes the game? It does so in a very similar manner to the initial gamehour change, where it loads in for a second, then hangs and crashes.

EDIT: Nope, it looks like it was still the gamehour change crashing the game again, and I somehow got a fluke where it didn't crash a few times in a row.

Link to comment
Share on other sites

I don't know any more. I am just sorta guessing anyway, that you can't do a moveto while in menumode. I had similar problems doing a moveto in an Oblivion mod, and doing a PCB before it helped, but Oblivion is much more fragile than FNV. I never needed to change the GameHour.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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