Sign in to follow this  
Yakuzashi

[TEMPLATE] Custom follower (with Tutorial)

Do you find it useful ?  

21 members have voted

  1. 1. So, do you ?

    • Yes, thanks a lot
      18
    • Nope, end yourself with beefalo belt
      0
    • Dunno, but don't use this beefalo belt
      3


Recommended Posts

Yakuzashi    148

Alright, it was really strange, I have fixed it but dunno how. I have made new exported folder and icons (everything is based on the old art), probably something went south during conversion.

patch.rar

Share this post


Link to post
Share on other sites
AAAContinue    0
On 1/15/2021 at 2:24 AM, Yakuzashi said:

Alright, it was really strange, I have fixed it but dunno how. I have made new exported folder and icons (everything is based on the old art), probably something went south during conversion.

Wow, it works!!! Thanks for helping:)
And... I know modding is not a simple thing... but can I have another question about the follower?
I want to change follower as a ghost(like Abigail). But I can't find a solution...
You don't have to respond to this if you don't want to. You already helped me a lot:)

Share this post


Link to post
Share on other sites
Yakuzashi    148
Quote

...\Steam\steamapps\common\Don't Starve Together\data\databundles

...scripts.zip
Unpack it and then open sub-folder "prefabs". Then file called "abigail.lua" should contain every essential thing.

Try to swap this section inside creature.lua

Quote

    inst.AnimState:SetBank("ghost")
    inst.AnimState:SetBuild("ghost_abigail_build")

It might require some tweaking to match the stategraph and all the animation stuff. I am short on time, so I will leave it this way. Cheers!

Share this post


Link to post
Share on other sites
Games2play    2

Hello I just wanted to add to this thread for people who were having trouble like I was having followers continue following after disconnecting without an eyebone item. this code is pulled from abigail and wendy

just replace any mention of creature with the name of your creature file name and player with the name of your player file name

 

inside the player.lua add the following functions

Quote

local function OnDespawn(inst)
    if inst.creature ~= nil then
        inst.creature.components.lootdropper:SetLoot(nil) --removes the loot so that you can kill the creature on log out
        inst.creature.components.health:SetInvincible(true)
        inst.creature:PushEvent("death") -- inst.creature.Remove might work here if you don't want to use the lootdropper
        --in case the state graph got interrupted somehow, just force
        --removal after the dissipate animation should've finished
        inst.creature:DoTaskInTime(25 * FRAMES, inst.creature.Remove)
    end
end

local function OnSave(inst, data)
    if inst.creature ~= nil then
        data.creature = inst.creature:GetSaveRecord()
    end
end

-- When loading or spawning the character

local function OnLoad(inst, data)
    if data ~= nil and data.creature ~= nil and inst.creature == nil then
        local creature = SpawnSaveRecord(data.creature)
        if creature ~= nil then
            if inst.migrationpets ~= nil then
                table.insert(inst.migrationpets, creature)
            end
            creature:LinkToPlayer(inst)
        end
    end
end

inside the player.lua master postnit add the following somewhere near the bottom

Quote

inst.creature = nil

inst.OnDespawn = OnDespawn
inst.OnSave = OnSave
inst.OnLoad = OnLoad

inside the creature.lua add the following functions

Quote

local LOOT = {"rocks",} --add whatever you want


local function unlink(inst)
    inst._playerlink.creature = nil
end

local function linktoplayer(inst, player)
    inst.components.follower:SetLeader(player) --wasn't sure if set leader or add follower was better so I just added both
    --inst.components.lootdropper:SetLoot(LOOT) --this was causing my loot to double but it's how abilgail was reseting her loot
    inst.persists = false
    inst._playerlink = player
    player.creature = inst
    player.components.leader:AddFollower(inst) --abigail uses this function instead of SetLeader but I was having trouble with it
    player:ListenForEvent("onremove", unlink, inst)
end

 

inside the main function of creature.lua add the following

Quote

inst._playerlink = nil

inst.OnSave = OnSave
inst.OnLoad = OnLoad

inst.LinkToPlayer = linktoplayer

 

that's all I remember for now. hope this helps somebody

  • Thanks 2

Share this post


Link to post
Share on other sites
Welx    5

Renaming all of the anchor into something else causes it to not compile and appear in the anim folder... help?

Share this post


Link to post
Share on other sites
Yakuzashi    148

You need to make new .scml file for your item then. I'll make some basic tutorial about this stuff in my spare time. Cheers!

Share this post


Link to post
Share on other sites

Hey Yakuzashi very nice tutorial! But is it possible to make a follower like Woby? I mean standart pet animation. There is also no information on this part. I would be grateful for any answer or possible hint. I'm new to this, but I really want to find at least something that will help

Share this post


Link to post
Share on other sites
Remnince    0

Thank you for posting this template, I'm rather new to this so it helps a lot!

I've run into an error when trying to use it and was hoping you might be able to help.

I was trying to add the follower to my character mod, but when I finished transferring and renaming things the new mod would cause the game to say "the mod is out of date" and then crash.

the link below should have the crash log, the working zip[before adding the mod], and the broken follower zip [after attempting to add the mod]

(I had to do the drive link because the files were too large)

https://drive.google.com/drive/folders/1uommEF5yiMaVY-RzEIVfonEDU4f2J2ts?usp=sharing

Edited by Remnince

Share this post


Link to post
Share on other sites
Yakuzashi    148

@Remnince @Dantekris2013 Sorry guys, I'm not in moding for a while but I know the great people on forum will help you. Just make separate threads for your issues.

Remnince - I think you need to use latest ESCTemplate and make changes manually

I know that I am not helpful right now fellas, sorry

  • Like 1

Share this post


Link to post
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
Sign in to follow this