caravellex
02-03-2018, 09:57 PM
Hello, I've been trying to make NPCs buff players.
When I change this line of code from NPC_LIST to CLIENT_LIST the npcs buff players, but no longer buff other NPCS, how would I change it so they would buff both players and NPCS.
//Only iterate through NPCs
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
Mob* mob = it->second;
if (mob->GetReverseFactionCon(caster) >= FACTION_KINDLY) {
continue;
}
if (DistanceSquared(caster->GetPosition(), mob->GetPosition()) > iRange2) {
continue;
}
if ((iSpellTypes & SpellType_Buff) && !RuleB(NPC, BuffFriends)) {
if (mob != caster)
iSpellTypes = SpellType_Heal;
}
if (caster->AICastSpell(mob, 100, iSpellTypes))
return true;
}
return false;
}
When I change this line of code from NPC_LIST to CLIENT_LIST the npcs buff players, but no longer buff other NPCS, how would I change it so they would buff both players and NPCS.
//Only iterate through NPCs
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
Mob* mob = it->second;
if (mob->GetReverseFactionCon(caster) >= FACTION_KINDLY) {
continue;
}
if (DistanceSquared(caster->GetPosition(), mob->GetPosition()) > iRange2) {
continue;
}
if ((iSpellTypes & SpellType_Buff) && !RuleB(NPC, BuffFriends)) {
if (mob != caster)
iSpellTypes = SpellType_Heal;
}
if (caster->AICastSpell(mob, 100, iSpellTypes))
return true;
}
return false;
}