Reserving energy for a pet; despawn pet to regain energy

I’m still getting the hang of how things work in Grim Dawn’s engine, so I’m not exactly sure how to go about this. I understand that dbr files use templates to give the list of parameters you can edit in them, but I’m not exactly sure how to put this information into practice.

My end goal is to make a pet that, while summoned, reserves a chunk of the character’s mana ( and possibly incurring an active energy cost ). Using the spell again unsummons the pet, releasing the reserve. Should I make a new template that includes the typical summon templates ( base, activated, spawning ) as well as Parameter_Character to reserve the mana? Somehow I don’t see the game automatically making the connection that the reserve is supposed to happen while the pet exists. Maybe instead the pet itself somehow imposes the reserve? And then, how would the pet’s existence be tied to toggling the skill?

Creating a template isn’t really an option for many things, just because you can add a field into the template/dbr doesn’t mean it will actually work. Chances are you won’t be able to create a reserve for a pet.

What you’re wanting to do… not sure it’s possible but you can tinker around with workarounds using autocast triggers or pet skills.

Okay, understood. I’m looking into the pet skills route now, and I’m thinking if I make the pet have an aura buff with a large radius, one of its effects can be to apply a mana limiter. The million dollar question here is, can I make an aura buff affect only the pet owner, and not the other players in their party?

No you can’t make an aura that only applies to a certain player.
Also you can not make an aura that will reserve energy of someone else other than the caster himself.
You could try to add a negative energy regeneration to the aura but it will apply to everybody in the party.

As for auto casts, you can try to add an auto casted aura after the summon to reserve energy of the caster but you won’t be able to deactivate it on pet despawn.

The only way that comes to my mind is that you make a huge energy cost to spawn the pet which it transfers back on despawn by casting a skill that return energy to the player when it dies.
The only downside is you can most likely not controll to whom the skill is casted if it is a single targeted cast and if it is not, it will return energy to the entire party.
There is a chance that you can change this behaviour by changing the pet’s controller’s Skill Usage (healLeaderHealthPercentage) but I never tested how this exactly works so no guarantee.

Also despawning a pet with the same skill only works by setting the summon limit to 1 and spawn a new one on clicking the skill, which will automatically despawn the old one (but also summon a new one and therefore cost the same energy again)
You’re hitting the limits of the engine here unfortunatelly. There is no skill or skill combination that was thought to work this way and you also can not simply introduce entire new skilltypes.

Also another information regarding dbrs and templates: Templates are only a text representation for the DBREditor and not for the game so creating new templates does not change anything in the behaviour of a skill.

What actually matters is the class of the skill, which has a defined set of options the game will read and interpret to cast the skill. Adding new ones or other ones from different skills will most of the time not work unless the game’s internal representation has this property for the skill you are targetting and it is just not written into it’s provided template for some reason.

This is all super useful information, thanks so much =)

Afterthought; I noticed there’s some lua code hanging around in the game files. Can that be used to any great effect, say for example… have a toggled buff ability that auto-casts a pet, and the pet has lua code that causes it to rapidly die if not under the influence of the toggle buff?