KirbyJParasol Posted August 30, 2017 Share Posted August 30, 2017 I've been working on stabilizing a long-abandoned mod for some time now. The progress is slow but steady, and I've finally got the hat to a point where it works for the host. HOWEVER, if I put it on the ground and another player sees it, or I put it in a chest and another player opens it, said players' games immediately crash. Any tips for what's going on? Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/ Share on other sites More sharing options...
Lumina Posted August 30, 2017 Share Posted August 30, 2017 Probably something missing about separating component for server side, or something like this : if not TheWorld.ismastersim then return inst end Post the code of the hat and attach the mod. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949038 Share on other sites More sharing options...
KirbyJParasol Posted August 30, 2017 Author Share Posted August 30, 2017 local assets= { Asset("ANIM", "anim/hat_ushanka.zip"), Asset("IMAGE", "images/inventoryimages/hat_ushanka.tex"), Asset("ATLAS", "images/inventoryimages/hat_ushanka.xml") } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "hat_ushanka", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HEAD_HAT") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") end if inst.components.fueled then inst.components.fueled:StartConsuming() end end local function onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HEAD_HAT") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAT") end if inst.components.fueled then inst.components.fueled:StopConsuming() end end local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst:AddTag("hat") anim:SetBank("strawhat") anim:SetBuild("hat_ushanka") anim:PlayAnimation("anim") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "hat_ushanka" inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_ushanka.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED inst.components.equippable:SetOnEquip( onequip ) inst.components.equippable:SetOnUnequip( onunequip ) inst:AddComponent("insulator") inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE) inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL) inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.USAGE inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(inst.Remove) return inst end return Prefab( "common/inventory/hat_ushanka", fn, assets) Your suggestion is in there, but it could easily be in the wrong spot. Â workshop-402531514.zip Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949040 Share on other sites More sharing options...
JohnWatson Posted August 30, 2017 Share Posted August 30, 2017 Have you set the mod to all_clients_require? Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949043 Share on other sites More sharing options...
KirbyJParasol Posted August 30, 2017 Author Share Posted August 30, 2017 modinfo.lua is currently set to all_clients_require_mod = true  Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949047 Share on other sites More sharing options...
ZupaleX Posted August 30, 2017 Share Posted August 30, 2017 It would help to have the crash log. Also the SetPristine is supposed to be before the return when not executed by the host. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949070 Share on other sites More sharing options...
KirbyJParasol Posted August 31, 2017 Author Share Posted August 31, 2017 Here's the crash log. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949117 Share on other sites More sharing options...
ZupaleX Posted August 31, 2017 Share Posted August 31, 2017 This error does not correspond to the version of the mod you posted. The line 49 in your hat_hushanka.lua is an empty one and before that it is a AddTag. So we'll need the error that is actually generated by the version of the code which you posted Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-949149 Share on other sites More sharing options...
KirbyJParasol Posted September 5, 2017 Author Share Posted September 5, 2017 Alrighty, here's a brand new error log, one that ACTUALLY represents the crash. Note that when I crafted the hat and wore it in front of my buddy, there were no problems. It wasn't until I stuck it in a chest and he opened the chest that he crashed. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-950420 Share on other sites More sharing options...
KirbyJParasol Posted September 6, 2017 Author Share Posted September 6, 2017 Got same error today, even after trying to fix things. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-950891 Share on other sites More sharing options...
ZupaleX Posted September 6, 2017 Share Posted September 6, 2017 You're just posting the exact same error, there is no change at all. And since it does not correspond to the version you linked I do not see how we could help you. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-950908 Share on other sites More sharing options...
Lumina Posted September 6, 2017 Share Posted September 6, 2017 I know coding could look like magics but coders aren't actually wizards, yeah. Even if they are often amazing Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-950917 Share on other sites More sharing options...
KirbyJParasol Posted September 7, 2017 Author Share Posted September 7, 2017 local assets= { Asset("ANIM", "anim/hat_ushanka.zip"), Asset("IMAGE", "images/inventoryimages/hat_ushanka.tex"), Asset("ATLAS", "images/inventoryimages/hat_ushanka.xml") } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "hat_ushanka", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HEAD_HAT") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAT") end if inst.components.fueled then inst.components.fueled:StartConsuming() end end local function onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HEAD_HAT") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAT") end if inst.components.fueled then inst.components.fueled:StopConsuming() end end local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst:AddTag("hat") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst.AnimState:SetBank("hat_ushanka") inst.AnimState:SetBuild("hat_ushanka") inst.AnimState:PlayAnimation("idle") MakeHauntableLaunch(inst) inst:AddComponent("inspectable") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL) inst:AddComponent("insulator") inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE) inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "hat_ushanka" inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_ushanka.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.USAGE inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME * 1.5) inst.components.fueled:SetDepletedFn(inst.Remove) return inst end return Prefab("common/inventory/hat_ushanka", fn, assets) Current version. So line 49 is    inst.entity:AddNetwork() Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951032 Share on other sites More sharing options...
ZupaleX Posted September 7, 2017 Share Posted September 7, 2017 Stupid question but are you sure that you are actually modifying the script which is executed by the game? Because this makes zero sense. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951039 Share on other sites More sharing options...
KirbyJParasol Posted September 7, 2017 Author Share Posted September 7, 2017 Well I'm glad I'm not the only one stumped! Yeah, the file path is C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\mods I'm reuploading the entire folder, just to be thorough. Again, the problem is that when another client opens a chest containing the item, his game crashes. At this point it might be simpler if I just remake the entire code from scratch, and only carry over the art assets. Got any tutorials on how to make custom item prefabs like this? workshop-402531514.zip Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951156 Share on other sites More sharing options...
ZupaleX Posted September 7, 2017 Share Posted September 7, 2017 Your mod is on the workshop? If not did you make sure that the client have the proper version of the mod as well? Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951237 Share on other sites More sharing options...
KirbyJParasol Posted September 7, 2017 Author Share Posted September 7, 2017 It's on the workshop, but in a rather different form. Again, I'm trying to stabilize a mod that has long since been abandoned by its creator. But that hardly matters, since I've never required any of my clients to install the mods. We have almost never had problems with mod stability in any of the other mods that we run. We run nine different character mods--the clients install none, and we have no problems. Besides this one. THAT said, I can try seeing what happens if my friend sticks my version of this mod on his machine. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951295 Share on other sites More sharing options...
Lumina Posted September 7, 2017 Share Posted September 7, 2017 What ? The others players don't have the mod ? Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951302 Share on other sites More sharing options...
ZupaleX Posted September 7, 2017 Share Posted September 7, 2017 Well if your client has a different version of the mod that explains the crash log which has nothing to do with what you are posting here for a while... Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951318 Share on other sites More sharing options...
Lumina Posted September 7, 2017 Share Posted September 7, 2017 Yeah, this explains a lot... Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-951349 Share on other sites More sharing options...
KirbyJParasol Posted September 11, 2017 Author Share Posted September 11, 2017 The mystery thickens! Although I finally learned how to post pictures in a more format friendly way, so that's a small victory. This is all AFTER I tried two ideas. First, I had him completely delete his old version of the mod. We tested, crash, same message. Then I sent him the attached version of the mod--which is what my server was running--and had him UNZIP it first, and place the whole thing in his mods folder. Still got this same error. So three things still remain: The mod line that it's still spitting back is inst.entity:AddNetwork(). As I thought, the problem is not rooted in whether or not the client has the mod installed. We have ALWAYS run our modded servers without clients installing the mods themselves, and this is one of the only stability issues we have. Most of the modded characters we run have zero stability issues. Are there any tutorials for teaching how to make a custom prefab for a custom character? I have the art assets, so I could try just coding the entire hat from scratch. workshop-402531514.zip Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-952500 Share on other sites More sharing options...
Lumina Posted September 11, 2017 Share Posted September 11, 2017 (edited) 13 minutes ago, KirbyJParasol said: Â As I thought, the problem is not rooted in whether or not the client has the mod installed. We have ALWAYS run our modded servers without clients installing the mods themselves, and this is one of the only stability issues we have. Most of the modded characters we run have zero stability issues. Yes, but if the mod isn't on the workshop, the players can't download the mod, you have a big warning when you enable a mod that isn't on workshop. Also, if your mod is on workshop (but a different version) and you have another version on your server, it could lead to problem. Usually, there is a message that you need to update the mod, but if they share the same number of version, for example, i doubt there is a way to detect the error. And you are very confusing because it seems that your mod have one version in the server, and another on the workshop. On 07/09/2017 at 10:08 PM, KirbyJParasol said: Â It's on the workshop, but in a rather different form. Â So maybe the thing that happens is that you have your version, on the server, that is a modified version of the workshop mod, and people on the client side still download the workshop version, different of the server version ? Because this would explain why the error makes no sense. Â Can't you do a clean upload of the mod on the workshop and test the clean upload version instead of messing with the old one ? Edited September 11, 2017 by Lumina Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-952503 Share on other sites More sharing options...
KirbyJParasol Posted September 11, 2017 Author Share Posted September 11, 2017 Sorry I've been confusing. Let me explain. The mod that I'm tweaking IS NOT MY MOD. It has been long since abandoned by the original author. A lot of the code is outdated, so it's pretty unstable. I have been, and am currently, trying to stabilize each element of the mod. Currently I'm working on that hat prefab. In order to play with friends, I host this mod, along with eight other character mods, on my server. NONE OF THE CLIENTS INSTALL ANY MODS. But we only have problems with this mod, and with the Medic mod. The Medic bug has been noted by multiple players on that mod's workshop page. Point is, not requiring the clients to install the mods has NEVER caused us issues. FURTHERMORE! The tests that I JUST now ran with my friend, were as follows: Tried opening a chest containing the hat with NO MOD in his mods folder. Tried opening a chest with MY EXACT VERSION of the mod in his mods folder. In both cases, the game crashes and gives the exact same error. Â I cannot stress any more strongly that this mod almost certainly has nothing to do with what the client has (or doesn't have) installed, and is almost certainly a problem with the server side code. I am also once again inquiring if there are any prefab tutorials out there that I can use to just rebuild the entire code from scratch. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-952505 Share on other sites More sharing options...
Lumina Posted September 11, 2017 Share Posted September 11, 2017 (edited) Dedicated server i'm hosting. So as far as i understand how it works, i'm the client of the dedicated server. And i have thousand of hats with no crash. Â English isn't my native language. So maybe i'm bad at explaining, maybe it's why we don't understand each other. But i'll try again. Â Steam allows mod on WORKSHOP to be shared even if players don't suscribe/download/have the mod themselves. You change the mod on local. Players have NO WAY to have the updated mod because it's not on WORKSHOP. Copying files on local on their side is probably not enough to have something clean. Maybe it's replaced by the workshop version, maybe it's not taken in account, i don't know. Â Mod is working fine on my side and i'm pretty sure i'm client side. Â Now, please, could you reupload a clean version of the mod on workshop (limit it to friends only if you can't reupload a mod that aren't your) OR Rename it something else than the mod workshop name ("annoyingmod" seems to be a fitting name), send a zip to your friend and do news tests so we can be sure that the fact that your mod share it's name with an existing but outdated version of your mod isn't the reason of the problem ? Thanks. Because i start to be annoyed to waste my time (and seeing others people wasting their) trying to fix something that could be perfectly fine but not working because they still have the old outdated version on their side. Edited September 11, 2017 by Lumina Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-952507 Share on other sites More sharing options...
KirbyJParasol Posted September 11, 2017 Author Share Posted September 11, 2017 Didn't know you could upload friends only versions of mods to Steam. Yeah I can do that, though I think I essentially did the same thing with the earlier experiment. The strange thing about this bug is that it only crashes clients who join your game. If you locally host a game and also play it--as in, you're both the host AND one of the clients--the game never crashes for you. It will just crash for all your friends who join off you. Link to comment https://forums.kleientertainment.com/forums/topic/81595-custom-hat-crashes-non-host-clients/#findComment-952510 Share on other sites More sharing options...
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