Jump to content
Maris

How to save item changes?

Recommended Posts

If I change icon:

item:setTexture(new_icon);

everything is fine but after reloading the game there is old icon.

 

 

If I change weight:

item:setWeight(0.5);
item:setActualWeight(0.5);

everything is fine but after reloading the game there is old weight.

Share this post


Link to post
Share on other sites

try this

local function test()
  local item = getScriptManager():getItem("Base.Axe")
  item:setWeight(0.5)
  item:setActualWeight(0.5)
  item:setTexture(icon);
end

Events.OnPreMapLoad.Add(test)

not tested it, i think it should work

Share this post


Link to post
Share on other sites

Oh, thanks, but I meant changes to exact single separate item in inventory.

Your code affects ALL (new) items in the world.

 

Btw I found a way to save weight:

item:setActualWeight(0.33)
item:setCustomWeight(true)

But I still can't save custom changed icon of vanilla item (not custom item from my mod).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...