404exe Posted January 23 Posted January 23 Hello, I am new to this and currently trying to change values of items. So, for example, I got this: getScriptManager():getItem("Mace"):DoParam("ConditionMax=40") Obviously this changes ConditionMax only from the Item Mace to 40. This works. But I don't want to change every single item manually, so I got this: local VARConditionMax = item:getConditionMax() item:setConditionMax(VARConditionMax * 2) This gets the ConditionMax from the Item and multiplies it by 2. This also works. Now, since the Mace also has HeadCondition, this will result in the Mace having doubled ConditionMax but only "half" HeadCondition, since HeadCondition wasn't changed. So, I got this: local VARConditionMax = item:getConditionMax() item:setConditionMax(VARConditionMax * 2) local VARHeadCondition = item:getHeadCondition() if VARHeadCondition > 0 then item:setHeadCondition(VARHeadCondition * 2) end But now, I get the following error: Quote Object tried to call nil in ChangeWeapons The error line is: local VARHeadCondition = item:getHeadCondition() My question now is: Why can I get ConditionMax and change it, but when I try to get HeadCondition, it results in an error?
Hugo Qwerty Posted January 24 Posted January 24 On 1/23/2025 at 8:09 AM, 404exe said: My question now is: Why can I get ConditionMax and change it, but when I try to get HeadCondition, it results in an error? getConditionMax() & getHeadCondition() exist in Inventory Item, but getHeadCondition() does not exist on the Item object. Java Docs (unofficial) https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/inventory/InventoryItem.html https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/scripting/objects/Item.html Someone on Chuck's modding Discord might know how to get around this. https://discord.com/invite/SReMnbV4V7 404exe 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now