Jump to content

Log Storage


Recommended Posts

hey guys

 

today i tried to create my first mod but i had a lot of problems with it. The idea is a creation of simple Log Storage (2 flint+1boars) for 5 stacks of log with dynamic texture (i can draw texture for each stack but now i have only empty storage and full storage. 

 

First problem: i couldn't understand how i can decompile anims.bin and build.bin using ktools. I have Win8, and I didn't understand process of decompilation cuz no one file in ktools directory i could use. Shall i use CMD or what? Sorry, if question is so stupid.

 

Second problem: i don't know how my log storage can change texture when empty or has 1 full cell, 2 full cell etc. Maybe anybody can help with it? 

 

 

if you can help me please wrire me here or on steam:http://steamcommunity.com/id/watercolour-catalyst/
 

post-674378-0-63309000-1435946135.png

post-674378-0-26307500-1435946137.png

Link to comment
Share on other sites

  1. Yes, use the cmd window. First paste the path to krane (you can simply drag it in), then the arguments (source and destination path, can be identical).

You could simply make a different animation for each one. Or you could bother with AnimState:Hide and AnimState:Show.

Link to comment
Share on other sites

Yes, use the cmd window. First paste the path to krane (you can simply drag it in), then the arguments (source and destination path, can be identical).
 

 

hm. I almost never work with cmd...

1."cd C:\Users\user\Desktop\MOD\ktools\src\krane"

 2. "krane anim.bin build.bin C:\Users\user\Desktop\MOD\ktools\src\krane"

right?

Link to comment
Share on other sites

 

  1. Yes, use the cmd window. First paste the path to krane (you can simply drag it in), then the arguments (source and destination path, can be identical).
  2. You could simply make a different animation for each one. Or you could bother with AnimState:Hide and AnimState:Show.

 

finally i understand how work with animation and compilation. (screenshot)

 

But have problems with configs. I used config from mod Storm Cellar for testing

 

1. How i can make that player can store only logs.

2. it's real to do that for 1 free cell in inventory of storage and 2 or 3 free cells play different animations? That code you posted helps me in this?

post-674378-0-97165600-1436018585_thumb.

Link to comment
Share on other sites

How i can make that player can store only logs?

 

The container component allows for test functions. Simply return ' item.prefab == "log" ' in the test function and you should be good to go.

 

I'm not sure what you mean with the second question. You can either:

  1. Place all logs on the thing and keep them in all animations. Then you can show and hide the symbols as needed.
  2. Make a different idle animation for each count of logs. This is easier to do.
Link to comment
Share on other sites

I'm not sure what you mean with the second question. You can either:
 

Sorry for my bad english, i'n russian, but it's hard when russian tutorials does not exist, need to read and translate, but i'm trying :3

 

I already made different animations for each count of logs. I mean: it must be 5 cells in inventory of my storage only for logs. When i place 1 stack in the first cell, animation must change to new, and when i place 2 stack, animation change to new 2. Maybe it will be like the analog - beebox, but player cannot see inventory of beebox, he can only take honey.

Thank your for container :)

Link to comment
Share on other sites

@CatalystWtrclr

 

local function UpdateAnim(inst) --make a function for this stuff!

    local numlogs= 0 --zero logs so far
    for _, item in pairs(inst.components.container.slots) do --for every tile...
        if item and item.prefab == "log" then --if that tile has logs

               numlogs = numlogs + 1 --add a log to the counter
        end
    end

    inst.AnimState:PlayAnimation("idle" .. numlogs) --assuming your animation names are "idle0", "idle1", etc.
end

 

[...] --this next bit goes to the main function "fn", you know the deal
    inst:ListenForEvent("itemlose", UpdateAnim)
    inst:ListenForEvent("itemget", UpdateAnim)
 

Link to comment
Share on other sites

@CatalystWtrclr

 

local function UpdateAnim(inst) --make a function for this stuff!

    local numlogs= 0 --zero logs so far

    for _, item in pairs(inst.components.container.slots) do --for every tile...

        if item and item.prefab == "log" then --if that tile has logs

               numlogs = numlogs + 1 --add a log to the counter

        end

    end

    inst.AnimState:PlayAnimation("idle" .. numlogs) --assuming your animation names are "idle0", "idle1", etc.

end

 

[...] --this next bit goes to the main function "fn", you know the deal

    inst:ListenForEvent("itemlose", UpdateAnim)

    inst:ListenForEvent("itemget", UpdateAnim)

 

i tried it

When I place logs in container or take them sprite-storage disappears and arises again with default animation ("empty")

Link to comment
Share on other sites

scripts is ready.

Last question for this mod:

I made cells in prefab file (= 5), but how to create animation for background in Spriter?

 

You don't do that in spriter, you tell the game what image to use. Other containers do that too. (usually the images are called "something_1x5")

Link to comment
Share on other sites

You don't do that in spriter, you tell the game what image to use. Other containers do that too. (usually the images are called "something_1x5")

so... build renamer?

ui_chest_3x3 as example has anin and build. i tried to import texture with help of TexTools and Build Renamer, but in game it doesn't work

Link to comment
Share on other sites

so... build renamer?

ui_chest_3x3 as example has anin and build. i tried to import texture with help of TexTools and Build Renamer, but in game it doesn't work

 

As clearly seen by above statement, I have no idea what I'm even doing.

The anim zip has an atlas-0.tex that can be edited using the tex tools.

Link to comment
Share on other sites

As clearly seen by above statement, I have no idea what I'm even doing.

The anim zip has an atlas-0.tex that can be edited using the tex tools.

yeah, i know it. I edited atlas, used build renamer, but game doesn't see my texture. I tried create zip using Spriter but result is the same. I'll try again, maybe i made mistake somewhere.

Thank you Mobbstar for your help. Now prefabs for me is no dark forest   :-)

Link to comment
Share on other sites

Mod released. log_storage.zip

Steam Workshop: http://steamcommunity.com/sharedfiles/filedetails/?id=477723360

 

New storage for your logs. Especially thanks Mobbstar from Klei forum for help.
 
This storage ONLY for logs, you cannot store any items. The storage has 5 slots for 5 stacks of log. For every slot used different animation
 
Recipe: 2 boards+1flint (need Science Machine).
 
About ideas for this, bugs, crashes or mistakes please report in this topic or in comments
Link to comment
Share on other sites

@CatalystWtrclr, It's the sixth (6th) parameter you send to Recipe.

can you tell more about this? I have not seen parametr sixth hm. It's in modmain?

 

PrefabFiles = 

{

"log_storage",}

 

Assets = 

{

Asset("ATLAS", "images/inventoryimages/log_storage.xml"),

 

Asset("ATLAS", "minimap/log_storage.xml" ),

 

}

 

 

STRINGS = GLOBAL.STRINGS

RECIPETABS = GLOBAL.RECIPETABS

Recipe = GLOBAL.Recipe

TECH = GLOBAL.TECH

Ingredient = GLOBAL.Ingredient

 

if GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then 

GLOBAL.additionalstructuresDLC0001 = "enabled"

else

GLOBAL.additionalstructuresDLC0001 = "disabled"

end

 

 

local log_storage = GLOBAL.Recipe("log_storage",

{ Ingredient("boards", 1),  

},  

RECIPETABS.TOWN, TECH.SCIENCE_ONE, "log_storage_placer" )

 

 

log_storage.atlas = "images/inventoryimages/log_storage.xml"

 

AddMinimapAtlas("images/inventoryimages/log_storage.xml")

Link to comment
Share on other sites

can you tell more about this? I have not seen parametr sixth hm. It's in modmain?

 

PrefabFiles = 

{

"log_storage",}

 

Assets = 

{

Asset("ATLAS", "images/inventoryimages/log_storage.xml"),

 

Asset("ATLAS", "minimap/log_storage.xml" ),

 

}

 

 

STRINGS = GLOBAL.STRINGS

RECIPETABS = GLOBAL.RECIPETABS

Recipe = GLOBAL.Recipe

TECH = GLOBAL.TECH

Ingredient = GLOBAL.Ingredient

 

if GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then 

GLOBAL.additionalstructuresDLC0001 = "enabled"

else

GLOBAL.additionalstructuresDLC0001 = "disabled"

end

 

 

local log_storage = GLOBAL.Recipe("log_storage",

{ Ingredient("boards", 1),  

},  

RECIPETABS.TOWN, TECH.SCIENCE_ONE, "log_storage_placer" )

 

 

log_storage.atlas = "images/inventoryimages/log_storage.xml"

 

AddMinimapAtlas("images/inventoryimages/log_storage.xml")

 

in data/scripts/recipe.lua it says:

 

Recipe = Class(function(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive)

 

min_spacing is the one you want (a ground tile is 4 wide)

 

Link to comment
Share on other sites

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.

×
  • Create New...