Note: Once again these functions are committed to the repository, so simply checking out the SVN to your plugins folder will allow you to use any of these plugins right away!
These two functions are very simple, one plugin will heal a mob by a certain percentage (1-100%)
So the usage would be plugin::MobHealPercentage(50); to heal 50% of the mob
And very similarily, plugin::MobHealPoints(50); would only heal 50 hitpoints of a mob. Most likely the percentage function would be used more.
Code:
###AKKADIUS###
#Usage: plugin::MobHealPercentage(Numberofpercent);
# This script will heal a mob whatever percent amount at the time of trigger
sub MobHealPercentage{
my $npc = plugin::val('$npc');
my $HealPercent = $_[0];
my $curhp = $npc->GetHP();
my $maxhp = $npc->GetMaxHP();
$npc->SetHP($curhp + ($maxhp / 100 * $HealPercent));
}
###AKKADIUS###
#Usage: plugin::MobHealPoints(Hitpoints to heal);
# This script will heal a mob whatever point amount at the time of trigger
sub MobHealPoints{
my $npc = plugin::val('$npc');
my $HealPoints = $_[0];
my $curhp = $npc->GetHP();
my $maxhp = $npc->GetMaxHP();
$npc->SetHP($curhp + $HealPoints);
}
These two functions have "spawn in place" features that automatically do some of the work for you. They are explained in the scripts:
#Usage: plugin::SpawnInPlace(NPCID to spawn in place, [1 = Don't depop what spawns in place]);
#Example plugin::SpawnInPlace(100230, 1);
#The Second arguement for a plugin like this is for an instance where you have eggs spawn drakes and you don't want the eggs to depop
#Usage: plugin::SpawnChest(Chest NPCID to spawn in place, [the integer range you want the chest to randomly spawn from the dead mob]);
#Example plugin::SpawnChest(102032, 100); So in this case the chest would spawn anywhere in 100 integers of the vicinity of the mob. Usually used in a sub_EVENT_DEATH
#Similar to plugin::SpawnInPlace, this plugin will spawn a chest in the same place, or will spawn a chest within a random generated desired range defined in the second arguement
Code:
###AKKADIUS###
#Usage: plugin::SpawnInPlace(NPCID to spawn in place, [1 = Don't depop what spawns in place]);
#The Second arguement for a plugin like this is for an instance where you have eggs spawn drakes and you don't want the eggs to depop
sub SpawnInPlace{
my $npc = plugin::val('$npc');
my $NPCID = $_[0];
my $DontDie = $_[1];
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
if(!$DontDie){
quest::depop();
}
quest::spawn2($NPCID, 0, 0, $x, $y, $z, $h);
}
###AKKADIUS###
#Usage: plugin::SpawnChest(Chest NPCID to spawn in place, [the integer range you want the chest to randomly spawn from the dead mob]);
#Similar to plugin::SpawnInPlace, this plugin will spawn a chest in the same place, or will spawn a chest within a random generated desired range defined in the second arguement
sub SpawnChest{
my $npc = plugin::val('$npc');
my $NPCID = $_[0];
my $Range = $_[1];
my $ChestRange = plugin::RandomRange(1, $Range);
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $h = $npc->GetHeading();
quest::spawn2($NPCID, 0, 0, $x + ($ChestRange), $y + ($ChestRange), $z, $h);
}
These two functions are really slick, the first function will set the coordinates in which plugin::CheckLeashMob(range); will check the distance before resetting back to the spawn point.
Example shown below the plugins:
Code:
###AKKADIUS###
#Usage: plugin::SetLeashMob();
# This script will set the parameters in which the mob will be leashed for when you perform a check.
sub SetLeashMob{
my $npc = plugin::val('$npc');
my $MobX = $npc->GetX();
my $MobY = $npc->GetY();
my $MobZ = $npc->GetZ();
my $MoBH = $npc->GetHeading();
$npc->SetEntityVariable(60, $MobX); # Set X Base Integer
$npc->SetEntityVariable(61, $MobY); # Set Y Base Integer
$npc->SetEntityVariable(62, $MobZ); # Set Z Base Integer
$npc->SetEntityVariable(63, $MobH); # Set H Base Integer - Store for return
}
###AKKADIUS###
#Usage: plugin::CheckLeashMob(Range);
# This script will check the parameters in which the Leash was set and check against the arguement declared, if comes back true, the mob is reset to its leash set point.
sub CheckLeashMob{
my $npc = plugin::val('$npc');
my $LeashAmount = $_[0];
my $GetLeashX = $npc->GetEntityVariable(60);
my $GetLeashY = $npc->GetEntityVariable(61);
my $GetLeashZ = $npc->GetEntityVariable(62);
my $StoredHeading = $npc->GetEntityVariable(63);
my $MobX = $npc->GetX();
my $MobY = $npc->GetY();
my $MobZ = $npc->GetZ();
my $DifferenceX = $GetLeashX - $MobX;
my $DifferenceY = $GetLeashY - $MobY;
my $DifferenceZ = $GetLeashZ - $MobZ;
my $FinX = abs($DifferenceX);
my $FinY = abs($DifferenceY);
my $FinZ = abs($DifferenceZ);
if ($FinX > $LeashAmount || $FinY > $LeashAmount || $FinZ > $LeashAmount){
$npc->GMMove($GetLeashX, $GetLeashY, $GetLeashZ, $StoredHeading); #Returns back to original point if mob goes beyond the throttled integer range
}
}
Code:
sub EVENT_SPAWN{
my $npc_name = $npc->GetCleanName();
quest::shout("Veeshan where are you!");
quest::we(15, "You hear a dragon roar in the distance, coming from the Dreadlands of Kunark");
$npc->CameraEffect(2000, 9);
quest::settimer("spawn",1);
quest::doanim(44);
plugin::NamedLogging("$npc_name has spawned in [$zoneln]");
}
sub EVENT_TIMER{
plugin::NamedTimerUtils();
if ($timer eq "spawn"){
plugin::SetLeashMob();
quest::stoptimer("spawn");
}
if ($timer eq "CheckLeash"){
plugin::CheckLeashMob(130);
quest::stoptimer("CheckLeash");
quest::settimer("CheckLeash", 3);
}
}
sub EVENT_COMBAT
{
plugin::NpcCombatUtils();
my $npc_name = $npc->GetCleanName();
if($combat_state == 1)
{
$NextActivate = 95;
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();
quest::setnexthpevent($NextActivate);
$npc->CameraEffect(2000, 7);
quest::stoptimer("repeatsay");
quest::settimer("CheckLeash", 1);
}
if($combat_state == 0)
{
$npc->CameraEffect(2000, 7);
quest::settimer("repeatsay", 600);
quest::stoptimer("CheckLeash");
}
}