Jump to content

Mass Setting item weight property to 0


ShuiYin

Recommended Posts

Hi i have modified some game items in game by creating txt files inside the scripts folder containing all the items that i need to change the weight to 0. This method i think is cumbersome and i am trying to avoid rewriting the whole item properties since in the future more properties might get added in and so my mod will break some of the items functionality.

 

this is the way i currently change its weight

 

[code]

 

item Bullets9mm
    {
        Count            =    10,
        Weight            =    0,
        Type            =    Normal,
        DisplayCategory     =     Ammo,
        DisplayName        =    9mm Rounds,
        Icon            =    40calAmmoBox,
    }

    item ShotgunShells
    {
        Count            =    12,
        Weight            =    0,
        AlwaysWelcomeGift    =    TRUE,
        Type            =    Normal,
        DisplayCategory     =     Ammo,
        DisplayName        =    Shotgun Shells,
        Icon            =    ShotgunAmmo,
    }

    item 223Bullets
        {
            Count            =    20,
            Weight            =    0,
            AlwaysWelcomeGift    =    TRUE,
            Type            =    Normal,
            DisplayName        =    .223 Ammo,
            DisplayCategory     =     Ammo,
            Icon            =    RifleAmmo223loose,
        }

        item 308Bullets
        {
            Count            =    20,
            Weight            =    0,
            AlwaysWelcomeGift    =    TRUE,
            Type            =    Normal,
            DisplayName        =    .308 Ammo,
            DisplayCategory     =     Ammo,
            Icon            =    RifleAmmo308loose,
        }

    item BulletsBox
        {
            Weight            =    0,
            Type            =    Normal,
            DisplayName        =    Box of 9mm Bullets,
            DisplayCategory     =     Ammo,
            Icon            =    HandgunAmmoBox,
        }

        item ShotgunShellsBox
        {
            Weight            =    0,
            Type            =    Normal,
            DisplayName        =    Box of Shotgun Shells,
            DisplayCategory     =     Ammo,
            Icon            =    ShotgunAmmoBox,
        }
    
    item 223Box
        {
            Weight            =    0,
            AlwaysWelcomeGift    =    TRUE,
            Type            =    Normal,
            DisplayName        =    Box of .223 Bullets,
            DisplayCategory     =     Ammo,
            Icon            =    RifleAmmo223,
        }

        item 308Box
        {
            Weight            =    0,
            AlwaysWelcomeGift    =    TRUE,
            Type            =    Normal,
            DisplayName        =    Box of .308 Bullets,
            DisplayCategory     =     Ammo,
            Icon            =    RifleAmmo308,
        }

 

[/code]

 

i was thinking like looping through all item list and setting the weight parameter to 0 if it conforms to a list of items eg. shotgun shells and other ammo types, seed packets and even garbage bags. this way i will only modify its weight value and keep all the other parameters and have lower risk of causing errors. is there a way to do this? im really new at this modding business and the only programming experience is making excel macros in VBA. i hope someone can share some wisdom or maybe dish out a short example code :P thx

Link to comment
Share on other sites

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

	if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end
Link to comment
Share on other sites

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end

Hi mr Ethan i actually used your cheat Menu mod but this mod was for tweaking base game to make playing this game more enjoyable (personal preference) i was reducing all ammo weight to 0 and also all seed packets too. I also to plan to modify the item chance of condition drop for certain items like shotgun, shovel, axe, hand gun, rifles to really high level so that i wont need to find new ones (all metal based item basically are almost indestructible). Planks and baseball bats still fragile tho. I am also modding some of the delta of items to be a lot more. But i do not want to overwrite the stuff, instead i just want to set the value weight (or any other value that i want to change) and keep all other perimeters unchanged.

Link to comment
Share on other sites

 

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end

Hi mr Ethan i actually used your cheat Menu mod but this mod was for tweaking base game to make playing this game more enjoyable (personal preference) i was reducing all ammo weight to 0 and also all seed packets too. I also to plan to modify the item chance of condition drop for certain items like shotgun, shovel, axe, hand gun, rifles to really high level so that i wont need to find new ones (all metal based item basically are almost indestructible). Planks and baseball bats still fragile tho. I am also modding some of the delta of items to be a lot more. But i do not want to overwrite the stuff, instead i just want to set the value weight (or any other value that i want to change) and keep all other perimeters unchanged.

 

Hmm...

 

AFAIK the game reloads item values on load, so I don't think that the code section would work. I'll do some more testing alongside developing Cheat Menu V2.3.

Link to comment
Share on other sites

  • 2 weeks later...

 

 

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end

Hi mr Ethan i actually used your cheat Menu mod but this mod was for tweaking base game to make playing this game more enjoyable (personal preference) i was reducing all ammo weight to 0 and also all seed packets too. I also to plan to modify the item chance of condition drop for certain items like shotgun, shovel, axe, hand gun, rifles to really high level so that i wont need to find new ones (all metal based item basically are almost indestructible). Planks and baseball bats still fragile tho. I am also modding some of the delta of items to be a lot more. But i do not want to overwrite the stuff, instead i just want to set the value weight (or any other value that i want to change) and keep all other perimeters unchanged.

 

Hmm...

 

AFAIK the game reloads item values on load, so I don't think that the code section would work. I'll do some more testing alongside developing Cheat Menu V2.3.

 

 

in this example the modification of weight applies to items that i carry. i was thinking along the line of:

 

Loop all items from module base

 

if the said item category = Ammo then set weight to 0

 

if not then continue loop till end.

 

something like that (sorry my programming level is very low Lol ) btw thx mr Ethan for taking the time to give a solution.

Link to comment
Share on other sites

 

 

 

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end

Hi mr Ethan i actually used your cheat Menu mod but this mod was for tweaking base game to make playing this game more enjoyable (personal preference) i was reducing all ammo weight to 0 and also all seed packets too. I also to plan to modify the item chance of condition drop for certain items like shotgun, shovel, axe, hand gun, rifles to really high level so that i wont need to find new ones (all metal based item basically are almost indestructible). Planks and baseball bats still fragile tho. I am also modding some of the delta of items to be a lot more. But i do not want to overwrite the stuff, instead i just want to set the value weight (or any other value that i want to change) and keep all other perimeters unchanged.

 

Hmm...

 

AFAIK the game reloads item values on load, so I don't think that the code section would work. I'll do some more testing alongside developing Cheat Menu V2.3.

 

 

in this example the modification of weight applies to items that i carry. i was thinking along the line of:

 

Loop all items from module base

 

if the said item category = Ammo then set weight to 0

 

if not then continue loop till end.

 

something like that (sorry my programming level is very low Lol ) btw thx mr Ethan for taking the time to give a solution.

 

That could definitely work, but the problem is that if you drop a weight modified item on the ground the mod can't detect it and reset the weight.

 

If you don't mind the drawback, I'll scribble something up for you once I'm out of school.

Link to comment
Share on other sites

 

 

 

 

Not too sure about weight for items in bags, but I do have a beta of an infinite carryweight method intended for Cheat Menu.

Also, just curious, are you trying to have infinite carryweight for the player, or are you doing something different? I have two methods here: a programmed one and an item with negative weight.

 

Here's the programmed one:

if CheatCoreCM.ItemWeightTable == nil then -- this was a beta. It was scrapped in favor for an item with -99999 weight to prevent issues with dropping, but it's still fully functional (despite there being no trigger, as I do that after the initial testing phase)		CheatCoreCM.ItemWeightTable = {}	end		local inv = getPlayer():getInventory()	local invItems = inv:getItems()		for i = 0, invItems:size() -1 do		local item = invItems:get(i)		if CheatCoreCM.ItemWeightTable[item:getDisplayName()] == nil then			CheatCoreCM.ItemWeightTable[item:getDisplayName()] = item:getActualWeight()		end		item:setActualWeight(0)	end	local inv = getPlayer():getInventory()	local invItems = inv:getItems()	for k,v in pairs(CheatCoreCM.ItemWeightTable) do		for i = 0, invItems:size() -1 do			local item = invItems:get(i)			if item:getDisplayName() == k then				item:setActualWeight(v)			end		end	end

Hi mr Ethan i actually used your cheat Menu mod but this mod was for tweaking base game to make playing this game more enjoyable (personal preference) i was reducing all ammo weight to 0 and also all seed packets too. I also to plan to modify the item chance of condition drop for certain items like shotgun, shovel, axe, hand gun, rifles to really high level so that i wont need to find new ones (all metal based item basically are almost indestructible). Planks and baseball bats still fragile tho. I am also modding some of the delta of items to be a lot more. But i do not want to overwrite the stuff, instead i just want to set the value weight (or any other value that i want to change) and keep all other perimeters unchanged.

 

Hmm...

 

AFAIK the game reloads item values on load, so I don't think that the code section would work. I'll do some more testing alongside developing Cheat Menu V2.3.

 

 

in this example the modification of weight applies to items that i carry. i was thinking along the line of:

 

Loop all items from module base

 

if the said item category = Ammo then set weight to 0

 

if not then continue loop till end.

 

something like that (sorry my programming level is very low Lol ) btw thx mr Ethan for taking the time to give a solution.

 

That could definitely work, but the problem is that if you drop a weight modified item on the ground the mod can't detect it and reset the weight.

 

If you don't mind the drawback, I'll scribble something up for you once I'm out of school.

 

 

wouldnt running the script on start of game replace the weight values until exiting the game?.

 

for example if i were to set all ammo weight to 0 after the game initially loads wouldnt it make the ammo weight drop to 0 for the remaining of the game session? even if i drop it would it not retain the 0 value since its edited from the main table and not just the ones im holding?

 

Thx again

ShuiYin

Link to comment
Share on other sites

  • 3 weeks later...

did i understand this thread right? you are asking for some automatic way to write all the weight to 0 without having to edit them one by one?

 

if yes i have a solution for you.

Yes basically but limiting it to a certain item type so eq. all ammo type weight reduce to 0,

Link to comment
Share on other sites

you can do that with notepad++

 

1) let's say you want to change the weight of all items, not just ammo

 

you would need to "search" for lines that contain the word "weight", and use "regular expression" instead of "normal" in the search window.

 

you need to search for ".*weight.*"

 

.* stands for anything, so basically with this, you are searching for lines that have "weight" in it, plus everything that comes before the word and after the word.

 

and then replace it with whatever you need, in this case "weight = 0,"

 

2) now that you only want to edit ammo type, for this, you will need to record a macro in notepad++

 

start at the top of the txt file, start recording, searching for "ammo", and then search for "weight" that comes before the "ammo" you just searched, replace it with whatever you need, end the recording there, and tell notepad++ to repeat those steps, and keep an eye on what it's doing.

 

it can be a problem if some item's lines are not always in the same order, like if this item has the ammo line after the weight line, and the next item has the weight line after the ammo line, thats gonna cause you some work.

Link to comment
Share on other sites

you can do that with notepad++

 

1) let's say you want to change the weight of all items, not just ammo

 

you would need to "search" for lines that contain the word "weight", and use "regular expression" instead of "normal" in the search window.

 

you need to search for ".*weight.*"

 

.* stands for anything, so basically with this, you are searching for lines that have "weight" in it, plus everything that comes before the word and after the word.

 

and then replace it with whatever you need, in this case "weight = 0,"

 

2) now that you only want to edit ammo type, for this, you will need to record a macro in notepad++

 

start at the top of the txt file, start recording, searching for "ammo", and then search for "weight" that comes before the "ammo" you just searched, replace it with whatever you need, end the recording there, and tell notepad++ to repeat those steps, and keep an eye on what it's doing.

 

it can be a problem if some item's lines are not always in the same order, like if this item has the ammo line after the weight line, and the next item has the weight line after the ammo line, thats gonna cause you some work.

 

Yea notepad++ is a nice freeware that i use. but i was avoiding using txt in scripts folder if i can help it. so my mod wont clash with other mods i was more into using the lua and tapping on the java thing. thx for tryng to help mr Lazy Joe :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...