Ordeiberon Posted May 8, 2015 Share Posted May 8, 2015 So I am trying to convert a mod of mine A Pipboy Replacer http://www.nexusmods...t3/mods/21133/? to New Vegas. I have got the paths to work and updated certain commands to get the script to save using NVSE Geck to but the script to change out the equipment is crashing the game upon it first being run. I hear the script activate the equipment swap, I see the equipment get removed, but it crashes before it comes back. I did not write the original script, just updated it to work with my Mod, so I am unsure to the need for the full equipment swaps but ti might have had something to do with F03 scenarios. So I was hoping someone could look and tell if I am missing something obvious that changed between F03 and NV. The original code was as follows: 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.equipItem EquippedItem 0 1 player.EquipItem PipboywristPC 1 1 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.equipItem Pipboy 1 1 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.EquipItem Pipboy 1 1 resetPipboyManager set Phase to 2 elseif (Phase == 3) player.unEquipItem Pipboy 1 1 player.EquipItem PipboyWristPC 1 1 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.EquipItem PipboywristPC 1 1 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 However since I first started troubleshooting this I have discovered some issues that I hope can point to the culprit faster. I deleted the whole code and went through adding section by section until it crashed and here is where it crashed: 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 released from Doc Mitchell's Care. PrintC "1" if (UninstallFlag == 0 && InitMod == 0 && getStage VMQ01 > 0) PrintC "2" if (Phase == 0) PrintC "3" set ModKey to 48 PrintC "4" player.unEquipItem Pipboy 1 1 PrintC "5" player.removeItem PipboyGlove 1 1 PrintC "6" player.additem PipboywristPC 1 1 PrintC "7" set EquippedItem to player.getEquippedObject 2 PrintC "8" if (EquippedItem != 0) PrintC "9" set EquippedCondition to (player.getEquippedCurrentHealth 2 / getHealth EquippedItem && getPlayerControlsDisabled 0 1 == 0) PrintC "10" player.removeItem EquippedItem 1 1 PrintC "11" set Phase to 1 PrintC "12" else PrintC "13" set InitMod to 1 PrintC "14" set Phase to 0 PrintC "15" endif PrintC "16" elseif (Phase == 1) PrintC "17" player.addItemHealthPercent EquippedItem 1 EquippedCondition 1 PrintC "18" player.equipItem EquippedItem 0 1 PrintC "19" player.equipItem PipboywristPC 1 1 PrintC "20" ;set InitMod to 1 PrintC "21" ;set Phase to 0 PrintC "22" endif PrintC "23" endif end It crashed upon trying to equip my replacement wristband in place of no pip-boy. Now I wondered if it might the mesh and there might some issues there too. I tried blocking out the equip line and equiping it via console. It crashed. So then replaced the model with my pip-boy replacer model. That worked. I could equip via console (player.equipitem 0b003d38). However it would not equip via script, (player.equipitem PipBoyWristPC 1 1) as that crashed. First off the games seems to not like anything in the pip-boy biped slot that does not have a pipboy screen and buttons. I found this by editing the pip-boy replacer copy down to just a wristband, but then it still crashed. I restarted and removed piece by piece in nifscope, until I had a model I could still equip via console without crashing. That model was just the wristband, screen and three buttons. But it still crashed via script. The reason I think it has to do with the pip-boy slot is if I change the wristband to another biped slot it works either by console or script (even with no screen or buttons), but of course it doesn't look right (sticking out the head, hand, etc) because it is attached to the wrong biped slot. Ideas? Link to comment Share on other sites More sharing options...
Aintiarna Posted May 9, 2015 Share Posted May 9, 2015 I'm not sure if this will help, but just in case I thought I'd mention it. The NV GECK has various issues with equipment slots that only show up in FNVedit and not the GECK itself. For instance, if you copy a pair of sunglasses, rename them and try to equip them in game they'll appear on the side of your PCs head, not where they should be. The only way to fix it is to go into FNVedit and add the missing head slot that the geck doesn't create. Have you tried comparing your pipboy with the original in FNVedit? There may be missing slots which whilst only visually problematic with clothing, could cause a CTD with something as crucial as the pipboy. Link to comment Share on other sites More sharing options...
rickerhk Posted May 10, 2015 Share Posted May 10, 2015 In NV there are CTD problems in general with equiping a pipboy in gamemode. FO3 did not have that issue. You might want to check out the NV pipboy readius mod to see how they worked around that problem. Link to comment Share on other sites More sharing options...
Ordeiberon Posted May 12, 2015 Author Share Posted May 12, 2015 In NV there are CTD problems in general with equiping a pipboy in gamemode. FO3 did not have that issue. You might want to check out the NV pipboy readius mod to see how they worked around that problem. Good idea It seems that any of the readius modes don't have the same issue, as unequiping the pipboy is easy in game mode, and you can add a custom one (like the readius) easily when you call it up (in Menu mode), but I have not seen how to swap to a different pipboy before you exit Menu mode. Link to comment Share on other sites More sharing options...
Ordeiberon Posted May 17, 2015 Author Share Posted May 17, 2015 For those interested in checking it out directly (rather than just suggesting code changes) I have uploaded a WIP version on the Nexus, Available here: http://www.nexusmods.com/newvegas/mods/58968/? Link to comment Share on other sites More sharing options...
Ordeiberon Posted May 18, 2015 Author Share Posted May 18, 2015 Okay I made some progress thanks to a fellow modder. This new script successfully swapped out the pipboys without crashing. However it now crashes upon trying to call up the pipboy. The first fix was accomplished I think by the addition of a con_closeallmenus command after trying to make the swap. So I tried to add it every where else the wristband is equipped, but it still crashed. Here is the code as I currently edited it: 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.equipItem Pipboy 1 1 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.EquipItem Pipboy 1 1 resetPipboyManager set Phase to 2 elseif (Phase == 3) player.unEquipItem Pipboy 1 1 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.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 More sharing options...
rickerhk Posted May 18, 2015 Share Posted May 18, 2015 Is there a reason EquippedCondition is declared as a ref instead of a float? getEquippedCurrentHealth returns a float. http://www.gribbleshnibit.com/projects/NVSEDocs/#GetEquippedCurrentHealth Link to comment Share on other sites More sharing options...
Ordeiberon Posted May 18, 2015 Author Share Posted May 18, 2015 Is there a reason EquippedCondition is declared as a ref instead of a float? getEquippedCurrentHealth returns a float. http://www.gribbleshnibit.com/projects/NVSEDocs/#GetEquippedCurrentHealth I do not know. That was part of the original script, not one of my modifications. Perhaps it should be a float in New Vegas? Link to comment Share on other sites More sharing options...
rickerhk Posted May 19, 2015 Share Posted May 19, 2015 It should have been a float in Fallout3 also. Ref variables are for FormIds and RefIds. AddItemHealthPercent requires a float between 0 and 1. Refs are stored as 8 hex digits. Perhaps floats are stored the same way and it just worked in FO3. I'm not saying this is the reason for the crashing but I would do away with questionable stuff. Link to comment Share on other sites More sharing options...
Ordeiberon Posted May 20, 2015 Author Share Posted May 20, 2015 Someone mentioning the hotkey for the light gave me an idea. I would prefer it to happen automatically, but perhaps it might easier right now to create a hot key that swaps it after it was called up. So you would call it up (activate menu mode) and press an "on" button to activate the hologram (make the swap). Press the button again to turn "off" the hologram (swap it back). This might have the added advantage of allowing the user to keep the hologram activated if they prefer, and only allowing the swap in menu mode. Perhaps restore the pipboy light button and use that hotkey. Link to comment Share on other sites More sharing options...
Recommended Posts