View Single Post
  #1  
Old 08-25-2009, 02:21 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default npc persistent pets

Per request of So_1337, here's the code necessary to make npc pets remain and fight after their master is slain.

This change brought to you by Ladoth, bringer of classic code. He is the lead source developer for project1999, and without him, we wouldn't have lots of cool stuff.

in zone/mob.cpp, change this

line 1420
Code:
void Mob::SetOwnerID(int16 NewOwnerID) {
	if (NewOwnerID == GetID() && NewOwnerID != 0) // ok, no charming yourself now =p
		return;
	ownerid = NewOwnerID;
	if (ownerid == 0 && this->IsNPC() && this->GetPetType() != petCharmed)
		this->Depop();
}
to this

Code:
void Mob::SetOwnerID(int16 NewOwnerID) {
	if (NewOwnerID == GetID() && NewOwnerID != 0) // ok, no charming yourself now =p
		return;

	// @LADOTH 07182009 don't depop a pet for NPC owners
	Mob* oldowner = entity_list.GetMob(ownerid);

	ownerid = NewOwnerID;
	if (ownerid == 0 && this->IsNPC() && this->GetPetType() != petCharmed && oldowner && oldowner->IsClient())
		this->Depop();
}
Reply With Quote