Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Foxrai

Handslot item - in DS Together? Differences from DS/ROG

Recommended Posts

Foxrai    12

Well I tried asking in other thread but they seem dead.. So I'll let myself post a new one. 

 

If I have working handslot item in Don't Starve, what I need to do to make it work in Don't Starve Together?

The Item is character specific, comes with the beggining of the game and is not craftable (no recipe!) Yet no addictional functions, it's just plain like spear - sharp/weapon tags. 

 

When I start the DST server only the host gets the item. Also somehow the HP,Hunger and Sanity of my char are messed up. I think it's ok without the item added (the issues ONLY FOR GUESTS) Host always works fine. 

 

I guess it's some small line missing but I can't figure out what and where :/ 

 

So basicly: what is the difference between DST and DS hand gear mods? What to add? :/

 

Sorry if its stupid question.

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, first off it's not a stupid question. Secondly, it is recommended to read to sticky at the top of this sectionby rezecib to fully understand the differences brought to Don't Starve Together from Don't Starve.

 

Finally, because it's an easy question to answer I'll give you the answer, but please read the sticky!

 

You need to add inst.entity:AddNetwork() to your local function fn, right after the other entity initialization code. You'll also need the following code before any components since components do not run on the clients computer.

 

if not TheWorld.ismastersim then

return inst

end

 

I hope this helps.

 

~Kzisor/Ysovuka

Share this post


Link to post
Share on other sites
Foxrai    12
@Foxrai, first off it's not a stupid question. Secondly, it is recommended to read to sticky at the top of this sectionby rezecib to fully understand the differences brought to Don't Starve Together from Don't Starve.   Finally, because it's an easy question to answer I'll give you the answer, but please read the sticky!   You need to add inst.entity:AddNetwork() to your local function fn, right after the other entity initialization code. You'll also need the following code before any components since components do not run on the clients computer.

 

Finished reading the sticky twice before posting previous post. Now took a peek again too...  

 

And I swear I had those in mod o.o maybe I added too much of stuff... 

 

looks like this now:

 

local inst = CreateEntity()

local inst.entity:AddNetwork()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
local sound = inst.entity:AddSoundEmitter()
MakeInventoryPhysics(inst)
 
and before ANY components the other lines stands.
 
I also had:   inst.entity:SetPristine() <<< such line Donno where from tho.. I probably read somewhere to add that -.-'
 
Hmmm does that mean the same goes for the characters itself? :o

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, the character should not need those lines if set up correctly as that is already handled behind the scenes. 

Share this post


Link to post
Share on other sites
Foxrai    12

@Kzisor ok. Not touching the character then. Gonna be testing it soon then :)

 

looks like this now (skipping assets lines):

 

local prefabs = 
{
}
 
local function fn()
 
    local function OnEquip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_object", "swap_bellstaff", "swap_bellstaff")
        owner.AnimState:Show("ARM_carry")
        owner.AnimState:Hide("ARM_normal")
    end
 
    local function OnUnequip(inst, owner)
        owner.AnimState:Hide("ARM_carry")
        owner.AnimState:Show("ARM_normal")
    end
 
    local inst = CreateEntity()
    local inst.entity:AddNetwork()
    local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
    local sound = inst.entity:AddSoundEmitter()
    MakeInventoryPhysics(inst)
     
    anim:SetBank("bellstaff")
    anim:SetBuild("bellstaff")
    anim:PlayAnimation("idle")
 
 if not TheWorld.ismastersim then
return inst
end
 
    inst:AddComponent("inspectable")
    
    inst:AddTag("sharp")
 
(...) > weapon stuff blablabla
     
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )
 
    return inst
end
return  Prefab("common/inventory/bellstaff", fn, assets, prefabs)

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, move the tag above the if not TheWorld.ismastersim then line as that is needed for clients. It would be beneficial if you posted your entire mod so that I can see exactly what is the root cause of the problem. 

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, I think I found the issue.

 

local inst.entity:AddNetwork() is wrong. Remove the local from it and it should work correctly.

 

Also in your wakkari.lua file in the master_postinit function you don't need the following line:

 
-- Minimap icon
inst.MiniMapEntity:SetIcon( "wakkari.tex" )
 
common_postinit is ran on both the server and the client and master_postinit is only ran on the server.

Share this post


Link to post
Share on other sites
Foxrai    12

 

@Foxrai, I think I found the issue.

 

local inst.entity:AddNetwork() is wrong. Remove the local from it and it should work correctly.

 

Also in your wakkari.lua file in the master_postinit function you don't need the following line:

 
-- Minimap icon
inst.MiniMapEntity:SetIcon( "wakkari.tex" )
 
common_postinit is ran on both the server and the client and master_postinit is only ran on the server.

 

 

 

Ok I see o_o

 

Thank you for having patience to me in the first place... 

Is really a noob if it comes to coding :/ even with reading forums tutorials and original ds files xP It just hates me.

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, it's okay, everyone has to start somewhere. I will be making a series of guides to help new modders take their beginning steps into modding Don't Starve and Don't Starve Together. The first chapter is already out, it's about setting up your working environment to achieve the maximum efficiency possible while developing mods.

Share this post


Link to post
Share on other sites
Foxrai    12
@Foxrai, it's okay, everyone has to start somewhere. I will be making a series of guides to help new modders take their beginning steps into modding Don't Starve and Don't Starve Together. The first chapter is already out, it's about setting up your working environment to achieve the maximum efficiency possible while developing mods.
 

 

Indeed there is many of the tutorials and stuff but none really explains WHAT DOES WHAT in the mods...

Only like: Make it that way! Why? Because!

 

Some things are simple to figure out by looking on original DS items, but not everything...Like for example I'm fighting with "Light" add now. It will come and it's satisfaction when you made it.. but still.

 

Nice of you to make such introduction to mods ^^

Share this post


Link to post
Share on other sites
Foxrai    12

@Kzisor,

 

I guess with character it wasnt that issue o.o for free time - i donno if it's the item causing it thats why keeping in this thread - Item seems to be fine.

 

Ow wait.. If I have master postinit then it means it's only for HOST ye? So only person hosting server gets that? And under that there are character statistics.. Shouldn't I change master to common for DST?

 

that's in wakkari.lua

 

'cause atm character run by guest doesnt have any stats (hunger, sanity etc) nothing. And all of these are under "master"

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, clients do not need to have the statistics ran on their side as they do not have the components to handle that running. Statistical information should only be ran on the server side as otherwise it would cause an error. There are certain exceptions to this such as speed, but many things have replica's which already do all the hard work for you.

 

If I'm understanding correctly when a player joins your server their UI isn't showing correctly? Is this an accurate assessment? If not could you please provide a screen capture to better denote exactly the issue clients are seeing?

Share this post


Link to post
Share on other sites
Foxrai    12

@Foxrai, clients do not need to have the statistics ran on their side as they do not have the components to handle that running. Statistical information should only be ran on the server side as otherwise it would cause an error. There are certain exceptions to this such as speed, but many things have replica's which already do all the hard work for you.

 

If I'm understanding correctly when a player joins your server their UI isn't showing correctly? Is this an accurate assessment? If not could you please provide a screen capture to better denote exactly the issue clients are seeing?

 

 

I tried changing them tho.. but it's no difference at all... looks like this :

attaching log as well.. (from client position)

and new prefabs but as i said with old ones it was exaclty the same...

(corrected double minimap in prefabs, and changed commons/master)

 

NOTE: THERE IS NO DEAD PLAYER on map! World is fresh generated, just the two of us who are on the screen. So the ghost icon is a bug as well... -.- HOST works fine

 

NOTE2: the item works fine after Your modification 

 

bug_by_foxraifox-d8gtbnt.jpg

log.txt

wakkari.lua

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, post your entire mod folder as a .zip file so I may take a closer look at other moving parts in the mod. It might be something completely unrelated to the wakkari.lua file altogether. 

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, I've made some changed and now it works.

 

Specific changes I made were in the wakkari.lua file.

 

I changed:

return MakePlayerCharacter("wakkari", prefabs, assets, master_postinit, common_postinit, start_inv)

to:

return MakePlayerCharacter("wakkari", prefabs, assets, common_postinit, master_postinit, start_inv)

 

I also reversed your changed making the master_postinit contain all the component information.

 

I've attached the working version. Tested with the dedicated server software while I was a client.

 

 

You can connect to Dedicated-Ysovuka2 password 123 to test if this .zip file works for you.

Share this post


Link to post
Share on other sites
Foxrai    12

@Kzisor,

 

Hmmmm believe it or not.. But I just send Your zip to my friend and same added to my mods.. And still the same issue o.o Can this be just me? Tho I don't have ANY other mods installed apart from where's my beefalo o.o 

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, I recommend both you and your friend, delete the entire folder from your mods folder and extract it there again. Also make sure the modmain and other files aren't inside a secondary file from extraction.

Share this post


Link to post
Share on other sites
Foxrai    12

@Foxrai, I recommend both you and your friend, delete the entire folder from your mods folder and extract it there again. Also make sure the modmain and other files aren't inside a secondary file from extraction.

 

Did everything you said :/ I guess I'll just pass on it for now... Checked it with 3 people. Everyone confirmed the same error :/

Share this post


Link to post
Share on other sites
Kzisor    1,057

@Foxrai, that is very strange as I was capable of running it on a dedicated server and on both my PC's it ran flawlessly. 

Share this post


Link to post
Share on other sites