Jump to content

Any modless alternative for RemoveItemTarget? Item-Sorting-Issue


ohneende

Recommended Posts

Hi folks,

 

just started playing NV and thought about revamping my modding skills by lifting up my L38-Suite. So I started to work on a simple script with following purpose:

 

I want to store my items in a container, then press a button and have all my stuff sorted in predefined Boxes. Like everythin used in Workbench recipes in a specified Toolbox near my Workbench.

 

And this is what I tried: Put anything I want to get sorted in FormLists (perhaps there's an easier way, but I did it handson) and wrote a script to get activated by a button.

scn AASortingSCRIPT

short nButton

BEGIN OnActivate
	if IsActionRef player
		ShowMessage AASortingMessage
	endif
END

BEGIN MenuMode 1001

	set nButton to GetButtonPressed
	if (nButton == 0)	;start sorting			
		AASortLocker01REF.RemoveItemTarget AASortListWorkBench AAWorkContainer01REF
		AASortLocker01REF.RemoveItemTarget AASortListReloadingBench AAReloadingContainer01REF
		AASortLocker01REF.RemoveItemTarget AASortListCampfire AACampfireContainer01REF
		ShowMessage AASortingComplete
	endif
END

As I am the one I've ever been, I hadn't seen that .RemoveItemTarget is a NVSE-command, which I'm not using yet. And as I want to keep my game as vanilla as possible (am a bit afraid of bigger mods, tbh), all the long story shortens in this question:

 

Is there any non-NVSE alternative to sort my items by my FormLists? And if there's not, have you any wild guess on how to realize my simple sorting-phantasies?

 

Thank-a-lot and cheerio,

ohneende

 

PS: If I've done something wrong in opening this topic, I'm sorry. Just spent the last hours on doing what i explained, realized it won't work and am too upset now to read the rules.

Link to comment
Share on other sites

There is another way ... container sorting mods for Fo3 do it.

But "RemoveItemTarget" was invented to get past those tedious old scripting methods.

So might as well use it since it is available with modding FNV.

 

Don't think of NVSE / JIP & other like downloads , as the same as creating mods dependent on other content mods.

But merely as a means to teach the engine new/extended scripting vocabulary.

Once you install it , there is no need to do anything but use it's launcher.

Throw away the vanilla launcher.exe shortcut , for both game and geck.

Then go into the install folder and make a new short cut for the NVSELauncher.exe

On the target field ... go to the end of the string outside the quotes , and type this.

 

" -editor

 

notice the space after the last quote ,,, it is important

 

Then you just launch the geck from that new short cut always ... no need to not use it ... all the vanilla language still works. You can change the thumbnail pick on it too. What ever fits ... even to the Geck thumbnail .

 

And of course the game need be launched with that button on your mod manager for nvse . But could also just use the nvselauncher.exe : Target un edited as a new short cut.

Link to comment
Share on other sites

  • 4 months later...

Sorry to bring this back up, but JIP LN NVSE is really mandatory for New Vegas.

It doesn't even enhance the abilities you have with modding, it either fixes the game simply by solving issues, which you can fairly read on the description page.

 

Either my ammunition sorting wouldn't be possible without it.

Anyways, your idea with using Form Lists as exceptions was already previously used by many other people who invented some sorting algorithms for their inventory items.

 

Initially Ignis010 built up that nice farmhouse, which my old mentor liked that much that he enhanced it a bit.

Well, unfortunately I was the person who had to help him testing, so I got pretty much used to that house too.

 

I am currently enhancing it on my own with JIP LN NVSE and that's how my ammunition sorting looks like.

 

 

 

 

scn GSFarmAmmoSorterSCRIPT
;==============>YEAH, this is a bitchy ammo sorter. As he is iffy with so much queries loops and stuff.
short Button
ref GSfarmDelRef
ref GSfarmBasRef
ref GSfReEquipW        ;=> Used to requip weapon and fixing ammo again.
ref GSfReEquipA        ;=> All available ammo will be loaded into one mag, which is dumb.
array_var GSFInvRefs    ;=> The variables above are used to fix that occurence.
array_var GSFCheckRefs
array_var GSFEquipRefs
array_var GSFHotKeyRefs
ref GSFHotKey1
ref GSFHotKey3        ;=> I tried to use "SaveHotkeys" and "RestoreHotkeys", but it appeared to only
ref GSFHotKey4        ;=> work partially. When I activated the object for the first time, hotkeys are saved and
ref GSFHotKey5        ;=> restored correctly. But when I switch hotkeys, then only the previous setup will
ref GSFHotKey6        ;=> be restored. Therefore I switched back to the more annoying way of having 7
ref GSFHotKey7        ;=> different ref vars. I could have used another array var, but we already have 4
ref GSFHotKey8        ;=> in use. Thats already overkill. :P
short GSFRemoveC
short GSFCheckIndex

Begin OnActivate
    if isActionRef Player
        Let Button := 0
        While Button < ListGetCount GSfarmNoShovelRemoveDEFAULT        ;=> This block restores the default state of
            Let GSFarmBasRef := ListGetNthForm GSfarmNoShovelRemoveDEFAULT Button ;=> NoShovelRemove.
            Let GSFarmDelRef := ListGetNthForm GSfarmNoShovelRemove Button    ;=> That list determines sorting
            if GSFarmBasRef != GSFarmDelRef                                                ;=> exceptions.
                ListReplaceNthForm GSfarmNoShovelRemove GSFarmBasRef Button
            endif                    ;=> Its a static list with caps, lockpicks and a shovel as their last entries.
            Let Button += 1        ;=> However, the first 32 items are dummy items that can get replaced.
        Loop                    ;=> We have 7 hotkeys, 1 weapon with probably 5 ammo types
        Let GSFHotkey1 := 0
        Let GSFHotkey3 := 0
        Let GSFHotkey4 := 0
        Let GSFHotkey5 := 0        ;=> As hotkey vars may be set everytime we activate that thing,
        Let GSFHotkey6 := 0        ;=> they need to be cleared everytime, to be sure to erase previous
        Let GSFHotkey7 := 0        ;=> Hotkeys that got recently changed.
        Let GSFHotkey8 := 0
        Let Button := 0                ;=> We misuse button either as array index here. XD
        Let GSFRemoveC := 0    ;=> RemoveC will be necessary to determine which messages will be shown.
        Let GSFHotKeyRefs := Ar_Construct "array"
        if Player.GetHotkeyItem 1 != 0        ;=> Does the player even have an item assigend to hotkey 1?
            Let GSFHotKey1 := Player.GetHotkeyItem 1        ;=> Really? Ok, lets save that for later.
            Let GSfarmBasRef := Player.GetHotkeyItem 1    ;=> This one is legacy. I could have used just the hotkey var instead.
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef    ;=> Yeah, we want an inventory ref now!
            if Player.GetEquippedObject 5 != GSfarmBasRef    ;=> Only works with a base ref
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6    ;=> Only works with an inventory ref. -.-
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button    ;=> 5 and 6 are throwable and placeable
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef    ;=> weapons. The item is moved into the exception list and
                    Let Button += 1    ;=>Index of NoShovelRemove    ;=> Also saved into our hotkey array, which will be used for messages.
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef    ;=> This one calculates the FULL itemcount of all exceptional items.
                elseif GSFarmDelRef.GetEquipType <= 2    ;=>Stands for any weapon that requires ammunition.
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo        ;=> Now we have a proper use for that reference variable. ^^
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef    ;=> We want an inventory reference AGAIN!
                    if GSFarmDelRef.GetType == 41    ;=> That works like a charm, but the least weapons have actually real ammunition.
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button    ;=> In fact, most weapons use a form list as ammunition.
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0        ;=> Ohhh, so you are a FormList, with some items?! I also tried "GetType == 85", but that didnt work. :(
                        While GSFCheckIndex < ListGetCount GSfarmBasRef    ;=> CheckIndex was only invented for this case, as we continue our miuse of "Button"
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex    ;=> as index variable. It will be fine later when it can fullfill its purpose. ^^
                            if IsFormValid GSFarmDelRef        ;=> One entry in the 9mm ammo list was no valid form. Seems some s#*&#33; got added. oO
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button    ;=> It wasnt me :P But IsFormValid fixed the issue.
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1    ;=> CheckIndex will be increased until all items of the list gone through (as in that case CheckIndex will be bigger than the ListCount)
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0                ;=> We set that index var back to zero, so next time the index evaluation will start with the first entry for sure.
        if Player.GetHotkeyItem 3 != 0        ;=> Its awful but we want to do that with any single hotkey of course.
            Let GSFHotKey3 := Player.GetHotkeyItem 3
            Let GSfarmBasRef := Player.GetHotkeyItem 3
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        if Player.GetHotkeyItem 4 != 0
            Let GSFHotKey4 := Player.GetHotkeyItem 4
            Let GSfarmBasRef := Player.GetHotkeyItem 4
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        if Player.GetHotkeyItem 5 != 0
            Let GSFHotKey5 := Player.GetHotkeyItem 5
            Let GSfarmBasRef := Player.GetHotkeyItem 5
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        if Player.GetHotkeyItem 6 != 0
            Let GSFHotKey6 := Player.GetHotkeyItem 6
            Let GSfarmBasRef := Player.GetHotkeyItem 6
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        if Player.GetHotkeyItem 7 != 0
            Let GSFHotKey7 := Player.GetHotkeyItem 7
            Let GSfarmBasRef := Player.GetHotkeyItem 7
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        if Player.GetHotkeyItem 8 != 0
            Let GSFHotKey8 := Player.GetHotkeyItem 8
            Let GSfarmBasRef := Player.GetHotkeyItem 8
            Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
            if Player.GetEquippedObject 5 != GSfarmBasRef
                if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6
                    ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                    Ar_Append GSFHotKeyRefs, GSfarmBasRef
                    Let Button += 1
                    Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                elseif GSFarmDelRef.GetEquipType <= 2
                    Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                    Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                    if GSFarmDelRef.GetType == 41
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFHotKeyRefs, GSfarmBasRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif ListGetCount GSfarmBasRef > 0
                        While GSFCheckIndex < ListGetCount GSfarmBasRef
                            Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                            if IsFormValid GSFarmDelRef
                                ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                Let Button += 1
                                Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                            endif
                            Let GSFCheckIndex += 1
                        Loop
                    endif
                endif
            endif
        endif
        Let GSFCheckIndex := 0
        Let GSFEquipRefs := Ar_Construct "array"        ;=> Now lets check what weapons the player has equipped.
        Let GSFInvRefs := Player.GetAllItemRefs 40    ;=> First we build an array with all weapons the player has in his / her inventory.
        if eval (Ar_Size GSFInvRefs) > 0                    ;=> If that array doesnt have any entries, the player has nothing what he / she can equip.
            ForEach GSFCheckRefs <- GSFInvRefs        ;=> Now we go through all items and pass it to an array with which we check the entries.
                Let GSFarmDelRef := GSFCheckRefs["value"]        ;=> The entry will be saved into a ref var, so it can be processed.
                if GSFarmDelRef.IsEquipped        ;=> Requires an inventory reference, and what else do we get from that GetAllItemRefs-function? :D
                    if GSFarmDelRef.GetEquipType == 5 || GSFarmDelRef.GetEquipType == 6    ;=> Requires an inventory reference again.
                        Let GSfarmBasRef := GSFarmDelRef.GetBaseObject        ;=> Well, but we want to move the base form into the exception list.
                        ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                        Ar_Append GSFEquipRefs, GSFarmDelRef
                        Let Button += 1
                        Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                    elseif GSFarmDelRef.GetEquipType <= 2        ;=> Same game as with the hotkeys, just that we save it into our equip item array.
                        Let GSfReEquipW := GSFarmDelRef.GetBaseObject ;=> The following script will unequip the current weapon.
                        Let GSfReEquipA := Player.GetCurrentAmmo    ;=> Probably because of ammo switching.
                        Let GSfarmBasRef := GSFarmDelRef.GetWeaponAmmo
                        Let GSFarmDelRef := Player.GetFirstRefForItem GSfarmBasRef
                        if GSFarmDelRef.GetType == 41
                            ListReplaceNthForm GSfarmNoShovelRemove GSfarmBasRef Button
                            Ar_Append GSFEquipRefs, GSfarmBasRef
                            Let Button += 1
                            Let GSFRemoveC += Player.GetItemCount GSfarmBasRef
                        elseif ListGetCount GSfarmBasRef > 0
                            While GSFCheckIndex < ListGetCount GSfarmBasRef
                                Let GSFarmDelRef := ListGetNthForm GSfarmBasRef GSFCheckIndex
                                if IsFormValid GSFarmDelRef
                                    ListReplaceNthForm GSfarmNoShovelRemove GSFarmDelRef Button
                                    Ar_Append GSFHotKeyRefs, GSFarmDelRef
                                    Let Button += 1
                                    Let GSFRemoveC += Player.GetItemCount GSFarmDelRef
                                endif
                                Let GSFCheckIndex += 1
                            Loop
                        endif
                        Let GSFCheckIndex := -1    ;=> Special occurence to requip weapon and ammo.
                    endif
                endif
            Loop
        endif                ;=> Now we check what the player currently has hotkeyed and / or equipped.
        if (Player.GetItemCount GSfarmAmmoAll + Player.GetItemCount GSfarmThrowableWeaponsList + Player.GetItemCount GSfarmPlaceableExplosivesList + Player.GetItemCount GSfarmThrowableExplosivesList + Player.GetItemCount GSfarmPlaceableMinesList) == 0    
            ShowMessage GSFarmNoStorage        ;=> The lack of ammunition is disturbing!
        elseif (Player.GetItemCount GSfarmAmmoAll + Player.GetItemCount GSfarmThrowableWeaponsList + Player.GetItemCount GSfarmPlaceableExplosivesList + Player.GetItemCount GSfarmThrowableExplosivesList + Player.GetItemCount GSfarmPlaceableMinesList) <= GSFRemoveC
            if eval (Ar_Size GSFEquipRefs) > 0 && eval (Ar_Size GSFHotKeyRefs) > 0
                ShowMessage GSFarmSortBoth            ;=> Here we create specific messages.
            elseif eval (Ar_Size GSFEquipRefs) > 0
                ShowMessage GSFarmSortEquipItem    ;=> If you have an item equipped and assigned to a hotkey, only the equip message will be shown.
            elseif eval (Ar_Size GSFHotKeyRefs) > 0
                ShowMessage GSFarmSortHotkeyItem
            endif
        elseif (Player.GetItemCount GSfarmAmmoAll + Player.GetItemCount GSfarmThrowableWeaponsList + Player.GetItemCount GSfarmPlaceableExplosivesList + Player.GetItemCount GSfarmThrowableExplosivesList + Player.GetItemCount GSfarmPlaceableMinesList) > GSFRemoveC
            ShowMessage GSFarmAmmoStorageQuestion        ;=> NOW WE ARE TALKING! So you got some ammo to sort?
        endif
    endif
end

BEGIN GameMode
    if GSFCheckIndex == -2        ;=> Fixes too much ammo in one magazine.
        if player.GetAnimAction != 0        ;=> Wait until the animation is over.
            Let GSfReEquipW := Player.GetEquippedItemRef 5    ;=> This will create an inventory reference!
            if GSfReEquipW.GetWeaponClipRounds > 0        ;=> Called too early will give back negative values
                if Player.GetCurrentAmmoRounds > GSfReEquipW.GetWeaponClipRounds
                    Let GSFCheckIndex := GSfReEquipW.GetWeaponClipRounds    ;=> We only want to allowed magazine size!
                    Player.SetCurrentAmmoRounds GSFCheckIndex    ;=>9mm pistol: From 40/0 to 13/27
                    Let GSFCheckIndex := 0
                    Let GSfReEquipW := 0
                else    ;=> If too much ammo is in the mag, it will be fixed. Otherwise the fix will be turned off.
                    Let GSFCheckIndex := 0
                    Let GSfReEquipW := 0
                endif
            endif
        endif
    endif

        Let Button := GetButtonPressed

        if ( Button == 0 )
            player.RemoveAllTypedItems GSfarmAmmoST 1 0 41 GSfarmNoShovelRemove                        ;=> You know the game with the water, where you have
            player.RemoveAllTypedItems GSFarmThrowStorage 1 0 40 GSfarmNoShovelRemove                ;=> to swap water between two cans until you have a
            GSFarmThrowStorage.RemoveAllTypedItems Player 1 1 40 GSfarmThrowableWeaponsList        ;=> specific amount of water in each can?
            player.RemoveAllTypedItems GSFarmRemoteStorage 1 0 40 GSfarmNoShovelRemove            ;=> Well this is somewhat similar and similarily awful. XD
            GSFarmRemoteStorage.RemoveAllTypedItems Player 1 1 40 GSfarmPlaceableExplosivesList
            player.RemoveAllTypedItems GSFarmGrenadeStorage 1 0 40 GSfarmNoShovelRemove
            GSFarmGrenadeStorage.RemoveAllTypedItems Player 1 1 40 GSfarmThrowableExplosivesList
            player.RemoveAllTypedItems GSFarmMineStorage 1 0 40 GSfarmNoShovelRemove
            GSFarmMineStorage.RemoveAllTypedItems Player 1 1 40 GSfarmPlaceableMinesList
            ShowMessage GSFarmAmmoStorageDone
            PlaySound ITMAmmunitionDown
            if GSFHotkey1 != 0                        ;=> I really would wish I just could use "RestoreHotkeys", but I had minor issues with coming back to the
                SetHotKeyItem 1, GSFHotKey1        ;=> hotkey layout, which I got changed before I started sorting. This one works accurate, even though it takes
            endif                                            ;=> more space. :/
            if GSFHotkey3 != 0
                SetHotKeyItem 3, GSFHotKey3
            endif
            if GSFHotkey4 != 0
                SetHotKeyItem 4, GSFHotKey4
            endif
            if GSFHotkey5 != 0
                SetHotKeyItem 5, GSFHotKey5
            endif
            if GSFHotkey6 != 0
                SetHotKeyItem 6, GSFHotKey6
            endif
            if GSFHotkey7 != 0
                SetHotKeyItem 7, GSFHotKey7
            endif
            if GSFHotkey8 != 0
                SetHotKeyItem 8, GSFHotKey8
            endif
            if GSFCheckIndex == -1        ;=> Ammo and weapon will be requipped.
                Player.EquipItemAlt GSfReEquipW 0 1        ;=> We may lose our weapons during the "equipped item" sorting.
                Player.EquipItemAlt GSfReEquipA 0 1        ;=> So this will be give the player his / her gun back into the hand.
                Let  GSFCheckIndex := -2    ;=> All available ammo (full item count) will be in one mag. Like you have 40x 9mm:
            endif                                    ;=> Your pistol will show 40/0 ammo. oO Setting this to -2 will activate a fix for that issue.
            Let GSFInvRefs := Ar_Null
            Let GSFCheckRefs := Ar_Null
            Let GSFEquipRefs := Ar_Null
            Let GSFHotKeyRefs := Ar_Null
        endif

END

 

 

It sorts ammunition including placeable and throwable weapons into boxes.

Equiped items or items assigned to a hotkey get excluded. Also means for weapons with ammo.

If you have a 9mm weapon equipped or assigned to a hotkey, no applicable ammunition for that weapon will get sorted, so you don't have to worry about sorting ammunition but getting it back from the shelf, before you leave the house.

If you clear the hotkey and unequip the item, the ammo will be removed into the ammunition box.

 

However, I think an option to only sort ammunition and leave the placeable and throwable items in the inventory might be nice.

There will always be something which wants to be enhanced. oO

Link to comment
Share on other sites

  • Recently Browsing   0 members

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