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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2014, 09:58 AM
Melcrin
Fire Beetle
 
Join Date: Dec 2007
Location: home
Posts: 13
Default Newby Needs a Hand

I have recently been trying my hand at writing encounter scripts and while I have had some success I have found a few hangups I can't overcome.

My issue with the encounter I have set up is I cannot seem to get the second $hpevent variables to work. Here is a copy of my encounter. I would be much obliged if someone can help me out. Also any simple pointers would be awesome. I just started delving into this a week ago.

Code:
sub EVENT_SPAWN
{
	quest::shout("You will regret trespassing in my kingdom!");
	quest::setnexthpevent(75);
}
sub EVENT_HP
{
	quest::emote("quaffs a magical elixir.");
	quest::shout("Now you will die!");
	quest::npcsize(9);
	quest::modifynpcstat("min_hit",70);
	quest::modifynpcstat("max_hit",120);
	quest::setnexthpevent(50);
}
if($hpevent==50)
{
	quest::shout("Guards!");

my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();

	quest::spawn2(11174,0,0,$x+5,$y+5,$z,$h);
	quest::spawn2(11175,0,0,$x+5,$y-5,$z,$h);
}
sub EVENT_AGGRO
{
	quest::emote("lunges at you.");
	quest::shout("Me thinks you will make an excellent $race stew!");
}
sub EVENT_DEATH
{
	quest::emote("whimpers in pain.");
	quest::shout("My spleen!");
}
sub EVENT_SLAY
{
	quest::emote("laughts at $targetname.");
}
Reply With Quote
  #2  
Old 03-04-2014, 10:01 AM
Dunge0nMastr
Hill Giant
 
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
Default

Currently you are closing your sub EVENT_HP out before the next hpevent.

Code:
sub EVENT_HP
{ 
	quest::emote("quaffs a magical elixir.");
	quest::shout("Now you will die!");
	quest::npcsize(9);
	quest::modifynpcstat("min_hit",70);
	quest::modifynpcstat("max_hit",120);
	quest::setnexthpevent(50);
} #Closing the event early
if($hpevent==50)
{
	quest::shout("Guards!");

my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();

	quest::spawn2(11174,0,0,$x+5,$y+5,$z,$h);
	quest::spawn2(11175,0,0,$x+5,$y-5,$z,$h);
}
Should be:

Code:
sub EVENT_HP {
if ($hpevent == 75) {
	quest::emote("quaffs a magical elixir.");
	quest::shout("Now you will die!");
	quest::npcsize(9);
	quest::modifynpcstat("min_hit",70);
	quest::modifynpcstat("max_hit",120);
	quest::setnexthpevent(50);
}
if ($hpevent == 50) {
	quest::shout("Guards!");

my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();

	quest::spawn2(11174,0,0,$x+5,$y+5,$z,$h);
	quest::spawn2(11175,0,0,$x+5,$y-5,$z,$h);
}
}
That should work for ya
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
Reply With Quote
  #3  
Old 03-04-2014, 11:40 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Additionally, there is no reason to create local variables for xyzh. They are already set to the values you are setting them to. Just remove those lines.
Reply With Quote
  #4  
Old 03-05-2014, 11:06 AM
Melcrin
Fire Beetle
 
Join Date: Dec 2007
Location: home
Posts: 13
Default

Thanks a lot! That fixed the event. And thanks for the additional pointers, sorvani. I'll try and clean my script up a little.
Reply With Quote
  #5  
Old 03-05-2014, 06:02 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

What you did is littered all over the the quest code, so it is understandable where you got it from.
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 03:37 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3