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.

Clopen

Extracting Berry Bush Animations

Recommended Posts

Clopen    12

Hello all,

I'm trying to make a new kind of bush that's basically exactly the same as the berry bush ("berrybush" prefab) only with something other than berries on it.

I have the images, Spriter shows the animations work, but in the game itself there is a problem with picking the "berries" off the bush - both before and after picking it, it still shows the same amount of "berries" on it.
From looking at the code I saw that there is a setberries() function which determines the amount of berries shown.
To do that it shows/hides animations called "berries", "berriesmore" and "berriesmost":

local function setberries(inst, pct)
    if inst._setberriesonanimover then
        inst._setberriesonanimover = nil
        inst:RemoveEventCallback("animover", setberries)
    end

    local berries =
        (pct == nil and "") or
        (pct >= .9 and "berriesmost") or
        (pct >= .33 and "berriesmore") or
        "berries"

    for i, v in ipairs({ "berries", "berriesmore", "berriesmost" }) do
        if v == berries then
            inst.AnimState:Show(v)
        else
            inst.AnimState:Hide(v)
        end
    end
end

 

And it seems that the problem is that my animation data doesn't have these three animations.
I used Krane to extract the Spriter project from the game files, and the project contains all the animations except those three, it seems.
Opening the original bush's anim.bin file in a hex editor shows that these three terms are present in it (at the end of the file), but after extracting it, searching the contents of the extracted files for them yields nothing in any file.

I've tried adding these three animations to the project with what I think they should contain, but it made little difference, and what it did do made no sense to me.

Can someone please help me understand what's going on here, or at least how I can go about making my own somethingbush?

Thanks in advance.

Share this post


Link to post
Share on other sites
JohnWatson    3,451

You could try using the berrybush's animation bank.

inst.AnimState:SetBank("berrybush")
inst.AnimState:SetBuild("<your custom bush's build name>")

 

Share this post


Link to post
Share on other sites