Jump to content

Recommended Posts

Easiest way is to decompile one of the kitcoon builds make your own textures and rename the .scml

Once you compile the texture and .scml into a .anim, .tex and .build delete the .anim as you don't need a animation bank as you'll just use the original one.

As for code you can just look at how the critters work and copy the relevant code tweaked for your custom kitcoon. Spawn it in similar to other character's pets.

  • Like 1
20 hours ago, IronHunter said:

As for code you can just look at how the critters work and copy the relevant code tweaked for your custom kitcoon. Spawn it in similar to other character's pets.

I'd probably need a walk through or just sending the code to me directly I'm unsure where to look for the kitcoons code.

Here is my example of how to retexture an existing creature: https://steamcommunity.com/sharedfiles/filedetails/?id=2704580906

I'd like to share my method to retexture/create a creature:

  1. go to "don't starve together/data/anim",find "kitcoon_xxx.zip" ,unzip any of them to some other directory. Also unzip "kitcoon_basic.zip" to the same directory. You get anim.bin, build.bin and some "atlas.tex" texture file.
  2. use krane.exe(included in ktools) to extract the animation project file from that directory. The command looks like "krane.exe input_directory output_directory"
  3. go to the output directory, use Spriter.exe to open kitcoon_xxx.scml.
  4. Make your own artwork, or simply substitute images with yours.
  5. rename this scml file.
  6. copy the output directory to don't starve/mods/xxx(whatever name you like)/exported/(that said,I'm still confused about why I have to put DST's mod into DS's directory).
  7. run autocompiler.exe(included in don't starve mod tools, which I can download from Steam).
  8. after a lengthy time,you eventually get the zip file in don't starve/mods/xxx/anim, which includes anim.bin, build.bin and some atlas texture files.
  9. code time. import your animation file, apply it to some kitcoon, or create a new prefab. For retexture purpose, refer to my mod mentioned above.
  10. publish the mod to workshop, or just relish it yourself.

edit:

I will also share the code:

  • open "don't starve together/mods", and create a new folder whatever name you like, use this folder to place your files.
  • first create a file named "modinfo.lua", open it and type in the code below, fill in the strings:
name = ""
description = ""
author = ""
version = ""
forumthread = ""
server_filter_tags = {""}
icon_atlas = "modicon.xml"
icon = "modicon.tex"
api_version_dst = 10
priority = 0
dont_starve_compatible = false
reign_of_giants_compatible = false
shipwrecked_compatible = false
dst_compatible = true
all_clients_require_mod = false
client_only_mod = true
  • then, draw a PNG image(supposed to be square-shaped, and have a not-too-big size) that will finally become an icon. Put this image(xxx.png) into the aforesaid "don't starve/mods/xxx/images", run autocompiler.exe so that you get "xxx.xml" and "xxx.tex". Copy these files to the same directory where your mod is. Either rename them to "modicon.xml" and "modicon.tex", or rename the variable defined in the code to exactly match each other.
  • after that, don't forget to copy the animation file(xxx.zip) to "anim/xxx.zip".
  • finally, you need to edit "modmain.lua". Here I take my mod as example, some functions are helpful while others are not.

First I need to check whether the game mode is Forge or Gorge, in case some retexture should not work there. So I write a function to do this.

local function specialGameModeDetector()
    local gameMode = GLOBAL.TheNet:GetServerGameMode()
    local isForge = gameMode == "lavaarena"
    local isGorge = gameMode == "quagmire"
    if isForge then
        return "forge"
    elseif isGorge then
        return "gorge"
    else
        return "normal"
    end
end

Second, I need to rename the creature. So I write a function to do this.

local function ReName(name, rename)
    local STGS = GLOBAL.STRINGS
    STGS.NAMES[name] = rename
end

Third, I need to import animation. This is essential!

Assets={
    Asset("ANIM","anim/xxx.zip")
}

Fourth, I need to apply the animation to some creature, so I write a function. Notice that the APIs are inst.AnimState:SetBuild and such and such.

-- Client-side ReSkin Function
-- Usage:
--[[
    SetSkin(inst,{
        name="skin_name",
        build="build_name",
        bank="bank_name",
        client=client_override[3]{?,"build_name","override_build_name"},
        symbol=symbol_override[3]{"symbol_name","override_build_name","override_symbol_name"},,
    })
]]
local function SetSkin(inst, conf, override)
    local build_name = conf.build
    local bank_name = conf.bank
    local client_override = conf.client
    local symbol_override = conf.symbol
    local skin_name=conf.name
    if not skin_name==nil then
        inst.skinname=skin_name
    end
    if build_name then
        if override then
            inst.AnimState:AddOverrideBuild(build_name)
        else
            inst.AnimState:SetBuild(build_name)
        end
    end
    if bank_name then
        inst.AnimState:SetBank(bank_name)
    end
    if client_override then
        inst.AnimState:SetClientsideBuildOverride(client_override[1], client_override[2], client_override[3])
    end
    if symbol_override then
        inst.AnimState:OverrideSymbol(symbol_override[1], symbol_override[2], symbol_override[3])
    end
end

Finally, I need to remind DST to change the texture when one creature is spawned. I choose AddPrefabPostInit. Notice that "bank" is the "entity"(aka. the level 1 title) you see in Spriter that includes a lot of actions(level 2 title), while the "build" is the name of this SCML file. Meanwhile, the "prefab" might be "kitcoon_xxx".

AddPrefabPostInit("prefab", function(inst)
    SetSkin(inst, {
    bank = "bank",
    build = "build"
    })
end)

By the way, maybe you want to know more about what kitcoons behave, the code is located in "Don't Starve Together\data\databundles\scripts.zip" at "prefabs/kitcoon.lua".

Edited by Mr.Rickzzs
  • Thanks 1

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
×
  • Create New...