Mods / Pet AI

Category: #Creatures #Library
Author: Gerste
Side: Both
Created: Nov 20th 2021 at 8:39 PM
Last modified: Oct 22nd at 5:05 PM
Downloads: 23917
Follow Unfollow 154

Russian translation provided by Mamoru Mondai.

French translation by Cendar.

Small library containing a variety of AI Behaviors and Tasks that i consider useful for domesticating/ taming animals.

Now includes ModConfig:

  •     "tamingMultiplier": Increase value for easier taming
  •     "obedienceMultiplier": Increase value for easier obedience gain
  •     "disobedienceMultiplier": Decrease value for less obedience
  •     "growingMultiplier": Decrease value for less growth time
  •     "resurrectors": Contains a List of items that can revive a dead pet

There is some API Information for modders documented in the mods README.

If you want to create your own pets with this system but can not figure out how just by looking at my other taming mods, feel free to ask me directly: G3rste#1850

Version For Game version Downloads Release date Changelog Download
v1.5.5 2756 Oct 22nd at 5:05 PM Show petai_v1.5.5.zip
v1.5.4 2984 Sep 2nd at 5:37 PM Show petai_v1.5.4.zip
v1.5.3 486 Aug 14th at 4:30 PM Show petai_v1.5.3.zip
v1.5.2 270 Jul 28th at 8:46 PM Show petai_v1.5.2.zip
v1.5.1 509 Jul 1st at 9:26 PM Show petai_v1.5.1.zip
v1.5.0 161 Jun 26th at 3:21 PM Show petai_v1.5.0.zip
v1.4.4 5344 Apr 29th at 7:01 PM Show petai_v1.4.4.zip
v1.4.3 809 Apr 20th at 6:44 PM Show petai_v1.4.3.zip
v1.4.2 1293 Apr 5th at 4:12 PM Show petai_v1.4.2.zip
v1.4.1 203 Apr 4th at 6:02 PM Show petai_v1.4.1.zip
v1.4.0 216 Apr 3rd at 1:30 PM Show petai_v1.4.0.zip
v1.3.7 1502 Mar 10th at 8:44 PM Show petai_v1.3.7.zip
v1.3.6 676 Mar 5th at 12:28 AM Show petai_v1.3.6.zip
v1.3.5 1328 Feb 15th at 6:29 PM Show petai_v1.3.5.zip
v1.3.4 1123 Feb 5th at 4:41 PM Show petai_v1.3.4.zip
v1.3.3 286 Feb 4th at 11:29 PM Show petai_v1.3.3.zip
v1.3.2 475 Feb 1st at 6:38 PM Show petai_v1.3.2.zip
v1.3.1 329 Jan 31st at 10:27 PM Show petai_v1.3.1.zip
v1.3.0 348 Jan 30th at 4:17 PM Show petai_v1.3.0.zip
v1.2.1 1239 Jan 5th at 7:47 PM Show petai_v1.2.1.zip
v1.2.0 239 Jan 2nd at 6:46 PM Show petai_v1.2.0.zip
v1.1.0 426 Dec 11th 2021 at 7:03 PM Show petai_v1.1.0.zip
v1.0.2 406 Nov 23rd 2021 at 10:42 PM Show petai_v1.0.2.zip
v1.0.1 281 Nov 22nd 2021 at 7:58 PM Show petai_v1.0.1.zip
v1.0.0 228 Nov 21st 2021 at 9:42 PM Show petai_v1.0.0.zip

51 Comments (oldest first | newest first)

💬 Gerste, 5 days ago

The pet bed no longer has a UI. Pets will seek it by themselves once tired. LadyBlakeHammer

💬 LadyBlakeHammer, 6 days ago

How do you open the UI for the pet bed?

💬 gndrneutralnoun, Oct 12th at 9:26 PM

Okay, cool. Problem: My wolf died, and I'm trying to heal it, but using poultices (specifically horsetail linen) with right click just heals me. Edit: Using a clean bandage worked, but you might want to make the action ctrl-right click or something so that others don't run into the same problem.

💬 Gerste, Oct 12th at 9:22 PM

I completely removed the auto respawning of pets and most of the related stuff because it was not working properly. Pets should now sometimes seek their nests without the need of bein assigned to them. gndrneutralnoun

💬 gndrneutralnoun, Oct 12th at 5:36 PM

I seem to remember that in previous versions you had to enable pets reviving via config. Do they automatically revive now? Do I have to use a resurrector item on their body, on their nest, or what? Also, I can't seem to assign pets to a bed anymore. Was that feature removed or am I missing something?

💬 Gerste, Oct 1st at 6:23 PM

Thats a new one, can you dm me the details on discord? Yiasafrai

💬 Yiasafrai, Oct 1st at 11:04 AM

i have no option to rename my pets whilst my friends on the same server do. I've tried resinstalling the mod. not sure what to do.

💬 Gerste, Aug 14th at 4:31 PM

I turned down the whistle sound in the newest version. You don´t need such a config, just set the dogs aggression level to neutral or passive and this should no longer be an issue. Foolish

💬 Foolish, Aug 7th at 3:16 AM

I second that the whistle is loud as heck.

 

Can you add a server config option so that tamed animals don't attack other players. We like to mess around on my server and an option to not be attacked when we hit each other (usually with sticks) would be nice.

💬 Shion, May 5th at 11:54 PM

Can you make the whistling sound not that loud?

Would also be nice to be able to wear pet wistle as a necklage.

💬 PeterSanderson, Apr 30th at 3:03 AM

Thanks Gerste, I was able to figure out what the issue was and was able to sort it out. The pens were not lit and drifters were attacking and killing them. Error on my part sheepish grin :)

💬 Gerste, Apr 29th at 5:48 PM

Is this for all commands? What command and arguments are you using?

The wolfs could despawn in darker areas in previous version as this was the default for all animals off the vanilla game too. Should not happen in the newest version though. PeterSanderson

💬 Gerste, Apr 18th at 9:43 PM

You should be able to craft a whistle using a chisel too because of that tincancrab

💬 tincancrab, Apr 15th at 3:40 AM

Looks like the whistle competes with Primitive Survival, even though Cats can use fish from it, but unfortunately, when trying to make a whistle, I can only make a bone fish hook. Or am I doing it wrong?

💬 Gerste, Apr 5th at 8:08 AM

Looks like there is an old version of petai in their folders.

Can you try removing the ModsByServer folder or manually checking if there is still a pre-1.4.0 petai version laying around somewhere? DEMMERS

💬 DEMMERS, Apr 5th at 12:10 AM

Using latest 1.4.1,
Mod is on the server, clients joining the server see this:
System.Exception: Don't know how to instantiate block of class 'PetNest' did you forget to register a mapping?
at Vintagestory.Common.ClassRegistry.CreateBlock(String blockClass)
at Vintagestory.Common.BlockTypeNet.ReadBlockTypePacket(_A1oClULOCEj4s2RtiXvbRAocH0N packet, IWorldAccessor world, ClassRegistry registry)
at Vintagestory.Client.NoObf.GeneralPacketHandler.HandleServerAssetsStep1()
at Vintagestory.Client.NoObf.ClientMain.ExecuteMainThreadTasks(Single deltaTime)
at _eaiE9OWXDVmX2r6n7JaWPscBEkO._LvzIyYpsQCoC78JubjSO0HCjtTg(Single )
at _lAuHsYOBOAjBMdATFXwLUtH7N00._JvY4M2412YZu1OS3Ull8wgZBu1j(Single )
at _lAuHsYOBOAjBMdATFXwLUtH7N00._KmBeEx15nyyLrVqNDW6geSArpNr(Single )
at Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(Object sender, FrameEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at OpenTK.GameWindow.RaiseRenderFrame(Double elapsed, Double& timestamp) in C:\Users\Nexrem\Desktop\transfer\opentk\src\OpenTK\GameWindow.cs:line 479
at OpenTK.GameWindow.DispatchRenderFrame() in C:\Users\Nexrem\Desktop\transfer\opentk\src\OpenTK\GameWindow.cs:line 454
at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second) in C:\Users\Nexrem\Desktop\transfer\opentk\src\OpenTK\GameWindow.cs:line 375
at _TRhArnJABwZoV9Vt7Ld2l65Xzgg._mhlr8s7wtMvxaJGpVy2Ag90jUBK(_3HJA5NvAIx31LXjscc3HGjXaR6q , String[] )
at _q0zAVOrWbMX04rMA9G3HIFVuGjA._mhlr8s7wtMvxaJGpVy2Ag90jUBK(ThreadStart )

💬 DX65, Mar 15th at 4:37 PM

@Gerste Thanks I just wasn't sure so I asked I thought it would be nice alternative to having chickens that don't all run in the corner of their pens if they see the player as someone who cares for them. I mainly play in creative and thought it would be nice if there was tool to raise baby animals like chicks and goats.

💬 Gerste, Mar 14th at 5:35 PM

PetAI itself does not introduce any new pets. It is just providing some nessecary tools to create pets. But these pets come from other mods. Currently there are dogs, cats, horses and pack animals.
If you wanted to make your own pets, you could look those up as examples and go from there.

Regarding your other question, I implemented a very basic system that introduces nests. It lets you define custom blocks that pets use to sleep on. DX65

💬 DX65, Mar 13th at 8:42 PM

So is it currently only pet wolves? Could I have pet chickens or goats? Can I set homes i.e. areas they live or do they have to follow me everywhere?

💬 Gerste, Mar 5th at 12:43 PM

Nope, pets still use the base game pathfinder which doesn´t consider them dangerous. Messing with the pathfinding is quite a hassle so i am probably going to leave that be for now :(. Shion

💬 Shion, Mar 5th at 3:24 AM

Is pets habit of going into open fire (the clay pits) removed in this update?

💬 Gerste, Feb 27th at 5:29 PM

Not yet. Lumber

I really want to implement houses for pets where they go if killed and where you can recall them to if they are lost.

Currently I am working on another side project, but once that hast its first release I plan on revisiting the petAI code and adding this feature together with fixing the breeding stuff Oke518.

💬 Lumber, Feb 27th at 4:28 PM

Is there any way to recall pets? Mine had died during a storm, and I was out wandering the world when they spawned back in a day later. They are out in unloaded chunks somewhere and I'm not sure how to find the jerks. :)

💬 Oke518, Feb 26th at 4:00 PM

on load my doges are breeding een though its toggled off.

💬 Gerste, Feb 19th at 12:03 PM

There is an open issue on my github page regarding this issue where I am posting snapshot versions for serverowners to download and test. 
I could use more testers on this issue so I would be grateful if you took a look there.

It would be of great help if you could provide more information like:

  • How many pets are there on the server
  • How does the petseekentity task compare to the vanilla seekentity task (used by wolfes, hyenas, ...)
  • what aggressionlevel are the pets set to

If you are interested here is the newest snapshot version also posted on github: petai_snapshot.zip

YourCreator

💬 YourCreator, Feb 19th at 9:37 AM

PetAi mods eats perfomance on server greatly. 
55 mods active with PetAi, FeverHorses, Cats, Dogs.
If i adds CreaturesAndCritters server took tick time more than 700ms
->

19.2.2022 10:08:49 [Notification] A tick took 102,29ms
entity-ai-tasks-tick-start-execPetAI.AiTaskPetSeekEntity: 66,31ms
sleep: 27,64ms
entity-done-bh-repulseagents: 1,59ms
entity-controlledphysics-end: 1,35ms
gmleVintagestory.GameContent.EntityPartitioning: ,58ms
entity-done-bh-timeddespawn: ,58ms
entity-done-bh-harvestable: ,35ms
entity-done-bh-controlledentityphysics: ,24ms

19.2.2022 10:08:52 [Notification] A tick took 119,59ms
entity-ai-tasks-tick-start-execPetAI.AiTaskPetSeekEntity: 71,51ms
sleep: 38,68ms
entity-done-bh-emotionstates: 1,66ms
entity-done-bh-repulseagents: 1,48ms
entity-controlledphysics-end: 1,15ms
entity-done-bh-timeddespawn: ,56ms
gmleVintagestory.GameContent.EntityPartitioning: ,54ms
entity-done-bh-harvestable: ,3ms

19.2.2022 10:08:54 [Notification] A tick took 121,27ms
entity-ai-tasks-tick-start-execPetAI.AiTaskPetSeekEntity: 67,54ms
sleep: 37,99ms
gmleVintagestory.GameContent.EntityPartitioning: 7,25ms
entity-done-bh-repulseagents: 1,94ms
entity-controlledphysics-end: 1,16ms
ss-tick-Vintagestory.Server.ServerSystemCompressChunks: ,81ms
entity-done-bh-timeddespawn: ,53ms
entity-done-bh-controlledentityphysics: ,24ms

19.2.2022 10:08:57 [Notification] A tick took 105,32ms
entity-ai-tasks-tick-start-execPetAI.AiTaskPetSeekEntity: 71,52ms
sleep: 25,1ms
entity-done-bh-repulseagents: 1,67ms
entity-controlledphysics-end: 1,35ms
gmleVintagestory.GameContent.EntityPartitioning: ,62ms
entity-done-bh-timeddespawn: ,59ms
entity-done-bh-controlledentityphysics: ,25ms
entity-done-bh-floatupwhenstuck: ,23ms

💬 Gerste, Feb 13th at 5:50 PM

The error ocurred in the horse mod and will probably be fixed in the next version. Aledark

Thanks for pointing that out, I will add another recipe for the whistle in the next version that maybe uses a chisel or somthing to prevent this from happening.

There is currently no bowl implemented and its currently not planned, but maybe that changes in the future. Lisabet

💬 Aledark, Feb 13th at 8:04 AM

Also posted on ferverstone github :) but those might be interlink so figured id report it to you and them.

1.16.3 stable- with pet ai(petai_v1.3.4.zip) and feverstonehorse(FeverstoneHorses-v1.2.4-1.16.x)

from server-main.txt

13.2.2022 02:36:16 [Error] System.NullReferenceException: Object reference not set to an instance of an object.
at Vintagestory.GameContent.EntityBehaviorHarvestable.SetHarvested(IPlayer byPlayer, Single dropQuantityMultiplier)
at Vintagestory.GameContent.ItemKnife.OnHeldInteractStop(Single secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel)
at Vintagestory.Server.ServerSystemInventory.HandleHandInteraction(_EWaCktsS2JyUbMhFd5RdMtCiCZOA packet, ConnectedClient client)
at Vintagestory.Server.ServerMain.ProcessNetMessage(NetIncomingMessage msg, NetServer mainSocket)

13.2.2022 02:36:21 [Error] Error thrown trying to serialize entity with code feverstonehorses:horse-male, will not save, sorry! Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at PetAI.EntityPet.getInventoryTree()
at PetAI.EntityPet.ToBytes(BinaryWriter writer, Boolean forClient)
at Vintagestory.Server.ServerChunk.BeforeSerialization()
13.2.2022 02:26:08 [Error] Error thrown trying to serialize entity with code feverstonehorses:horse-female, will not save, sorry! Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at PetAI.EntityPet.getInventoryTree()
at PetAI.EntityPet.ToBytes(BinaryWriter writer, Boolean forClient)
at Vintagestory.Server.ServerChunk.BeforeSerialization()

💬 Lisabet, Feb 13th at 1:14 AM

also, is it possible to have a pet bowl (if it doesn't exist and I don't see notes on it lol) so that once you've tamed and reached 100 obedience, the cats/dogs can eat from a pet bowl/dish?

💬 Lisabet, Feb 13th at 12:48 AM

it seems the whistle has a 'fixed' recipe (knife under bone in the window) while bone hooks have a...formless? recipe; bone and knife in window, regardless of position

my guess is primitive survival needs to have a fixed recipe as well, so that it doesn't clash with anything else that uses a bone and knife lol

 

edit since I play singleplayer, a very quick easy 'fix' is to temporarily disable primitive survival, load in and make the whistle, close the server and reenable primitive survival

edit 2 if you try that quick fix, make sure you don't have anything in hollow log containers before disabling primitive survival lol

💬 MKJwhoa95, Feb 12th at 1:28 AM

I'm having the same issue as CaveSalamander as well. Also using ver 1.3.4. with VS #v1.16.3. Perhaps Primitive Survival also needs a compatibility patch for it to be fully fixed.

💬 CaveSalamander, Feb 11th at 6:04 PM

@Gerste seems so. I'm using ver 1.3.4, and pr.surv. ver 2.8.0

💬 Gerste, Feb 11th at 7:43 AM

Still? I thought I fixed this since verson 1.3.1 CaveSalamander

💬 CaveSalamander, Feb 11th at 3:03 AM

Small conflict with Primitive Survival, their bone fishing hook overrides the pet whistle recipe. Not sure which mod's author to mention this to ^-^

💬 Gerste, Feb 8th at 8:00 PM

Don´t worry, you are not going crazy. There is a couple of modders who currently is implementing a horse mod using the PetAI system. I already implemented the neccessary systems in this library for riding and stuff so that everything is ready once their mod is finished :) Lash 

💬 Lash, Feb 8th at 8:22 AM

Keep seeing you mention mounts in the changelog. Is there a mount mod somewhere or am I going crazy?

💬 Evadx, Feb 5th at 5:05 PM

Man, that was fast. It works now! Thanks for the fix!

💬 Gerste, Feb 5th at 4:42 PM

Should be fixed in petai_v1.3.4. Should also prevent the constant teleporting when following. Evadx

💬 Evadx, Feb 5th at 3:45 PM

alright, so I've tamed two dogs, and I tried to use a bone on one that was over a trunk and a pottery vessel, and all containers stopped being able to be opened, regardless of whether a bone was in my hand or not. I then get this error in the event log when trying to load in to the game again:

5.2.2022 10:39:50 [Fatal] System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at Vintagestory.Essentials.WaypointsTraverser.get_CurrentTarget()
at Vintagestory.GameContent.AiTaskSeekEntity.ContinueExecute(Single dt)
at Vintagestory.GameContent.AiTaskManager.OnGameTick(Single dt)
at Vintagestory.GameContent.EntityBehaviorTaskAI.OnGameTick(Single deltaTime)
at Vintagestory.API.Common.Entities.Entity.OnGameTick(Single dt)
at Vintagestory.API.Common.EntityAgent.OnGameTick(Single dt)
at Vintagestory.Server.ServerSystemEntitySimulation.TickEntities(Single dt)
at Vintagestory.Server.ServerSystemEntitySimulation.OnServerTick(Single dt)
at Vintagestory.Server.ServerMain.Process()

I disabled all your pet mods, and it loaded fine. Thanks for taking a look at this.

💬 Gerste, Feb 4th at 11:42 PM

Fixed in petai_v1.3.3. There is now a small button on the top-right of the command interface that lets you rename your pets. CreativeRealms

💬 CreativeRealms, Feb 3rd at 12:20 AM

Would it be possible to allow naming/renaming in the command menu after an animal has been tamed? I livestream and closed the prompt for later since my viewers can redeem a reward for renaming animals. However, it seems as though there is no longer a way for me to name it should I wish to do so in the future.

💬 iotid, Jan 28th at 7:22 AM

The purrs and hisses are good!  The meow is the one that really carries--had a cat easily 50 or 60 blocks away that was about twice the volume of everything else immediately near me.  Haven't had any issues with dog sounds, either, they're good.

💬 Gerste, Jan 27th at 7:16 PM

I can try and turn the volume down for the cat sounds.

What sounds do you experience as too loud? Just the meow, or also the purring and hissing? iotid

💬 iotid, Jan 27th at 1:33 PM

Might I make a request for a config option to mute the animals using this library?  Cats in particular have been out-of-place loud on our server, even from a long distance.  :<

💬 Gerste, Jan 21st at 8:48 PM

Thank you very much. I will include all your translations in my next feature update :) Cendar

💬 Cendar, Jan 19th at 4:30 AM

Hi! I made a french translation for your mod, feel free to add it if you want. 😊

fr.json - petai 1.2.1

💬 Briaireous, Jan 18th at 11:23 PM

would be very cool if you can make it so that pets would show up on the minimap

💬 Gerste, Nov 24th 2021 at 12:02 PM

This mod is already designed to do this. You just need to add the Tameable and ReceiveCommand to your entities as well as the corresponding AI Tasks.
You can check this out by looking at the cat and dog entities of my other mods, but if you have any specific questions, feel free to ask: G3rste#1850

💬 WickedSchnitzel, Nov 24th 2021 at 9:31 AM

Maybe you could create a mod with some config where people would just have to place a specific entity code and then would be able to give commands to all sort of animals, even custom ones?

💬 Gerste, Nov 24th 2021 at 8:39 AM

Should be fixed in v1.0.2.

💬 Verlia, Nov 23rd 2021 at 3:37 AM

Bug; Game crash/error;

Version: v1.15.9 (Stable)11/22/2021 9:32:34 PM: Critical error occurred System.NullReferenceException: Object reference not set to an instance of an object. at PetAI.EntityBehaviorTameable.disobey(Single intervall)

(edit comment delete)