Jump to content

Beginner with custom character trait concept; Need opinions/suggestions/advice.

Recommended Posts


I'm new to modding and I'm working on a custom character concept. I'd like to know if this trait idea is feasible for a beginner (and, if not, if I could get some help with it)!

My idea is for one of the character's traits to be friends with the hounds. By "friends," I mean the hounds are not just passive to the character; they follow you and assist. Here's my ideal scenario:

  • You play as normal until the regular sounds preceding a hound attack begin, and the character will make a statement such as "my friends are coming." 
  • When the hounds arrive, they'll run up to the character as normal, but instead of attacking, they'll begin to follow you (without needing to be befriended). 
  • Any time combat begins, the hounds will attack on your behalf. Ideally, I'd like them to attack whether or not you choose to engage, making them both an asset (great for killer bee attacks, dealing with Mactusk, and other aggressive mobs) and a potential hindrance (you could easily lose them if you accidentally lead them within striking distance of Eyeplants, for instance). So basically, any time you take or deal damage, they'll attack. 
  • After 24 hours game time, if they haven't been killed, they should leave. Rather than just abruptly disappearing, I'd like them to run off screen and despawn. 

How does this sound? Am I in completely over my head here? 

Link to comment
Share on other sites

I've started working on this, and naturally I'm running into some issues. I gave my character the tag "houndfriend", which worked as expected, so I decided to work on getting the hounds to follow me. I realized I basically wanted them to behave like Abigail, so I pretty much copied her brain file with some small alterations. Here's what I ended up with:

local function ModHound(inst)
if GLOBAL.GetPlayer().prefab == "p64" then
require "behaviours/follow"
require "behaviours/wander"

local MIN_FOLLOW = 4
local MAX_FOLLOW = 11
local MED_FOLLOW = 6
local MAX_WANDER_DIST = 10
local MAX_CHASE_TIME = 6

local function GetFaceTargetFn(inst)
    return inst.components.follower.leader

local function KeepFaceTargetFn(inst, target)
    return inst.components.follower.leader == target

function ModHound:OnStart()

    local root = PriorityNode(
		ChaseAndAttack(self.inst, MAX_CHASE_TIME),
		Follow(self.inst, function() return 

self.inst.components.follower.leader end, MIN_FOLLOW, 

		--FaceEntity(self.inst, GetFaceTargetFn, 

        Wander(self.inst, function() return Point(GetPlayer

().Transform:GetWorldPosition()) end , MAX_WANDER_DIST)        
    }, .5)
    self.bt = BT(self.inst, root)

AddPrefabPostInit("hound", ModHound)

I'm able to launch the game, start a new save slot, and everything works fine. When I debug spawn a hound, the sidebar and the inventory slots disappear. The hound runs off and begins attacking everything in sight, so it doesn't even seem to be responding to the modifications at all. 

Can I get some help with this? 

Link to comment
Share on other sites


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...