PDA

View Full Version : Getting a pet to cast a heal spell


Xanathol
09-22-2020, 02:42 PM
I wanted to implement a cleric class temporary pet, so for testing purposes, I have changed the class on the mage air pet to a cleric and set the spell set to 1 (default cleric). As such, the pet will attack, cast yaulp, dds, and other buffs, but will never cast a heal (on itself, its owner, etc).

I tried disabling melee via 39^1 attribute and even made a new spell list of just the heal spells and set the list to use to it, but still no dice. I've even tried to make the pet a self only beneficial spell with the restricted spell list but all it does is target its owner - no spells.

Any thoughts?

ChaosSlayerZ
09-22-2020, 07:49 PM
hmm I also wanted to make heal pet way back.
Do your regular NPC cast heals?

Xanathol
09-23-2020, 12:39 AM
hmm I also wanted to make heal pet way back.
Do your regular NPC cast heals?

Good call - turns out, none of my NPCs that are clerics (at least) are healing. For ex. I pulled the 3 mobs in Maiden's Eye near Umbral zone line (all clerics) and took all of them to 8% health - no heals spells casts. They will buff when unaggro'd and cast yaulp or DDs while aggro'd but no heals.

Any clues?

ChaosSlayerZ
09-23-2020, 06:01 AM
Good call - turns out, none of my NPCs that are clerics (at least) are healing. For ex. I pulled the 3 mobs in Maiden's Eye near Umbral zone line (all clerics) and took all of them to 8% health - no heals spells casts. They will buff when unaggro'd and cast yaulp or DDs while aggro'd but no heals.

Any clues?

there use to be a rule in DB that was called - "npc buff/heal friends" - check if that one is on. On other hand they should always at least heal themselves.
I may need to check my own npcs ;)

Xanathol
09-23-2020, 10:23 PM
there use to be a rule in DB that was called - "npc buff/heal friends" - check if that one is on. On other hand they should always at least heal themselves.
I may need to check my own npcs ;)

Thanks but already checked that. :)

After a lot of debugging, I was able to get heals to work but no telling what all I broke in the process. Here's the changes I made.

In AICastSpell, under the switch for the AISpells[i].type, I commented out the line that prevents buffing PC pets:


switch (AIspells[i].type) {
case SpellType_Heal: {
LogAI( "AI NPC [{}]: Tar [{}] DontHealMeBefore [{}] [{}]", this->GetName( ), tar->GetName( ), tar->DontHealMeBefore(), Timer::GetCurrentTime() );
if (
(spells[AIspells[i].spellid].targettype == ST_Target || tar == this)
&& tar->DontHealMeBefore() < Timer::GetCurrentTime()
// && !(tar->IsPet() && tar->GetOwner()->IsClient()) //no buffing PC's pets
) {


In npc.cpp, under AICheckCloseBeneficialSpells, there is a check for indifferent faction which stops healing.


/**
* Indifferent
*/
// if (caster->GetPrimaryFaction() == 0) {
// return false;
// }


In the same function, there is a check to prevent you being healed, which seems unneccessary:


if (mob->IsClient()) {
// continue;
}


And then there is a faction check which makes no sense to me - never heal an NPC that has faction with you?!


if (mob->GetReverseFactionCon(caster) >= FACTION_KINDLY) {
// continue;
}



After all those changes, I can now summon my cleric pet and it will heal me or even another pet, which is what I was after.

Hopefully that helps you or any others out as well.

ChaosSlayerZ
09-24-2020, 07:42 PM
Very interesting, I am curious what devs think on this, why healing is disabled.