Pet Capabilities

Looking through the various AI systems, I’m really interested how far we can push things in terms of an interactive world. Making it so pets looted things, wore gear, had more behaviors (patrol in a circle, stay in front of me, etc), auto looted pet gear, etc would all be “really neat.”

I think I figured out the auto-loot system, (requires testing) and I’m wondering if I can make it so pets loot things. There is a huge mod idea based around this, but I’m not sure it is possible. Has anyone tried to extend pets yet?

I found that the pets are full actors, the hellhound gets larger (scale increase) at level 26, that the knockdown resists increase, and can wear equipment. The skills could increase over levels, but they don’t. The hellhound has 75 poison and 500 fire resist. Yay overkill! The raven has crazy resists, some of which go up per level.

I’m not looking to make any pet into uber death incarnate, but I would like to provide depth of play to pets.

You can also add new models, new tex, new everything as you level. My skeleton knight starts out as a normal skeleton and ends up at 16 a blue burning revenant with ghost bones. It’s the same with weapons and such too, you can change them per mob a1 > a2 > a3 and give each upgraded weaponry/armor. They have a perfect system where pets could grow along side you in appearance and skill, its kinda odd they didn’t take advantage of it. But more advanced pet systems would definitely be something I’d want in game.

So is there any way to change what a pet has equipped on the fly such as tying it to a skill?

You can edit their loot tables to include items, and then check to see what they got by making them drop them as loot. “If you really want to play around, put some loot rolls from the mobs on the Initial Equipment finger slots, and turn on ‘dropItems’ in Monster Parameters.”

I need to experiment with this to see if it is actually implemented of course. They may only drop their loot if they actually die though.

If they could autoloot (which is why I looked into it) I would flag items for them specifically to autoloot, which would give them gear. Ideally they would only autoloot in “loot” stance instead of aggressive or defensive.

Alternatively, scripting an interface to give them gear. I haven’t found a hook to add it though.

There isn’t an example of “onAddItem” script call so that’s an intriguing dead end for the moment.

I’ve seen the scripting portion there. I know very little about it and have found virtually no information on it.

What do you know about? Do you have any places you can point me where I could at least learn some basics enough to start figuring it out on my own?

Well that definitely works! I can just sit in town summoning my familiar and look at the loot dropping.

Download the new PDF for a tutorial. Extract the game files. main.lua loads a few files, look through those. I searched for all the *.lua files and read about half of them (the quests are pretty similar, so the code to read them is pretty similar) A few key ones: homesteadmurderersandworse.lua devilscrossing.lua shared.lua areacquestmakingadeal.lua waveevent.lua and _mpquestcontrol.lua

Should be enough to teach about tokens, spawns, quests, state checks, loot spawns, etc. Checking for various parameters is important. I went looking and there is a lot of GiveItem HasItem and TakeItem, but not a single implementation of character:Move or character:GiveSkillPoints. (Even though you get a skill point early in game, it was done as a quest and they didn’t use a .lua file to do it.)

What we need to do for pet inventory:
Get Pet Entity ID (??)
Swap pet for a trade window or something (see the devilscrossingnpcinventor.lua and we can trigger a dialog, was thinking that the swap could occur through a right click and “manage” option)
Remove items from player
pet_trade window needs to examine the item (??)
pet_trade needs to read the inventory of the pet, and then return the item currently equipped as part of the trade.
remove item from player, add item to pet.
I’ve already confirmed that the pet can drop equipped gear as loot if they die or are dismissed.

I have no idea how to do most of that, and the API calls available in the manual doesn’t do half of that.

I’ve actually been reading through those over the last hour or so. I don’t know much about Lua yet but getting the pet entity id seems to be a huge wall. If we knew how to do that I imagine we could do a ton of stuff.

I’ve seen some examples in some quest dbr’s “scripts” section for things like onaddtoworld and ondestroy. Have you been able to figure out anything what entityhooks or characterhooks might be used for yet?

The only thing in the hud_petaggressive.dbr file is basic positioning of the image. All 3 stances have the same position in the dbr. That means the layout came from somewhere else. I searched the DBR files for a parent dbr, nope. I only found one reference to the hud_petaggressive.dbr and that was in Grim Dawn.exe - it is hard coded behavior so there is no entry point there. No “Pet Trade” by right click is possible.

Maybe an item that spawns it may be possible, no clue.

I also found the God Mode commands and some debugging commands, need to see how to enter them in :confused: character.SetPlayerInvisible lol

After finding out some of this stuff, I’m tempted to run game.KillMe

I should share something else: ui\hud\hud_playerstatusdisplay.dbr has the pet stats displayed. We can change the size of the bar, but nothing else apparently.