View Single Post
  #2  
Old 04-09-2020, 11:17 PM
WarAngel's Avatar
WarAngel
Sarnak
 
Join Date: Oct 2017
Location: Washington State
Posts: 54
Default The first script...

Code:
#::: Usage:			Have this script name match the NPC name in the database.
#::: Created:		7April2020
#::: Author:		Unknown, multiple folks have made the scripts and I just mushed them togather...WarAngel
#::: Description:	To have a NPC create the illusion of other real world players running around.
#:::

sub EVENT_SPAWN
{
	#$npc->TempName("Test_Name"); # Works but want a randomizer for names
	my $wa_Diff = int(rand(10)); #picks a number 0-9
	quest::settimer("wa_FeatureChange", 5); #5 seconds
	quest::settimer("wa_RandomName", 7); #7 seconds
	quest::settimer("wa_Decisions", 10 + ($wa_Diff)); #10 seconds + random (0-9)
}
#####################
#End of EVENT_SPAWN
#####################

sub EVENT_TIMER
{
##What do I want to do?##
	if($timer eq "wa_Decisions" && !$npc->IsEngaged())
	{
		my $wa_intChoice = plugin::RandomRange(1, 100); #random int used localy

			if ($wa_intChoice <= 20) #below or at 20
			{
				quest::debug("wa_intROLL BELOW 20 worked for ". $npc->GetName() .". Time to kill");
				#wa_KillMode();
				plugin::wa_KillMode();

			}
			if ($wa_intChoice > 20) #above 20
			{
				quest::debug("wa_intROLL ABOVE 20 worked for ". $npc->GetName() .". Time for peace");
				wa_PeaceMode();
			}
	}

##Change my look here##
	if($timer eq "wa_FeatureChange")
	{
		quest::stoptimer("wa_FeatureChange");
		wa_ChangeLook();
	}

##Change my name here##
	if($timer eq "wa_RandomName")
	{
		quest::stoptimer("wa_RandomName");
		my $wa_RanName = int(rand(3));
		if ($wa_RanName == 0)
			{
				$npc->TempName("Test_Name_one");
			}
		if ($wa_RanName == 1)
			{
				$npc->TempName("Test_Name_two");
			}
		if ($wa_RanName == 2)
			{
				$npc->TempName("Test_Name_three");
			}
	}

}
###################
#End of EVENT_TIMER
###################


sub wa_KillMode
{
    plugin::wa_KillMode();   
    #my @npc_list = $entity_list->GetNPCList();
    #foreach $npc_ent (@npc_list)
	#{
		#quest::debug("Killmode begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
		#next if $npc_ent->GetLevel() > 2; # Enemy level parameters
		#next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself
		#next if $npc_ent->GetOwnerID(); #skip pets
		#next if ($npc_ent->GetSpecialAbility(19) || $npc_ent->GetSpecialAbility(20) || $npc_ent->GetSpecialAbility(24) || $npc_ent->GetSpecialAbility(35)); #Immune to melee / magic / aggro / noharm SKIP
		#next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs
		#next if $npc_ent->IsEngaged(); # Is target in combat?
		#next if $npc_ent->CalculateDistance($x, $y, $z) > 250; #skip mobs over 250 Distance
		#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
		#quest::SetRunning(1);
		#$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!
		#quest::debug("Killmode end for " . $npc->GetName() . "");
		#last; #we found a valid target jump out of the loop
    #}
}


sub wa_PeaceMode
{
		#quest::debug("PeaceMode begin for ". $npc->GetName() ."");
		#quest::shout("Hiyas folks I am ". $npc->GetName() ."!"); #This worked
		#quest::emote("Does the whole zone hear me!!"); #works but emote has a limited range
		#plugin::RandomSay(chance(1-100), "Heyhey!!","How are you all doing?","How about it?"); #not working...even when I am on top of NPC

			my $wa_intCHAT = plugin::RandomRange(1, 100); #random int used localy

				if ($wa_intCHAT <= 50) #below or at 50
				{
					plugin::SetAnim("sit"); #options (stand/sit/duck/dead/kneel)
					#quest::debug("wa_intCHAT Sarcastic chat");
				}
				if ($wa_intCHAT > 50) #above 50
				{
					plugin::SetAnim("stand"); #options (stand/sit/duck/dead/kneel)
					#quest::debug("wa_intCHAT Positive chat");
				}

		#quest::debug("PeaceMode end for " . $npc->GetName() . "");
}


sub wa_ChangeLook
{
		#quest::debug("ChangeLook begin");
		plugin::RandomWeapons(1, 11169, 50, 200, 230); #Any random weapon available through S0F
		plugin::RandomFeatures($npc); #Change facial features
		#quest::debug("ChangeLook end");
}
Reply With Quote