Jump to content

Requesting NV Mod Help, Pipboy script crashes to desktop


Recommended Posts

  • 3 weeks later...
  • 3 weeks later...

So I got it to stop crashing using player.showrepairmenu and con_closeallmenus commands, but I guess I have the close menu commands in the wrong place as I can't get the pipboy to come up. Where might I change the place ment to fix this and finish this mod out.

scn BIDEpipRemoverSCRIPT

short Phase

short InitMod
short ModKey
short ModKeyState

short PipKeyState
float PipSpamTimer
ref EquippedItem
ref EquippedCondition

short ModMenuActive
short ModMenuButton
short RemapKeyFlag
short KeyRemapBuffer

float KeyTimer

short UninstallFlag

int NVSEcheck

begin Gamemode
	;Check to ensure NVSE is present before the initial removal occurs.
	;Loops continually until NVSE is found or the mod is uninstalled, in case
	;some unreasonable player decides to save after it doesn't work.
	if (NVSECheck == 0)
	;if GetNVSEVersion < 4
		set NVSECheck to GetNVSEVersion 
		return
	endif

	;If the mod has not been initialized, and the player is finished with the Doc.
	if (UninstallFlag == 0 && InitMod == 0 && getStage VMQ01 > 0)
		if (Phase == 0)
			set ModKey to 48
			player.unEquipItem Pipboy 1 1
			player.removeItem PipboyGlove 1 1
			player.additem PipboywristPC 1 1
			set EquippedItem to player.getEquippedObject 2
			if (EquippedItem != 0)
				set EquippedCondition to (player.getEquippedCurrentHealth 2 / getHealth EquippedItem && getPlayerControlsDisabled 0 1 == 0)
				player.removeItem EquippedItem 1 1
				set Phase to 1
			else
				set InitMod to 1
				set Phase to 0
			endif
		elseif (Phase == 1)
			player.addItemHealthPercent EquippedItem 1 EquippedCondition 1
			player.ShowRepairMenu
			player.equipItem EquippedItem 0 1
			player.EquipItem PipboywristPC 1 1
			con_closeallmenus
			set InitMod to 1
			set Phase to 0
		endif
	endif

	;Mod menu functions.
	if (ModMenuActive == 1)
		set ModMenuButton to getButtonPressed
			if (ModMenuButton == 0)
				set ModMenuActive to 2
				set RemapKeyFlag to 1
				showMessage BIDEpipRemapKey
			elseif (ModMenuButton == 1)
				set UninstallFlag to 1
				set EquippedItem to player.getEquippedObject 2
				if (EquippedItem != 0)
					player.unEquipItem EquippedItem
				endif
				player.removePerk BIDEpipLightPerk
				player.removeItem PipboywristPC 1 1
				player.ShowRepairMenu
				player.equipItem Pipboy 1 1
				con_closeallmenus
				resetPipboyManager
				showMessage BIDEpipUninstall
				set ModMenuActive to 0
				stopQuest BIDEpipRemover
			elseif (ModMenuButton == 2)
				set ModMenuActive to 0
			endif
	elseif (ModMenuActive == 2)
		set RemapKeyFlag to 0
		set ModMenuActive to 0

	;Normal functionality
	elseif (UninstallFlag == 0 && player.getItemCount Pipboy != 0)
		if (PipSpamTimer > 0)
			set PipSpamTimer to PipSpamTimer - getSecondsPassed
		endif

		;Pip-Boy callup hook
		if (isControlPressed 14 == 1 && PipKeyState == 0 && PipSpamTimer <= 0)
			set pipKeyState to 1

		elseif (PipKeyState == 1)
			if (Phase == 0)
				set PipKeyState to 1
				player.unEquipItem PipboywristPC 1 1
				player.ShowRepairMenu
				player.EquipItem Pipboy 1 1
				con_closeallmenus
				resetPipboyManager
				set Phase to 2
			elseif (Phase == 3)
				player.unEquipItem Pipboy 1 1
				player.ShowRepairMenu
				player.EquipItem PipboyWristPC 1 1
				con_closeallmenus
				set EquippedItem to player.getEquippedObject 2
				if (EquippedItem != 0)
					set EquippedCondition to (player.getEquippedCurrentHealth 2 / getHealth EquippedItem)
					player.removeItem EquippedItem 1 1
					set Phase to 4
				else
					set Phase to 0
					set PipKeyState to 0
				endif
			elseif (Phase == 4)
				player.addItemHealthPercent EquippedItem 1 EquippedCondition 1
				player.equipItem EquippedItem 0 1
				player.ShowRepairMenu
				player.EquipItem PipboywristPC 1 1
				con_closeallmenus
				set Phase to 0
				set PipKeyState to 0
			endif
		endif
	
		;Pip-Boy light and options menu callup functionality
		if (isKeyPressed ModKey == 1 && KeyTimer < 3)
			set KeyTimer to KeyTimer + getSecondsPassed
			set ModKeyState to 1
		elseif (KeyTimer >= 3)
			showMessage BIDEpipOptions
			set ModMenuActive to 1
			set KeyTimer to 0
			set ModKeyState to 0
		elseif (isKeyPressed ModKey == 0 && KeyTimer < 3 && ModKeyState == 1)
			if (player.hasPerk BIDEpipLightPerk == 0)
				player.addPerk BIDEpipLightPerk
				playSound UIPipBoyLightOn
			else
				player.removePerk BIDEpipLightPerk
				playSound UIPipBoyLightOff
			endif
			set ModKeyState to 0
			set KeyTimer to 0
		elseif (isKeyPressed ModKey == 0 && ModKeyState == 0 && KeyTimer > 0)
			set KeyTimer to 0
		endif

	;If the player loses the Pip-Boy, remove the light, if it had been on.
	elseif (UninstallFlag == 0 && player.getItemCount Pipboy == 0 && player.hasPerk BIDEpipLightPerk == 1)
		player.removePerk BIDEpipLightPerk
	endif
end

;Key remapping functionality.
begin Menumode 1001
	if (RemapKeyFlag == 1)
		set KeyRemapBuffer to getKeyPress 0
		if (KeyRemapBuffer > 0 && KeyRemapBuffer < 256)
			set ModKey to KeyRemapBuffer
		endif
	endif
end

begin Menumode
	if (Phase == 2 && Menumode == 1)
		set Phase to 3
		set PipSpamTimer to 0.3
	endif
end
Link to comment
Share on other sites

Success!!! I finally got it to work properly!

 

I got it to work by moving the needed pipboy swap under the menumode space and leaving just the initial gamemode swaps. Here is the working code (it could use some clean up but all functions seem to work):

scn BIDEpipRemoverSCRIPT

short Phase

short InitMod
short ModKey
short ModKeyState

short PipKeyState
float PipSpamTimer
ref EquippedItem
ref EquippedCondition

short ModMenuActive
short ModMenuButton
short RemapKeyFlag
short KeyRemapBuffer

float KeyTimer

short UninstallFlag

int NVSEcheck

begin Gamemode
	;Check to ensure NVSE is present before the initial removal occurs.
	;Loops continually until NVSE is found or the mod is uninstalled, in case
	;some unreasonable player decides to save after it doesn't work.
	if (NVSECheck == 0)
	;if GetNVSEVersion < 4
		set NVSECheck to GetNVSEVersion 
		return
	endif

	;If the mod has not been initialized, and the player is finished with the Doc.
	if (UninstallFlag == 0 && InitMod == 0 && getStage VMQ01 > 0)
		if (Phase == 0)
			set ModKey to 48
			player.unEquipItem Pipboy 1 1
			player.removeItem PipboyGlove 1 1
			player.additem PipboywristPC 1 1
			player.ShowRepairMenu
			player.EquipItem PipboywristPC 1 1
			con_closeallmenus
			set InitMod to 1
			set Phase to 1
			;set EquippedItem to player.getEquippedObject 2
			;if (EquippedItem != 0)
				;set EquippedCondition to (player.getEquippedCurrentHealth 2 / getHealth EquippedItem && getPlayerControlsDisabled 0 1 == 0)
				;player.removeItem EquippedItem 1 1
				;set Phase to 1
			;else
				;set InitMod to 1
				;set Phase to 0
			;endif
		elseif (Phase == 1)
			;player.addItemHealthPercent EquippedItem 1 EquippedCondition 1
			player.unEquipItem Pipboy 1 1
			player.ShowRepairMenu
			player.EquipItem PipboywristPC 1 1
			con_closeallmenus
			set InitMod to 1
			set Phase to 0
			;endif
		;elseif (Phase == 2)
			;player.unEquipItem Pipboy 1 1
			;player.ShowRepairMenu
			;player.EquipItem PipboywristPC 1 1
			;con_closeallmenus
			;set InitMod to 1
			;set Phase to 0
		endif
	endif

	;Mod menu functions.
	if (ModMenuActive == 1)
		set ModMenuButton to getButtonPressed
			if (ModMenuButton == 0)
				set ModMenuActive to 2
				set RemapKeyFlag to 1
				showMessage BIDEpipRemapKey
			elseif (ModMenuButton == 1)
				set UninstallFlag to 1
				set EquippedItem to player.getEquippedObject 2
				if (EquippedItem != 0)
					player.unEquipItem EquippedItem
				endif
				player.removePerk BIDEpipLightPerk
				player.removeItem PipboywristPC 1 1
				player.ShowRepairMenu
				player.equipItem Pipboy 1 1
				con_closeallmenus
				resetPipboyManager
				showMessage BIDEpipUninstall
				set ModMenuActive to 0
				stopQuest BIDEpipRemover
			elseif (ModMenuButton == 2)
				set ModMenuActive to 0
			endif
	elseif (ModMenuActive == 2)
		set RemapKeyFlag to 0
		set ModMenuActive to 0

	;Normal functionality
	elseif (UninstallFlag == 0 && player.getItemCount Pipboy != 0)
		if (PipSpamTimer > 0)
			set PipSpamTimer to PipSpamTimer - getSecondsPassed
		endif

		if (isControlPressed 14 == 1 && PipKeyState == 0 && PipSpamTimer <= 0)
			set pipKeyState to 1
		endif
	
		;Pip-Boy light and options menu callup functionality
		if (isKeyPressed ModKey == 1 && KeyTimer < 3)
			set KeyTimer to KeyTimer + getSecondsPassed
			set ModKeyState to 1
		elseif (KeyTimer >= 3)
			showMessage BIDEpipOptions
			set ModMenuActive to 1
			set KeyTimer to 0
			set ModKeyState to 0
		elseif (isKeyPressed ModKey == 0 && KeyTimer < 3 && ModKeyState == 1)
			if (player.hasPerk BIDEpipLightPerk == 0)
				player.addPerk BIDEpipLightPerk
				playSound UIPipBoyLightOn
			else
				player.removePerk BIDEpipLightPerk
				playSound UIPipBoyLightOff
			endif
			set ModKeyState to 0
			set KeyTimer to 0
		elseif (isKeyPressed ModKey == 0 && ModKeyState == 0 && KeyTimer > 0)
			set KeyTimer to 0
		endif

	;If the player loses the Pip-Boy, remove the light, if it had been on.
	elseif (UninstallFlag == 0 && player.getItemCount Pipboy == 0 && player.hasPerk BIDEpipLightPerk == 1)
		player.removePerk BIDEpipLightPerk
	endif
end

;Key remapping functionality.
begin Menumode 1001
	if (RemapKeyFlag == 1)
		set KeyRemapBuffer to getKeyPress 0
		if (KeyRemapBuffer > 0 && KeyRemapBuffer < 256)
			set ModKey to KeyRemapBuffer
		endif
	endif
end

begin Menumode 1
	player.unEquipItem PipboywristPC 1 1
	player.EquipItem Pipboy 1 1
	resetPipboyManager
	set InitMod to 0
	set Phase to 1
end
Link to comment
Share on other sites

  • Recently Browsing   0 members

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