Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

@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)
Link to comment
Share on other sites

@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.
Edited by Kzisor
Link to comment
Share on other sites

 

@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.

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

@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 ^^

Link to comment
Share on other sites

@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"

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

@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

Edited by Foxrai
Link to comment
Share on other sites

@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.

Edited by Kzisor
Link to comment
Share on other sites

@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 :/

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...