Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2009, 01:48 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default pet dies when caster becomes invisible

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


#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.
Reply With Quote
  #2  
Old 06-29-2009, 02:18 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

There is obviously a million ways to do this but if you have your heart on doing it while attacks are processing...

Scenario #1
Code:
if(this->CastToMob()->HasPet() && this->CastToMob()->IsInvisible())
    this->CastToMob()->GetPet()->Kill();
    this->CastToMob()->SetPetID(0);
CastToMob() is optional.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #3  
Old 06-29-2009, 02:25 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

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.
Reply With Quote
  #4  
Old 06-29-2009, 02:31 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

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.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #5  
Old 08-16-2009, 07:24 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
Default

in client_process.cpp at line 542 Below DoStaminaUpdate();

Code:
                        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.
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #6  
Old 08-16-2009, 07:53 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Or just don't change it. It was a stupid thing anyways.
Reply With Quote
  #7  
Old 08-16-2009, 12:03 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

Quote:
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

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

if( client ) client->DitchPet();
	}
	break;
	}
Reply With Quote
  #8  
Old 08-19-2009, 03:36 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

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.
Reply With Quote
  #9  
Old 08-19-2009, 11:05 AM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

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

Quote:
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
Reply With Quote
  #10  
Old 08-19-2009, 11:35 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

Quote:
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?
Reply With Quote
  #11  
Old 08-25-2009, 02:24 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

Quote:
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.
Reply With Quote
  #12  
Old 08-25-2009, 02:59 PM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:38 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3