Code:
####################################
#:: Usage: Have this script name match the NPC name in the database. Make sure to set a unique faction for you "player_npc" or not and see what happens!! :-)
#:: Also include the wa_Plugins.pl plugin I made into .../directory/plugins...
#:: Created: 7April2020
#:: Version: wa_1.00
#:: Author: Others have made the scripts and I just mushed them togather, and created a bastard child...WarAngel.
#:: Description: To have a NPC create the illusion of other real world players running around.
#:: With help from: TurmoilToad,Salvanna,Akkadius,Trust,Kinglykrab
#:: Plugins: Plugins...plugin::wa_KillMode(); plugin::RandomRange(1, 100); plugin::DoAnim("sit"); plugin::RandomWeapons(1, 11169, 50, 200, 230);
#:: plugin::RandomFeatures($npc);
#::Future Plans: I am going to look into making plugins for an array of names and chat spams.
####################################
sub EVENT_SPAWN
{
#$npc->TempName("Test_Name"); #Works but want a randomizer for names, maybe make a plugin array that makes names..."Leg" + "olas" type of idea
my $wa_Diff = int(rand(10)); #Picks a number 0-9, 10 means 10 total int starting at 0
quest::settimer("wa_FeatureChange", 1); #1 seconds
quest::settimer("wa_RandomName", 1); #1 seconds
quest::settimer("wa_Decisions", 10 + ($wa_Diff)); #10 seconds + random (0-9) 10 means 10 total int starting at 0
}
#####################
#End of EVENT_SPAWN
#####################
sub EVENT_TIMER
{
if($timer eq "wa_Decisions" && !$npc->IsEngaged()) #"eq" is used for strings not int
{ ###What do I want to do?###
wa_Decisions();
}
if($timer eq "wa_FeatureChange")
{ ###Change my look here###
#quest::debug("ChangeLook begin");
quest::stoptimer("wa_FeatureChange"); #Lets not repeat
plugin::RandomWeapons(1, 11169, 50, 200, 230); #Any random weapon available through S0F, need to fix this later for newbie sets?, make a random armor?
plugin::RandomFeatures($npc); #Change facial features
#quest::debug("ChangeLook end");
}
if($timer eq "wa_RandomName")
{ ###Change my name here###
quest::stoptimer("wa_RandomName"); #Lets not repeat...EXCELSIOR!
plugin::wa_RandomName();
}
}
###################
#End of EVENTS_TIMER
###################
sub wa_Decisions
{
my $wa_intChoice = plugin::RandomRange(1, 100); #Random int used localy
$wa_maxhp = $npc->GetMaxHP();
$wa_HP = $npc->GetHP();
$wa_perchp = (($wa_HP / $wa_maxhp) * 100);
if($wa_perchp <= 20)
{
#quest::debug("" . $npc->GetName() . " I am below 20 percent, healing.");
#quest::debug("Health check PERCENTAGE " . $wa_perchp . "");
plugin::MobHealPercentage(5);
#quest::debug("" . $npc->GetName() . "Done healing.");
last;
}
if ($wa_intChoice <= 10) #Below or at 10
{
plugin::wa_KillMode(400, 1200); #Change the ranges for customizing the npc_player min and max agro radius
#quest::debug("wa_intROLL BELOW 10 worked for ". $npc->GetName() .". Time to kill");
}
if ($wa_intChoice > 10) #Above 10
{
plugin::wa_ChatMode();
#quest::debug("wa_intROLL ABOVE 10 worked for ". $npc->GetName() .". Time for peace");
}
}