Jump to content

Breezy Vest+Backpack = is it possible?


Recommended Posts

Hello there!
So i was thinking about making a character and some items for him,i got all the character stats ect. done and now i was wondering about giving him a starting item wich would be something like a hoodie that works like a breezy vest combined with the backpack and was asking myself if it's possible to do that?
I am fairly new to modding but i can understand a little bit of the LUA language tho it's still hard for me to understand some stuff.
I've tried to look up the breezy vest file but i think i ended up finding the same file for both Summer and Winter vest,so in the end i found myself really confused to what to do and ended up making this post to ask if its possible and if someone maybe already tried to make an item/weareable of this kind?
I would really appreciate anyone's help!
Thank you!

Link to comment
Share on other sites

It is possible to make a breezy vest n backpack combination but in dst theres a problem with cave servers running along side. The breezy vest summer and winter only difference is insulation amount n looks. For the backpack it hasnt been done where they work along side cave servers. If you copy and paste the code that makes the widgets it works for noncave server games. Ive searched around large mods, forums, asked a few modders and such but theres no getting around the error in cave servers.

Link to comment
Share on other sites

12 hours ago, K1NGT1GER609 said:

It is possible to make a breezy vest n backpack combination but in dst theres a problem with cave servers running along side. The breezy vest summer and winter only difference is insulation amount n looks. For the backpack it hasnt been done where they work along side cave servers. If you copy and paste the code that makes the widgets it works for noncave server games. Ive searched around large mods, forums, asked a few modders and such but theres no getting around the error in cave servers.

Well,i'm surely not going to have anything to do with caves in DST so it should be alright.
Do you think it would work by just putting the 2 files together and it would just work like that or i would need to write out the additional coding for the backpack so it would give the insulation of the summer vest?

Link to comment
Share on other sites

Technically yes, I mean theres not much to get out of the summer vest besides a few lines of code (unless your going for durability on use) and the backpack is the only one that needs more work in terms placing the code to use. I don't think there's much need for additional code that isn't in those files.

Link to comment
Share on other sites

6 hours ago, K1NGT1GER609 said:

Technically yes, I mean theres not much to get out of the summer vest besides a few lines of code (unless your going for durability on use) and the backpack is the only one that needs more work in terms placing the code to use. I don't think there's much need for additional code that isn't in those files.

I'm not thinking of giving any durability on it since it could get buggy with the fact that it would store items inside so the items that are stored would just disappear or crash the server so it would be just an only character thing like Willow's lighter back in the old day.
Anyway thanks a lot for helping me with my doubts!
I'll write you if i can get it to work or anything! <3

Link to comment
Share on other sites

23 hours ago, K1NGT1GER609 said:

Technically yes, I mean theres not much to get out of the summer vest besides a few lines of code (unless your going for durability on use) and the backpack is the only one that needs more work in terms placing the code to use. I don't think there's much need for additional code that isn't in those files.

So i tried to get the script of the trunkvest and the backpack together and i got this error message.
Do you know what it could mean?
b7e792b21c.png

Edit: i changed up some stuff by taking some coding from the DS version wich changed the error
035f1f9bf6.png

Edit 2: Now i dont get any crash logs but the game itself crashes now on startup (because i set the item to be given to me as soon as i load the world)

Edited by WaffleKat
Link to comment
Share on other sites

eof means "end of function", usually you miss an "end" or a comma somewhere.

i don't know about the second error.

Why not creating a custom item, using backpack code as a base but adding a line for insulation ?

Link to comment
Share on other sites

15 minutes ago, Lumina said:

eof means "end of function", usually you miss an "end" or a comma somewhere.

i don't know about the second error.

Why not creating a custom item, using backpack code as a base but adding a line for insulation ?

infact the base code is the backpack and i just looked up the trunkvest code and added the insulation and now my crash log.txt says this

[00:00:38]: ..\source\animlib\animmanager.cpp(521) :: Tried to add build [backpack] from file [anim/backpack.zip] but we've already added a build with that name!

Link to comment
Share on other sites

1 minute ago, WaffleKat said:

[00:00:38]: ..\source\animlib\animmanager.cpp(521) :: Tried to add build [backpack] from file [anim/backpack.zip] but we've already added a build with that name!

Don't copy the anim file if you don't add anything new. If you don't change the build, no need to copy it. If you change the tex file and have a custom build, you need to rename the build (search the build renamer tool)

Link to comment
Share on other sites

10 minutes ago, Lumina said:

Don't copy the anim file if you don't add anything new. If you don't change the build, no need to copy it. If you change the tex file and have a custom build, you need to rename the build (search the build renamer tool)

So i should create a new .tex file in the anim folders?

Link to comment
Share on other sites

3 minutes ago, WaffleKat said:

So i should create a new .tex file in the anim folders?

For the moment i would just suggest to use the basic backpack anim the time to make everything work as you want. So be sure you don't copy the "backpack" anim (because you don't need it at the moment).

Later, when everything else will work, you could create a custom .tex file (and you'll need a renamed build.bin too), but only when the others parts of the mod are working, so it's easier to know what is going wrong.

Link to comment
Share on other sites

41 minutes ago, Lumina said:

For the moment i would just suggest to use the basic backpack anim the time to make everything work as you want. So be sure you don't copy the "backpack" anim (because you don't need it at the moment).

Later, when everything else will work, you could create a custom .tex file (and you'll need a renamed build.bin too), but only when the others parts of the mod are working, so it's easier to know what is going wrong.

but where can i get the basic backpack anim without copying the backpack anim from DST data folder?

 

Link to comment
Share on other sites

1 minute ago, WaffleKat said:

but where can i get the basic backpack anim without copying the backpack anim from DST data folder?

You have theses lines in your prefab yourcustombackpack.lua :

local assets =
{
    Asset("ANIM", "anim/backpack.zip"),
    Asset("ANIM", "anim/swap_backpack.zip"),
    Asset("ANIM", "anim/ui_backpack_2x4.zip"),
}

    inst.AnimState:SetBank("backpack1")
    inst.AnimState:SetBuild("swap_backpack")
    inst.AnimState:PlayAnimation("anim")

You just need this, if you don't change the anim. You don't need anything else for the moment.

The file already exist in the game, so you just need to tell the game "i will use this file" (it's the purpose of theses lines), and it will do it.

 

At this moment, this crash happens because you have two builds with the same name (the game's one and your copy) and it create a conflict. But this is the proof that you don't need to copy it, it already exists.

Link to comment
Share on other sites

15 minutes ago, Lumina said:

You have theses lines in your prefab yourcustombackpack.lua :


local assets =
{
    Asset("ANIM", "anim/backpack.zip"),
    Asset("ANIM", "anim/swap_backpack.zip"),
    Asset("ANIM", "anim/ui_backpack_2x4.zip"),
}

    inst.AnimState:SetBank("backpack1")
    inst.AnimState:SetBuild("swap_backpack")
    inst.AnimState:PlayAnimation("anim")

You just need this, if you don't change the anim. You don't need anything else for the moment.

The file already exist in the game, so you just need to tell the game "i will use this file" (it's the purpose of theses lines), and it will do it.

 

At this moment, this crash happens because you have two builds with the same name (the game's one and your copy) and it create a conflict. But this is the proof that you don't need to copy it, it already exists.

I've done like you said and when i spawn in the item does not have any kind of texture and when i put it on the game crashes
afc0391849.png

Link to comment
Share on other sites

I'm sorry but i would not be able to help about the "learn mistake" part, because i'm not skilled enough to know what is wrong.

What i did is using a clean "backpack" code, because i wasn't sure about what was wrong in some part of your code. Also, i used a code for custom widget, don't know if it's really necessary but it was the only error i got and i don't know how to fix it. Good part is that you could customize your hoodie this way (number of slot or filtering item going into it, for example).

Some errors i saw :

 


local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "swap_hoodie", "hoodie")
    owner.AnimState:OverrideSymbol("swap_body", "swap_hoodie", "swap_body")
    owner.components.inventory:SetOverflow(inst)
    inst.components.container:Open(owner)
    
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    owner.AnimState:ClearOverrideSymbol("hoodie")
    owner.components.inventory:SetOverflow(nil)
    inst.components.container:Close(owner)
end

This is the reason why the item was invisible. You tried to use custom build when not having custom build, instead of basic build. So invisible item on ground.

 


    inst:AddTag("hoodie")

I would suggest to not replace the backpack tag, but instead add your own.

 


    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.cangoincontainer = true

This line is dangerous. "cangoincontainer" define if an item could go in a chest or not. It could possibly create bug to make it on "true".


    inst:AddComponent("container")
	inst:AddComponent("insulator")
    inst.components.container:WidgetSetup("hoodie")
	inst.components.insulator:SetInsulation( TUNING.INSULATION_SMALL )

This couldn't work without a code to define somewhere a widget setup for "hoodie", just replacing name isn't enough, the game need to know what setup to use (number of slot, position of slot, ...)

 

So here is my try :

hoodie.zip

 

It should work, it's working without crash for the moment for me. Do test to verify the insulation is working properly (seems to be the case, but i didn't do a lot of testing), ajust the prefab to what you want (like adding a dapperness component, i didn't put it in my version).

Item is invisible in inventory, it's normal, you need to create your own inventory image. Item doesn't have name, recipe, description, recipe description, it's normal, you have to add your own.

And now you could make your own .tex file (copy the backpack anim.zip file, delete the anim (you'll don't need it, it already exist)), rename the build of the copy in whatever you want (hoodie i guess), and modify the .tex file. Then replace the build accordingly (but keep the bank the same)

Edited by Lumina
Link to comment
Share on other sites

On 05/07/2017 at 7:22 AM, K1NGT1GER609 said:

Ive searched around large mods, forums, asked a few modders and such but theres no getting around the error in cave servers.

The code i'm using for widget seems to works fine with caves, it's not my code (someone else in the forum gave it to me), maybe you could look at it to see how it works ?
Also, it should be compatible with others containers mods (as far as i tested it, but i could be wrong)

Link to comment
Share on other sites

41 minutes ago, Lumina said:

I'm sorry but i would not be able to help about the "learn mistake" part, because i'm not skilled enough to know what is wrong.

What i did is using a clean "backpack" code, because i wasn't sure about what was wrong in some part of your code. Also, i used a code for custom widget, don't know if it's really necessary but it was the only error i got and i don't know how to fix it. Good part is that you could customize your hoodie this way (number of slot or filtering item going into it, for example).

Some errors i saw :

 



local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "swap_hoodie", "hoodie")
    owner.AnimState:OverrideSymbol("swap_body", "swap_hoodie", "swap_body")
    owner.components.inventory:SetOverflow(inst)
    inst.components.container:Open(owner)
    
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    owner.AnimState:ClearOverrideSymbol("hoodie")
    owner.components.inventory:SetOverflow(nil)
    inst.components.container:Close(owner)
end

This is the reason why the item was invisible. You tried to use custom build when not having custom build, instead of basic build. So invisible item on ground.

 



    inst:AddTag("hoodie")

I would suggest to not replace the backpack tag, but instead add your own.

 



    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.cangoincontainer = true

This line is dangerous. "cangoincontainer" define if an item could go in a chest or not. It could possibly create bug to make it on "true".



    inst:AddComponent("container")
	inst:AddComponent("insulator")
    inst.components.container:WidgetSetup("hoodie")
	inst.components.insulator:SetInsulation( TUNING.INSULATION_SMALL )

This couldn't work without a code to define somewhere a widget setup for "hoodie", just replacing name isn't enough, the game need to know what setup to use (number of slot, position of slot, ...)

 

So here is my try :

hoodie.zip

 

It should work, it's working without crash for the moment for me. Do test to verify the insulation is working properly (seems to be the case, but i didn't do a lot of testing), ajust the prefab to what you want (like adding a dapperness component, i didn't put it in my version).

Item is invisible in inventory, it's normal, you need to create your own inventory image. Item doesn't have name, recipe, description, recipe description, it's normal, you have to add your own.

And now you could make your own .tex file (copy the backpack anim.zip file, delete the anim (you'll don't need it, it already exist)), rename the build of the copy in whatever you want (hoodie i guess), and modify the .tex file. Then replace the build accordingly (but keep the bank the same)

So everything works all right,just had to change the insulation from small to large.Other than that now i would need to get this item in the same folder as my character and hope it will work still. And see if i can get my character to start out with this item since i dont want it to be craftable. And in the end i will make the art and textures for everything.
Thank you so much for looking at my mistakes in my mod!!

Link to comment
Share on other sites

1 hour ago, Lumina said:

The code i'm using for widget seems to works fine with caves, it's not my code (someone else in the forum gave it to me), maybe you could look at it to see how it works ?
Also, it should be compatible with others containers mods (as far as i tested it, but i could be wrong)

Id be interested in that offer.

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
 Share

×
  • Create New...