Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2008, 05:26 PM
jenco420
Banned
 
Join Date: Jan 2006
Location: /dev/null
Posts: 99
Default Taunt

Alright been looking at taunt recently b/c i never get a failed message when a taunt so i peeked in special_attacks.cpp to see how taunt worked on eqemu.

Looking at the code i see that it can fail but it seems when ever i loose aggro and taunt it switches right back to me everytime?

Am i just crazy or has anyone else noticed this ? :P

Code:
float tauntchance;
		if(always_succeed) {
			tauntchance = 101;
		} else {
			
			// no idea how taunt success is actually calculated
			// TODO: chance for level 50+ mobs should be lower
			int level_difference = level - target->GetLevel();
			if (level_difference <= 5) {
				tauntchance = 25.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 65.0)
					tauntchance = 65.0;
			}
			else if (level_difference <= 10) {
				tauntchance = 30.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 85.0)
					tauntchance = 85.0;
			}
			else if (level_difference <= 15) {
				tauntchance = 40.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 90.0)
					tauntchance = 90.0;
			}
			else {
				tauntchance = 50.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 95.0)
					tauntchance = 95.0;
			}
		}
i noticed if(always_succeed) {tauntchance = 101; how does the server know when to use this? sorry i'm new to programming in general reading the code is pretty easy for the most part but i get confused easy sometimes ~.~
Reply With Quote
  #2  
Old 05-10-2008, 06:00 PM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

That's saying if always_succeed (probably for a discipline) then it's 100% chance.
Then 'else' (for all other cases), then it breaks it up into what level the person is using it and has a formula for each group. In the last group there should be a maximum of 95% chance that you are successful. The problem could be in the function that's calling tauntchance. It may just not properly be giving the fail message. But who knows.
This is the code for above lvl 15:
Code:
else {
				tauntchance = 50.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 95.0)
					tauntchance = 95.0;
or
tauntchance = 50 + (50 * (tauntskill / 200))
which isn't the best formula because at 200 taunt skill you'll have 100% chance, which will be 95% since there's a cap.
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #3  
Old 05-10-2008, 08:33 PM
jenco420
Banned
 
Join Date: Jan 2006
Location: /dev/null
Posts: 99
Default

and if you look further down the page you'll see

Code:
if (tauntchance > MakeRandomFloat(0, 100)) {
			// this is the max additional hate added per succesfull taunt
			tauntvalue = (MakeRandomInt(5, 10) * level);
			//tauntvalue = (sint32) ((float)level * 10.0 * (float)rand()/(float)RAND_MAX + 1);
			// new hate: find diff of player's hate and whoever's at top of list, add that plus tauntvalue to players hate
			newhate = who->GetNPCHate(hate_top) - who->GetNPCHate(this) + tauntvalue;
			// add the hate
			who->CastToNPC()->AddToHateList(this, newhate);
		}
		else{
			//generate at least some hate reguardless of the outcome.
			who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
		}
	}
	
	//generate at least some hate reguardless of the outcome.
	who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
}
so it's adding hate even it taunt fails? Wierd from what i remember if it failed you got no hate whatsoever (at least did'nt ever take aggo) so if i changed
Code:
else{
			//generate at least some hate reguardless of the outcome.
			who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
		}
	}
	
	//generate at least some hate reguardless of the outcome.
	who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
to
Code:
else{
			//generate at least some hate reguardless of the outcome.
			who->CastToNPC()->AddToHateList(this, (0));
		}
	}
	
	//generate at least some hate reguardless of the outcome.
	who->CastToNPC()->AddToHateList(this, (0));
would that mean that if your taunt failed you get no added hate what so ever?

Last edited by jenco420; 05-11-2008 at 04:35 AM.. Reason: I suck at the grammerz~
Reply With Quote
  #4  
Old 05-10-2008, 08:40 PM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

Yeah. Could break it though. I'm guessing they are sending 1 agro instead of 0 for a reason.
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #5  
Old 05-10-2008, 09:12 PM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

It actually looks like the hate is being generated twice at times.

I would think the second instance of
Code:
	//generate at least some hate reguardless of the outcome.
	who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
at the end of the function probably should be removed. It ends up adding hate even if player at the top of the hate list already, the taunted one is lower level than the taunter, or taunted is at 20% health or less.

It is also added after either the taunt succeeds and hate is added for that, or taunt fails and some hate is added for that.

I don't think that should be happening. I could be wrong.

As for getting it to add no hate when taunt fails, take out the above AND take out the following:
Code:
		else{
			//generate at least some hate reguardless of the outcome.
			who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
		}
I haven't tested it, but I think it should work.
__________________
Maybe I should try making one of these servers...
Reply With Quote
  #6  
Old 05-10-2008, 09:27 PM
jenco420
Banned
 
Join Date: Jan 2006
Location: /dev/null
Posts: 99
Default

cool i'll get this into my source and let ya know how it goes.
Reply With Quote
  #7  
Old 05-15-2008, 08:02 PM
jenco420
Banned
 
Join Date: Jan 2006
Location: /dev/null
Posts: 99
Default

Well after a few days tweking and rewriting some code Mouya and i came up with a good system for taunt (well based on my players feedback)

Replace

Code:
void Mob::Taunt(NPC* who, bool always_succeed) {
	if (who == NULL)
		return;
	
	if(DivineAura())
		return;
	
	if (!always_succeed && IsClient())
		CastToClient()->CheckIncreaseSkill(TAUNT);
	
	int level = GetLevel();
	
	Mob *hate_top = who->GetHateMost();
	
	// Check to see if we're already at the top of the target's hate list
	// a mob will not be taunted if its target's health is below 20%
	if ((hate_top != this) 
	&& (who->GetLevel() < level) 
	&& (hate_top == NULL || hate_top->GetHPRatio() >= 20) ) {
		sint32 newhate, tauntvalue;

		float tauntchance;
		if(always_succeed) {
			tauntchance = 101;
		} else {
			
			// no idea how taunt success is actually calculated
			// TODO: chance for level 50+ mobs should be lower
			int level_difference = level - target->GetLevel();
			if (level_difference <= 5) {
				tauntchance = 25.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 65.0)
					tauntchance = 65.0;
			}
			else if (level_difference <= 10) {
				tauntchance = 30.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 85.0)
					tauntchance = 85.0;
			}
			else if (level_difference <= 15) {
				tauntchance = 40.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 90.0)
					tauntchance = 90.0;
			}
			else {
				tauntchance = 50.0;	// minimum
				tauntchance += tauntchance * (float)GetSkill(TAUNT) / 200.0;	// skill modifier
				if (tauntchance > 95.0)
					tauntchance = 95.0;
			}
		}
		if (tauntchance > MakeRandomFloat(0, 100)) {
			// this is the max additional hate added per succesfull taunt
			tauntvalue = (MakeRandomInt(5, 10) * level);
			//tauntvalue = (sint32) ((float)level * 10.0 * (float)rand()/(float)RAND_MAX + 1);
			// new hate: find diff of player's hate and whoever's at top of list, add that plus tauntvalue to players hate
			newhate = who->GetNPCHate(hate_top) - who->GetNPCHate(this) + tauntvalue;
			// add the hate
			who->CastToNPC()->AddToHateList(this, newhate);
		}
		else{
			//generate at least some hate reguardless of the outcome.
			who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
		}
	}
	
	//generate at least some hate reguardless of the outcome.
	who->CastToNPC()->AddToHateList(this, (MakeRandomInt(5, 10)*level));
}
With

Code:
void Mob::Taunt(NPC* who, bool always_succeed) {
   if (who == NULL) // Make sure we have a target
      return;
   
   if(DivineAura())
      return;
   
   if (!always_succeed && IsClient()) // If the user is a Player and it's possible to fail, check to see if skill increases.
      CastToClient()->CheckIncreaseSkill(TAUNT);
   
   int level = GetLevel();
   
   Mob *hate_top = who->GetHateMost();
   
   // Check to see if we're already at the top of the target's hate list
   // a mob will not be taunted if its target's health is below 20%
   if ((hate_top != this)
   && (who->GetLevel() < level)
   && (hate_top == NULL || hate_top->GetHPRatio() >= 20) ) {
      sint32 newhate, tauntvalue;
      float tauntchance;

      int level_difference = level - target->GetLevel();
      tauntchance = 20.0 + (float)level_difference;
      tauntchance += tauntchance * ( (float)GetSkill(TAUNT) / 400.0);   // skill modifier
      
      if (tauntchance > 66.6) // TODO: Change this to whatever you want the maximum chance to taunt to be -- I picked a max of 66.6% success.
         tauntchance = 66.6;
      if (tauntchance < 0.0)
         tauntchance = 0.0; // TODO: Change this to whatever you want the minimum chance to taunt regardless of skill and level
      
      if ((tauntchance > MakeRandomFloat(0, 100)) || always_succeed) {
               // this is the max additional hate added per succesfull taunt, on live it always gave a set amount of hate change it to what you think it should add.
               tauntvalue = (10);
         // new hate: find diff of player's hate and whoever's at top of list, add that plus tauntvalue to players hate
         newhate = who->GetNPCHate(hate_top) - who->GetNPCHate(this) + tauntvalue;
         // add the hate
         who->CastToNPC()->AddToHateList(this, newhate);
         return;
      }
      //do nothing and give failed message
      Message(13, "You have failed to taunt your target.");
      return;
   }
}
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:52 PM.


 

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