Jump to content

Help with player_mount anim file for Beefalo like creature


Recommended Posts

I've been working on a mod that adds a creature that can be mounted, using the beefalo code as the base.

My issue is when the creature is mounted from the rider component the bank gets set to "wilsonbeefalo" (from the "player_mount..." anim files). So now both the player and the creature use those animations. What I wanted to do was edit the "player_mount_travel" anim file to edit the creature only. I also don't want to overide any original files so I was hoping to be able to have my own "wilsonbeefalo" anim files with a different name to use for the creature when mounted.

I can decompile "player_mount_travel" using the beefalo build to gain the spriter file that I can edit however the problem is the Player also uses this anim file and since I hadn't decomipled using the player build now when mounted the edited animation for my creature does play in-game, but the player mounted is invisible. I'm not sure what to do for me to have the Player still use the original Player_mount anim files but have my seperate Player_mount anim file for the creature that work alongside eachother.

Any insight into this will be appreciated.

Edited by maliblues
Link to comment
Share on other sites

If I were to have a copy of the rider component, using a different name, that I can use and edit for my mod I was wondering if I can have the Player still use the bank "wilsonbeefalo" but for the mount tell it to use a different bank.

Here is the original Mount function:

function Rider:Mount(target, instant)
    if self.riding or target.components.rideable == nil or target.components.rideable:IsBeingRidden() then
        return
    end

    if not target.components.rideable:TestObedience() then
        self.inst:PushEvent("refusedmount", {rider=self.inst,rideable=target})
        target:PushEvent("refusedrider", {rider=self.inst,rideable=target})
        return
    end

    local rideable = target.components.rideable
    local saddler = rideable.saddle.components.saddler

    local x, y, z = self.inst.Transform:GetWorldPosition()
    local tx, ty, tz = target.Transform:GetWorldPosition()

    self.riding = true

    self.inst.AnimState:SetBank("wilsonbeefalo")
    if target.ApplyBuildOverrides ~= nil then
        target:ApplyBuildOverrides(self.inst.AnimState)
    end
    self.inst.AnimState:OverrideSymbol("swap_saddle", saddler.swapbuild, saddler.swapsymbol)
    self.inst.Transform:SetSixFaced()

    self.inst.sg:GoToState(instant and "idle" or "mount")

    self.inst.DynamicShadow:SetSize(6, 2)

    if self.inst.components.sheltered ~= nil then
        self.inst.components.sheltered:Stop()
    end

    if target.components.combat ~= nil then
        self.inst.components.combat.redirectdamagefn =
            function(inst, attacker, damage, weapon, stimuli)
                return target:IsValid()
                    and not (target.components.health ~= nil and target.components.health:IsDead())
                    and not (weapon ~= nil and (weapon.components.projectile ~= nil or weapon.components.weapon:CanRangedAttack()))
                    and stimuli ~= "electric"
                    and stimuli ~= "darkness"
                    and target
                    or nil
            end
    end

    self.inst.components.pinnable.canbepinned = false

    self.inst:AddChild(target)
    target.Transform:SetPosition(0, 0, 0) -- make sure we re centered, so poop lands in the right spot!
    target.Transform:SetRotation(0)
    target:RemoveFromScene()
    if target.components.brain ~= nil then
        BrainManager:Hibernate(target)
    end
    if target.SoundEmitter ~= nil then
        target.SoundEmitter:KillAllSounds()
    end

    self:StartTracking(target)
    self.mount = target
    target.components.rideable:SetRider(self.inst)

    self.inst.Physics:Teleport(tx, ty, tz)
    self.inst:FacePoint(x, y, z)

    self._mountannouncetask = self.inst:DoTaskInTime(2 + math.random() * 2, AnnounceMountHealth, self)

    self.inst:PushEvent("mounted", { target = target })
end

My guess is that the target refers to the mount here so I tried a few things similar to this:

target.AnimState:SetBank("wilsoncreature")

but I'm just guessing, I'm not too sure how to make this work or if it is possible

Link to comment
Share on other sites

I did this in 5 minutes, just combining assets to make a dummy build to decompile the anim. The only issue I have is sometimes images get distorted after decompiling. I'll try again later, right now only SWAP_FACE is acting funny. But it should be enough for testing, just make sure to delete/rename animations to prevent overriding of vanilla ones.
 

edit:
I should add that even if the spriter file looks distorted, it might appear fine in game because of the pivot point locations being in the correct spot. Its just the decompiler has a history of not being perfect.

Furthermore I am not sure if I am missing any symbols or not, this was a quick job. Everytime klei adds new symbols it keeps breaking my old animations, first player/beefalo, then hounds etc...I love seeing new content, but its a pain to fix animations without a proper rigged base file.

player_mount_spriter.rar

Edited by IronHunter
  • Like 2
Link to comment
Share on other sites

Hello @IronHunter!

This helps massively! I've used it to decompile the animation and replaced beefalo texture with mine and my quick test edit plays in-game without any issue with the Player now. This will be very helpful with testing so a big thank you! I have not noticed any distorting though, just that for the player_mount_travel animation the different arm/hand positions are all visible. But this still gives me something to work with and I wouldn't have been able to make it myself. I was in the process of creating something similar, by manually importing the player anim to the mount one by opening spriter in a text editor (I believe I also got that method from one of your old posts) but after seeing your file I realise I forgot about all the Player symbols.

Also, I understand there is a chance of missing symbols or new ones being added that may break animations. All I can really do at this stage is hope it doesn't come to that as I didn't want to give up on the mod after all the time spent on it.

Thank you again!

Edited by maliblues
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...