Melcrin
03-04-2014, 09:58 AM
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.
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.");
}
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.
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.");
}