Jump to content

Need help with friendly mobs


Recommended Posts

Hello! I've been working on a mod for a while now and need help updating it with one of its main traits: which is that catcoons are friendly to the character.

First is: how do I make it so that, once I get near a catcoon, it will automatically follow me around? I'm looking for a similar behaviour as what spiders do with Webber, except without the need of feeding them to be domesticated.

And second is: how do I make it so that, in case I kill one of them, I lose sanity? I tried to copy Wormwood's sanity loss from killing plants and all but it was a mess-

Thanks in advance ;_;

Link to comment
Share on other sites

I suggest that for the catcoon follower part, you take a look at the spiderhat prefab. Equipping it causes nearby spiders to become your followers while the hat is equipped.

As for the kill, you could listen to the killed event on the player. Here's a rough example that may/may not work. It'll require editing either way though, since GetPlayer() should be replaced assuming you put this in the character prefab.

-- whether this works is entirely luck, i'm going off of memory here
GetPlayer():ListenForEvent("killed", function(inst, data)
    if data.prefab == "catcoon" then


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