Jump to content

Ok, suppose you had this happening in one of your mods...


HerrBaron

Recommended Posts

Try to refresh the form list every time you switch cells (e.g. entering a room or fast-travelling...). At least this works for my radar HUD mod....

From your description, once you restart the game and load the autosave, the form list must be update in that interior cell, and I guess it is the main difference between your two attempts. (since there is no information of when the form list is updated, I suppose you update it when the savefile is just loaded.)

 

Hi IF! The formlist is loaded and cleared in the same GameMode block, on a GetKeyPressed of 1; so it all takes place in the same cell.

Link to comment
Share on other sites

Boy, Ricker; those two debugging aids really helped me get down the road! So here's what appears to be going on, a new wrinkle:

 

If I go to the cabinet upon entry to the cell and activate it such that it transfers unhotkeyed items to the cabinet, everything works just fine. If, however, I open the cabinet, remove several items and do repairs on them using the R key from the weapons tab in the PipBoy, then activate the cabinet to transfer these repaired weapons back to the cabinet...BOOM! Down she goes. According to the dump from scof, it's dying on the call to Player.GetHotKeyItem 1, never comes back. If I remove a bunch of weapons from the cabinet, and return them to the cabinet without doing anything to them, it works fine. So I guess the question comes down to this:

 

What happens to a repaired item (weapon) that causes GetHotKeyItem 1 to fail, even though the repaired item is NOT hotkeyed?? Let me get a couple of fresh dumps, and I'll post the code and the dumps in a bit.

Link to comment
Share on other sites

Ok, here's the Code:

 

ScriptName WSTNWeaponsMoverScript

ref rHKBaseObject;
ref rList;
ref rContainer;

int Button;
int nItems;
int HotKeyIndex;
int iListIndex;
int ItemType;
int HKItemCount;

short bActivated;

Begin OnActivate Player
set Button to -1;
ShowMessage WSTNMsgWeapons;
set bActivated to 1;
End

Begin GameMode

if ( bActivated )

   	printc "bActivated"
   	set Button to GetButtonPressed;

   	if ( Button == 0 ) ; first option in menu is "Open it."
       	Activate Player, 0;

   	elseif ( Button == 1 )

       	printc "Button == 1";
       	set rList to WSTNHKItemList;
       	set HotKeyIndex to 1;
           	set HKItemCount to 0;
       	set ItemType to 0;
       	set iListIndex to 0;
       	set rHKBaseObject to 0;

       	label 10

       	if ( HotKeyIndex <= 8 )

           	printc "calling GetHotKeyItem %0.f", HotKeyIndex;
           	set rHKBaseObject to Player.GetHotKeyItem HotKeyIndex;
           	printc "back from GetHotKeyItem %0.f, rHKBaseObject = %n", HotKeyIndex, rHKBaseObject;

           	if ( rHKBaseObject )

               	printc "Calling GetObjectType with %n", rHKBaseObject;
                   	set ItemType to GetObjectType rHKBaseObject;

               	printc "ItemType = %0.f", ItemType;

                   	if ( ItemType == 40 )
                       	printc "Adding %n", rHKBaseObject;
                           	ListAddForm rList, rHKBaseObject;
                   	set HKItemCount to HKItemCount + 1;
               	endif ; ( ItemType == 40 )

               	set rHKBaseObject to 0;

           	endif ; ( rHKBaseObject )
       	
           	set HotKeyIndex to HotKeyIndex + 1;
           	if ( HotKeyIndex == 2 )
               	set HotKeyIndex to 3;
           	endif

           	goto 10;

       	endif ; ( HotKeyIndex <= 8 )

       	set rContainer to GetSelf;
       	printc "rContainer = %n, calling RemoveAllTypedItems", rContainer;
             	Player.RemoveAllTypedItems rContainer, 0, 0, 40, rList;
       	
       	printc "Back from RemoveAllTypedItems";

           	set rList to WSTNHKItemList;
           	set iListIndex to ListGetCount rList - 1;

           	Label 20

           	printc "iListIndex = %0.f", iListIndex;

           	if ( iListIndex >= 0 )
                   	set rHKBaseObject to ListRemoveNthForm rList, iListIndex ;
                   	printc "removed %n", rHKBaseObject;
               	set iListIndex to iListIndex - 1;
               	goto 20;
           	endif ; ( iListIndex >= 0 )

           	printc "Activating..."
           	Activate Player, 0;

   	endif ; ( Button == 1 )

   	set bActivated to 0;

endif ;  ( bActivated )

End

 

And here's a dump that shows two Activations; the first one shows the container was opened (to remove a bunch of weapons), and a transfer back without repairing the weapons taken into inventory. Bear in mind, NONE of these weapons taken from the cabinet were placed on hotkeys.

 

SetConsoleOutputFilename >> 'wstn.txt'

bActivated

 

bActivated

Button == 1

calling GetHotKeyItem 1

back from GetHotKeyItem 1, rHKBaseObject = Hk USP

Calling GetObjectType with Hk USP

ItemType = 40

Adding Hk USP

calling GetHotKeyItem 3

back from GetHotKeyItem 3, rHKBaseObject = HK G36C

Calling GetObjectType with HK G36C

ItemType = 40

Adding HK G36C

calling GetHotKeyItem 4

back from GetHotKeyItem 4, rHKBaseObject = DSR-1 Sniper

Calling GetObjectType with DSR-1 Sniper

ItemType = 40

Adding DSR-1 Sniper

calling GetHotKeyItem 5

back from GetHotKeyItem 5, rHKBaseObject = Mossberg 590

Calling GetObjectType with Mossberg 590

ItemType = 40

Adding Mossberg 590

calling GetHotKeyItem 6

back from GetHotKeyItem 6, rHKBaseObject = <no name>

calling GetHotKeyItem 7

back from GetHotKeyItem 7, rHKBaseObject = <no name>

calling GetHotKeyItem 8

back from GetHotKeyItem 8, rHKBaseObject = <no name>

rContainer = Weapon Locker, calling RemoveAllTypedItems

Back from RemoveAllTypedItems

iListIndex = 4

removed Mossberg 590

iListIndex = 3

removed DSR-1 Sniper

iListIndex = 2

removed HK G36C

iListIndex = 1

removed Hk USP

iListIndex = 0

removed Nothing

iListIndex = -1

Activating...

Now here's two more activations, the first to remove a bunch of weapons (followed by repairing them in inventory), and the second activation to have the container sort them back into itself:

 

bActivated

bActivated

Button == 1

calling GetHotKeyItem 1

BOOM, BOOM and out go the lights! This is repeatable time after time after time.

 

Looks like the editor cut off some line ends, so I've attached the code and the dump.

 

 

 

Link to comment
Share on other sites

I'm looking at the NVSE docs and according to it, GetHotKeyItem is called by Base Form:

 

set rHKBaseObject to GetHotKeyItem HotKeyIndex

 

A reference - player isn't needed because only the player has hot key items, I would think. That might be the issue.

 

 

Link to comment
Share on other sites

I'm looking at the NVSE docs and according to it, GetHotKeyItem is called by Base Form:

 

set rHKBaseObject to GetHotKeyItem HotKeyIndex

 

A reference - player isn't needed because only the player has hot key items, I would think. That might be the issue.

 

 

 

Yeah, I tried that; without the reference to Player, it always comes back with 0, hence nothing gets added to the exception list, and all weapons are removed. So the documentation is in error.

Link to comment
Share on other sites

I'm looking at the NVSE docs and according to it, GetHotKeyItem is called by Base Form:

 

set rHKBaseObject to GetHotKeyItem HotKeyIndex

 

A reference - player isn't needed because only the player has hot key items, I would think. That might be the issue.

 

 

 

Yeah, I tried that; without the reference to Player, it always comes back with 0, hence nothing gets added to the exception list, and all weapons are removed. So the documentation is in error.

That's strange. When I type GetHotKeyItem 1 at the console, it returns the weapon I have hotkeyed to it without having to click on the player.

They did things to the hotkeys for NV - removed hot key 2, so maybe now the function is just bugged.

You might try presetting the variable to something before making the call:

 

set rHKBaseObject to Pencil01
set rHKBaseObject to Player.GetHotKeyItem HotKeyIndex

 

Have you tried going the other way - from 8 to 1?

Link to comment
Share on other sites

Just curious. If you save the game right after you had entered that cell (after the autosave of course), and load it with or without restarting the game, does the crash still happen?

I can only suggest you by trying to crash the game by using only the functions you have in this script, and this might help you to locate the problem.

Link to comment
Share on other sites

I still can't get it to crash. I put your script verbatim on a copy of VLootArmorLockerVaultRustGen01 in a player home that I have. Enter cell, open, sort repair stuff, and it never blinks. The only weapon mod I have is WMX at the moment.
Link to comment
Share on other sites

I still can't get it to crash. I put your script verbatim on a copy of VLootArmorLockerVaultRustGen01 in a player home that I have. Enter cell, open, sort repair stuff, and it never blinks. The only weapon mod I have is WMX at the moment.

 

Really, really strange; these are stock weapons, for the most part, without mods, at least the ones I've been testing with... For what it's worth, when I do an SV on the container before and after crash, there are a bunch of DoOnce and other variables that are NOT part of the script I built, but more of them after a crash than before. I'm puzzled about that.

 

Oh, and no, haven't tried doing the hot key loop in reverse; easy enough to try.

 

Ya know, the only mod I'm running that could conceivably be screwing things up is and Inventory Sorter; I'm gonna disable it and see what I get...

Link to comment
Share on other sites

Just curious. If you save the game right after you had entered that cell (after the autosave of course), and load it with or without restarting the game, does the crash still happen?

I can only suggest you by trying to crash the game by using only the functions you have in this script, and this might help you to locate the problem.

 

Haven't tried this specifically, but I will and post back with results; thanks! Good suggestion!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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