Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-03-2010, 09:45 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

This issue is very odd indeed. After reviewing the source code for the perl Damage function as well as the Damage and CommonDamage functions in attack.cpp and seeing where the HP Events get parsed as well, I cannot figure out how this issue is occurring. I don't see why the perl Damage command would be any different than any other type of damage, and I really don't see what it would have to do with setting the hp event to -1.

Here is an example script that reproduces the problem 100%:

Code:
my $nexthp = 99;

sub EVENT_SPAWN {

	quest::setnexthpevent($nexthp);

}


sub EVENT_HP {
	my $HP_RATIO_CHK = int($npc->GetHPRatio());
	quest::gmsay("Script Debug - HPEvent $hpevent, HPRatio $HP_RATIO_CHK");
	
	if ($hpevent == -1)
	{
		quest::setnexthpevent($HP_RATIO_CHK);
		$nexthp = $HP_RATIO_CHK;
		quest::gmsay("Script Debug - Correcting Next HP Event to $HP_RATIO_CHK");
	}
	
	# Set a new HP Event to occur with every 1% of NPC HP loss
	if($hpevent == $nexthp) {
		
		$nexthp = $hpevent - 1;
		quest::gmsay("Script Debug - HPEvent $hpevent, HPRatio $HP_RATIO_CHK, NextHPEvent $nexthp");
		if ($hpevent == -1)
		{
			quest::setnexthpevent($HP_RATIO_CHK);
		}
		else
		{
			quest::setnexthpevent($nexthp);
		}
	}

}


sub EVENT_AGGRO_SAY {

	if ($status > 80) {

		if($text =~ /Damage/i)
		{
			$npc->Damage($client, 1000, 0, 28, 0);
			quest::say("Damaging now");
		}

	}

}

sub EVENT_SAY {

	if ($status > 80) {

		if($text =~ /Damage/i)
		{
			$npc->Damage($client, 1000, 0, 28, 0);
			quest::say("Damaging now");
		}

	}

}
Just put that on an NPC that has 100k HPs, and say "damage" to it a few times. You can attack normally or even #damage it and the HP Events will function as they should, but as soon as you say "damage" to it, it will set $hpevent to -1.

I set this example script to automatically recover from $hpevent getting set to -1, but that isn't a real solution to the problem. This is just puzzling the heck out of me. As far as I can tell, the only times that $hpevent are set to -1 is when the NPC is first spawned and when the last quest::setnexthpevent() in the script has been used.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
 


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 01:11 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