Morphing Mob randomly chosen with adds.
This is how it works. Give the furious sentry an item. This spawns Yar`lir's first form and sets the qglobal.
at 85% health the this will depop the first form and choose another 1 of 4 forms of the same mob randomly, then 5% health lower (80% health) adds will spawn based off of which form was previously chosen.
This will repeat at 70/65%, then at 55/50%, then 40/35%, then 25/20% and finally at 10/9%. upon death adds will despawn and a chest will appear with loot inside.
Also if all the players are killed, which would take the main mob out of combat, all adds will despawn.
I tested this script 3 times all with different amounts of HP of the main mobs, just to make sure it worked.
I have trevius to thank for help on completing the script. Thanks alot!!
Hand in mob code.
Code:
#Furious Sentry
sub EVENT_SAY
{
if($text =~/Hail/i)
{
quest::say ("?"); #can make this say what ever you want.
}
}
sub EVENT_ITEM
{
if (plugin::check_handin(\%itemcount, 57206 => 1))
{
quest::say("Yar = 1");
quest::delglobal("yar");
quest::setglobal("yar", 1, 3, "F");
quest::spawn2(999483, 0, 0, -3491, 3142, 302, 58);
}
}
Main mob (Morphing) code
Code:
#Yar`lir encounter
sub EVENT_SPAWN
{
if(defined($qglobals{yar})){ #spawn at lower % of health
if ($qglobals{yar} == 1)
{
quest::shout ("RAWR 1");
}
elsif ($qglobals{yar} == 2)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.85);
$npc->SetHP($set_hps);
}
elsif ($qglobals{yar} == 3)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.70);
$npc->SetHP($set_hps); }
elsif ($qglobals{yar} == 4)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.55);
$npc->SetHP($set_hps); }
elsif ($qglobals{yar} == 5)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.40);
$npc->SetHP($set_hps); }
elsif ($qglobals{yar} == 6)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.25);
$npc->SetHP($set_hps); }
elsif ($qglobals{yar} == 7)
{
my $max_hps = $npc->GetMaxHP();
my $set_hps = ($max_hps * 0.10);
$npc->SetHP($set_hps);
}
}
}
sub EVENT_COMBAT
{
if($combat_state == 1)
{
if(defined($qglobals{yar})){
if ($qglobals{yar} == 1)
{
quest::setnexthpevent(85);
}
elsif ($qglobals{yar} == 2)
{
quest::setnexthpevent(80);
}
elsif ($qglobals{yar} == 3)
{
quest::setnexthpevent(65);
}
elsif ($qglobals{yar} == 4)
{
quest::setnexthpevent(50);
}
elsif ($qglobals{yar} == 5)
{
quest::setnexthpevent(35);
}
elsif ($qglobals{yar} == 6)
{
quest::setnexthpevent(20);
}
elsif ($qglobals{yar} == 7)
{
quest::setnexthpevent(9);
}
}
}
if($combat_state == 0) #depop adds if all players die
{
quest::signalwith(999488, 2, 0);
quest::signalwith(999489, 2, 0);
quest::signalwith(999021, 2, 0);
}
}
sub EVENT_HP
{
if($hpevent == 85) # change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 2, 3, "F");
quest::depop();
}
elsif($hpevent == 80) #spawn adds
{
quest::setnexthpevent(70);
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
elsif($hpevent == 70) #change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 3, 3, "F");
quest::depop();
}
elsif($hpevent == 65) #spawn adds
{
quest::setnexthpevent(55);
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
elsif($hpevent == 55) #change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 4, 3, "F");
quest::depop();
}
elsif($hpevent == 50) #spawn adds
{
quest::setnexthpevent(40);
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
elsif($hpevent == 40) #change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 5, 3, "F");
quest::depop();
}
elsif($hpevent == 35) #spawn adds
{
quest::setnexthpevent(25);
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
elsif($hpevent == 25) #change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 6, 3, "F");
quest::depop();
}
elsif($hpevent == 20) #spawn adds
{
quest::setnexthpevent(10);
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
elsif($hpevent == 10) #change form randomly
{
my $x;
my $y;
my $z;
my $h;
my $a = int(rand(4)+1);
if ($a == 1) { #matriarch
quest::spawn2(1242,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 1, 3, "F");
}
elsif ($a == 2) { #winds
quest::spawn2(1244,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 2, 3, "F");
}
elsif ($a == 3) { #hurricane
quest::spawn2(1245,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 3, 3, "F");
}
elsif ($a == 4) { #storm NO ADDS
quest::spawn2(999483,0,0,-3491,3142,302,58);
quest::delglobal("yaradds");
quest::setglobal("yaradds", 4, 3, "F");
}
quest::delglobal("yar");
quest::setglobal("yar", 7, 3, "F");
quest::depop();
}
elsif($hpevent == 9) #spawn adds
{
if(defined($qglobals{yaradds})){
if ($qglobals{yaradds} == 1) # Drake Adds
{
quest::spawn2(999021,0,0,-3467,3197,302,77);
quest::spawn2(999021,0,0,-3500,3198,302,116);
quest::spawn2(999021,0,0,-3537,3158,302,74);
quest::spawn2(999021,0,0,-3539,3128,302,56);
quest::spawn2(999021,0,0,-3502,3091,302,10);
quest::spawn2(999021,0,0,-3470,3090,302,50);
}
elsif ($qglobals{yaradds} == 2) # Wind Dervish Adds
{
quest::spawn2(999488,0,0,-3484,3089,302,0);
quest::spawn2(999488,0,0,-3484,3198,302,129);
}
elsif ($qglobals{yaradds} == 3) # Water Dervish Adds
{
quest::spawn2(999489,0,0,-3484,3089,302,0);
quest::spawn2(999489,0,0,-3484,3198,302,129);
quest::spawn2(999489,0,0,-3541,3145,302,65);
quest::spawn2(999489,0,0,-3427,3144,302,192);
}
}
}
}
sub EVENT_DEATH #depop adds and spawn chest with loot
{
quest::delglobal("yar");
quest::signalwith(999488, 1, 0);
quest::signalwith(999489, 1, 0);
quest::signalwith(999021, 1, 0);
quest::spawn2(999480,0,0,$x-20,$y+20,$z+10,$h);
}
Adds code
Code:
sub EVENT_SIGNAL
{
if ($signal == 1) #when mob dies
{
quest::depop();
}
elsif ($signal == 2) #when all players are dead, taking the main mob out of combat
{
quest::depop();
}
}
Feel free to use the scripts for whatever you want. Just thought I would post what I am using for one of my 2.0 encounters on my server.
~Enjoy
|