PDA

View Full Version : pet dies when caster becomes invisible


nilbog
06-29-2009, 01:48 PM
I want to modify pets in a variety of ways..to make them function as they originally did on live.

I am new to making custom changes, so the methods I use are probably not correct at all.

#1. Pets die when their caster becomes invisible/hidden.

What is the correct way to go about this? I tried using SetPet(0) in attack.cpp, but no change.. probably because I don't know what I'm doing :D


#2. Pets die when their owner zones

I received errors when trying to use SetPet in client.cpp

#3. When an npc dies, its pet remains and fights until death.
I wasn't entirely sure where to find this. Only thing I found was in attack.cpp.

^ Results : Same as above

Any knowledge about how to make this work will be appreciated by the npcs of norrath.

Yeormom
06-29-2009, 02:18 PM
There is obviously a million ways to do this but if you have your heart on doing it while attacks are processing...

Scenario #1
if(this->CastToMob()->HasPet() && this->CastToMob()->IsInvisible())
this->CastToMob()->GetPet()->Kill();
this->CastToMob()->SetPetID(0);
CastToMob() is optional.

nilbog
06-29-2009, 02:25 PM
Oh.. my heart is not set in one direction or the other.. :)
I tried a few times to do this on my own and figured an example would help a lot. I will be satisfied with it working at all.

Thanks Yeormom, your example helps me see how this works/what methods I can use.

Yeormom
06-29-2009, 02:31 PM
You should technically do more checking when you implement something like that as well, like making sure GetPet() actually returns a pet and isn't null before you kill it for example.

Shin Noir
08-16-2009, 07:24 AM
in client_process.cpp at line 542 Below DoStaminaUpdate();


Mob* myPet = this->GetPet();
bool amClient = IsClient();

if(this->HasPet() && IsClient())
if(myPet->IsCharmed() && invisible == true && amClient) { //Null: charm fades on Invisibility
myPet->BuffFadeByEffect(SE_Charm);
myPet->AddToHateList(this, 100);
}
if(myPet && invisible == true && amClient) //Null: pet goes away on Invisibility
this->SetPet(0);


Namely it's the
if(myPet && invisible == true && amClient) //Null: pet goes away on Invisibility
this->SetPet(0);

lines. I didn't test this. I just noticed it while I was doing an old revision to newest that it had this code.

MNWatchdog
08-16-2009, 07:53 AM
Or just don't change it. It was a stupid thing anyways.

nilbog
08-16-2009, 12:03 PM
Or just don't change it. It was a stupid thing anyways.

Classic server demands classicness. :P Invisibility trivialized many aspects of the game as they made it less dangerous.



Thanks your post Shin Noir.. one of my developers made something for me a while ago, similiar to this:

defined a custom method for DitchPet

and then for spell effects each invis

if( IsClient() && GetPet() )
{
Client *client = CastToClient();

if( client ) client->DitchPet();
}
break;
}

MNWatchdog
08-19-2009, 03:36 AM
Not really. Anyways, a better way address your concern is to break invis. if the persons pet attacks.

Reason I never like this was it heavily penalized pet classes while non-pet classes suffered no ill from being invis. and all the advantages.

nilbog
08-19-2009, 11:05 AM
Everything is currently working as I hoped it would..

-pets die upon invis, or hide
-pets die when you zone..
-all pre-fixed duration invisibilities fade randomly
-npc pets remain and fight after their master is slain
-PC pets operate based on their owner's faction, so mobs will attack them


Anyways, a better way address your concern is to break invis. if the persons pet attacks.

Cool idea, might work for some on the non classic servers.

I played a magician from kunark - planes of power.. and I have to say, it was easy mode after a while.. running around with queued pets, while invisible..

http://classicbetatest.guildlaunch.com

So_1337
08-19-2009, 11:35 AM
All pre-fixed duration invisibilities fade randomly.
NPC pets remain and fight after their master is slain.
Both of those are how Live operated and how the emulator should operate. Any chance you plan to make that code available to be committed?

nilbog
08-25-2009, 02:24 PM
Both of those are how Live operated and how the emulator should operate. Any chance you plan to make that code available to be committed?

Submitted the changes necessary for persistent pets.

As far as invisibilities go, I'll try and get that together.. it isn't complete yet though, as it currently affects all invisibilities, including the fixed duration I believe.

So_1337
08-25-2009, 02:59 PM
Too cool, thank you =) I just know there are so many classic projects, and if there's one less thing to code manually between them, then they all benefit. Much appreciated!