Jump to content

Weapon Sorter Question


Seige911

Recommended Posts

First off let me apologize if this has already been asked before. I did a search of the forums and google and did not turn up anything useful, or anything that looked like they had come close to solving the problem.

 

So essentially what I am trying to do is move an item from a players inventory to a container via a script while still maintaining that weapons mods. I am attempting to do this without FOSE, NVSE, etc.

 

How I am currently doing things is:

 

short MyCount

 

Set MyCount to Player.GetItemCount <item_name>

Player.RemoveItem <item_name> MyCount

<container_name>.AddItem <item_name> MyCount

 

This transfers the item over no problem, however its condition is restored to 100% and it loses all modifications. I have a few ideas on how to restore the condition of the weapon, but at the moment am clueless on how to keep the modifications. Seeing how it shares the same ID, I probably cannot create a new item and remove it. Is there a way to simply move items from one container to another? Or does anyone else have any ideas on how to solve this?

 

Thanks in advance.

Link to comment
Share on other sites

Easiest way to find out about something you don't know is to look at how someone else has done it. Failing that, just browse through the list of functions and take a look at any which look like they might be relevant.

 

<br><br>EDIT: If you're after moving them one at a time? I'm not too sure but I think for scripting purposes the game's engine recognizes all items of the same base type as identical, meaning there isn't a way to pick a specific instance of an object out of an inventory (Just look at how modded weapons can stack with unmodded ones as an example), unless you isolate them one by one and test: EG, equip item, then use NVSE/FOSE functions to determine the equipped weapon's health (if possible, mods), then creating a new instance with the same attributes and delete the old one.

Edited by Skevitj
Link to comment
Share on other sites

As far as trying to find someone else who has done it, I have so far not found anything, I have also tried looking at the functions and seeing if any look relevant. So far nothing. Hence why I am posting here as I found a few posts of other people attempting to do the same thing, however, no real answer. As far as using NVSE/FOSE... I am actually trying to NOT use them so looking at those functions would be a bit useless to me. Guess I will do a bit more digging or just say screw it and put a weapon mod container that respawns all mods next to the display case.
Link to comment
Share on other sites

As far as I know, moving items around in containers without losing condition/mods can't be done (easily) without NVSE. Most of the houses with built in sorters use NVSE, and if they don't, it disables the sorting features. The reason is that sorting of any kind requires loops, and loops can't be made without the script extender.

 

If you're looking to add a sorting feature to a house, I'd suggest taking a look at Sortomatic. It allows you to add sorters and displays, with no need to code a single thing. It handles modded weapons, as well as all inventory items and is pretty much cross mod compatible. It uses NVSE, but....really, the benefits outweigh any potential downsides (imo at least).

Link to comment
Share on other sites

Ahh thanks, guess I will revert to my poor mans way of doing things. I just have a dislike of having to install a mod that apparently does nothing in-order to install other mods which do. Maybe I will change my tune after the last FONV dlc comes out.
Link to comment
Share on other sites

Well, if you want an example of what it does, just go check out one of the houses I've made. They're linked on the Sortomatic page. I swear by this mod (though it does have a couple issues related to the engine). But yeah, only other real option is the way you said to do it.
Link to comment
Share on other sites

They aren't that hard to find... Pretty much all the houses these days include automatic sorters, the majority using the types function I linked (which is actually a standard one, not using NVSE)

A function included in the GECK Version 1.1.0.262 for Fallout: New Vegas.
Most of the house mods which use it use it in combination with NVSE functions since it allows you to streamline the process, but it is possible to do without NVSE. A few of the older ones used the FOSE loop functions, but they are rarely needed now due to some of the additional functions available in the NV GECK.

 

From what you've said, I've got the feeling you're completely missunderstanding what NVSE does...

a mod that apparently does nothing
The script extenders (apart from not being a mod) adds a huge number of script functions to complement the already existing ones, not replacing or editing. To say it does nothing is exactly like saying a keyboard does nothing that a mouse can't already do. It allows the manipulation of a significant number of things which the standard functions don't allow interaction with.
Link to comment
Share on other sites

I understand what NVSE does. It alone appears to add no functionality (at least to the player playing the game.. not so much to the modder.), it is not till other modders take advantage of the additional functions and hooks that it actually becomes useful. Your keyboard mouse metaphor only semi fits... I view NVSE more like a USB port on a computer. Alone a USB on a computer affords the user anything of real use (unless they decide to use it as a five volt power source), it is not till the addition of other USB compliant peripheral (like mouse, keyboard, hard drive), does it have any real value of to the user.

 

My main reason for not using it at this time is every time a new patch is released it breaks it.. along with the GECK. While I do realize it does tend to be released quickly after a patch, I would rather not have to deal with the hassle of waiting. Combined that with it still being in beta, and you get hesitation on my part. While I am sure it is great and everything I am wanting both it and FONV to stabilize a bit before I start adding additional points of failure.

 

Anyway, thanks everyone for answering my question. Thinking this thread can be closed now as I foresee any additional comments being on NVSE and why to use it... unless someone knows how to implement the topics sorting question using NVSE and is willing to post it.. that might be helpful for others.

Link to comment
Share on other sites

Skevitj posted a link to the vanilla function that you'll need to use to do the 'clean' moving of weapons or armour.

If you only want to remove a single type (all instances of them) then you need NVSE to create the exception list.

 

 

 

Create an empty FormList object 'YourTempFL'

 

ref rDestCont ; set this to the ref of your destination container
ref rObj ;temp object
int iIdx ;list index

;loop over the player inventory adding items to the temp formlist, except the target weapon
set iIdx to player.GetNumItems
Label 1
if iIdx
 set iIdx to iIdx - 1
 set rObj to player.GetInventoryObject iIdx
 if rObj != YourTargetWeapon
   ListAddForm YourTempFL rObj
 endif
 Goto 1
endif

player.RemoveAllTypedItems rDestCont 1 1 40 YourTempFL

;Empty the Temp formlist
Label 1
if ListGetCount YourTempFL
 ListRemoveNth YourTempFL 0
 Goto 1
endif

 

 

Yep, as you say NVSE is in Beta, in that there *may* be some bugs.

The support is outstanding though. Any reported bugs are normally squashed within a couple of days.

Contrast and compare that with the game we're all modding, and 'Beta' doesn't sound scary anymore :)

Link to comment
Share on other sites

The way you'd move item types without NVSE is to use the RemoveAllTypedItems command. Basically, you have to do it on an exclusion basis:

 

Player.RemoveAllTypedItems TempContainer 1 1 TypeCode 
TempContainer.RemoveAllITypedtems Player 1 1 TypeCode ExclusionList

That will remove all items of type corresponding to TypeCode and included in the ExclusionList form list, placing them in TempContainer in exactly the same form/condition/mods as they were in the PC's inventory.

 

You're moving the items from one inventory to another, leaving behind the ones you're interested in with every move, preserving mods/health and other statistics. As has been stated though, this will only consider objects with a different base object to be unique, even though it still preserves different objects of the same base. Getting around that isn't do-able unless using a script extender.

 

The main reason the mods using this method require NVSE is that they use it in conjunction with NVSE's form list manipulation functions, which allow a lot of flexibility, but all that is unnecessary for simpler tasks. It depends on exactly what you're trying to accomplish with the movements, as to how it would be achieved.

Edited by Skevitj
Link to comment
Share on other sites

  • Recently Browsing   0 members

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