KnightPhoenix7 Posted November 7, 2010 Share Posted November 7, 2010 I have more questions on sorting items using scripts. Here is the basic text: int Number set Number to player.getitemcount WeapNVCleaverplayer.removeitem WeapNVCleaver NumberABMeleeWeapons2.additem WeapNVCleaver Number Number is a variable storing the amount of items the player has. WeapNVCleaver is the editor ID of the Weapon and ABMeleeWeapons2 is the Reference Editor ID of the storage container. What I want to know is how to sort items and save the current item damage level. It would be handy to be able to remove the item from the player and move it to a locker instead of creating a new item at the destination. I also ran into the problem using this method that weapons with mods on them lose those mods. I was wondering if anybody has a solution to this. Link to comment Share on other sites More sharing options...
Deleted1744345User Posted November 7, 2010 Share Posted November 7, 2010 Here's a sample of script I'm using for my house mod.scn WeaponSorterScript Short WeapHealthFloat weaphealthF Float TimerA short ButtonShort Count Begin OnActivateSet Button to 1If WeaphealthF == 0ShowMessage WeaponSortingMsgSet WeaphealthF to 1EndifSet TimerA To .1END Begin GameMode If Player.getitemcount Weap10mmPistol >=1If button == 1DisablePlayerControls 1 1 1 1 0 1 1Player.equipitem Weap10mmPistol 0 1if TimerA > 0set TimerA to TimerA - getSecondsPassedelseSet weaphealth to player.getweaponhealthpercSet weaphealthF to (weaphealth*0.01)Player.removeitem Weap10mmPistol 1 1WeaponStorageREF.AddItemHealthPercent Weap10mmPistol 1 weaphealthFset TimerA to .1endifendifelseSet Button to 0EnablePlayerControlsendifEND This displays a message, then disables player controls while items are put into the container marked WeaponStorageREF, then reenables player controls when done. This solves the problem of weapon health, but not mods. Take note that this will not work for armor, and I don't know a solution to that. You should use this script on something like an activator and not a conatiner itself. Hopefully this helps you. Link to comment Share on other sites More sharing options...
gsmanners Posted November 7, 2010 Share Posted November 7, 2010 You could also try removeallitems into a container, then move the non-weapon/armor objects back to the player. Link to comment Share on other sites More sharing options...
avianrave Posted November 16, 2010 Share Posted November 16, 2010 Heres how I did weapon sorting (Took me only a few minutes once I figured it out) First, you need to make a Formlist with every weapon you don't want sorted. To do this, under the Item tap, just highlight weapons with no filter and add everything. Then go through the list and take out what you want sorted (The list is an exclusion list) Then, for the actual sorting script, use the RemoveAllTypedItems Mine is something likeplayer.RemoveAllTypedItems GSWeaponLocker11 1 0 40 GSArmoryLocker11LIST What this will do is remove all items no in the list. This will cause some problems with mods, as those items also get sorted in any list. To work around this, you need another container (can be disabled/out of site). You also need create a Form List with every single weapon in it, and then script it to sort to this container first. Then, if you want, at the end of the sorting script, you could add another script to move all items from the first container (the temp storage for guns from mods) back to the player. So in the end, my script looks something like this... player.RemoveAllTypedItems GSWeaponLocker16 1 0 40 GSArmoryLocker16LIST (Custom Weapons)player.RemoveAllTypedItems GSWeaponLocker11 1 0 40 GSArmoryLocker11LIST (Guns)player.RemoveAllTypedItems GSWeaponLocker12 1 0 40 GSArmoryLocker12LIST (Energy Weapons)player.RemoveAllTypedItems GSWeaponLocker13 1 0 40 GSArmoryLocker13LIST (Explosive Weapons)player.RemoveAllTypedItems GSWeaponLocker14 1 0 40 GSArmoryLocker14LIST (Melee Weapons)player.RemoveAllTypedItems GSWeaponLocker15 1 0 40 GSArmoryLocker15LIST (Throwing Weapons)GSWeaponLocker16.RemoveAllItems Player (Optional: not in my armory script {I use it for food/drink sorting however}, but it will return anything not sorted to the player) Link to comment Share on other sites More sharing options...
Dwight Darkmoon Posted November 24, 2010 Share Posted November 24, 2010 I know this post is a bit old but i would like to thank Avianrave for sharing his script. Kudos! I am new to scripting and i have a lot to learn. I did understand everything but one thing. Like here: player.RemoveAllTypedItems GSWeaponLocker16 1 0 40 GSArmoryLocker16LIST (Custom Weapons). What are the 1 0 40 for? Link to comment Share on other sites More sharing options...
Recommended Posts