View Single Post
  #3  
Old 04-14-2020, 11:28 PM
WarAngel's Avatar
WarAngel
Sarnak
 
Join Date: Oct 2017
Location: Washington State
Posts: 54
Default Plugin to support previous script...

Code:
####################################
#:: Usage:			plugin::wa_KillMode([minRange], [maxRange]); Example... plugin::wa_KillRange(500, 1000);
#:: Created:		12April2020
#:: 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:		plugin::val('$npc');
#:: Future Plans	Figure out interaction with waypoints.
####################################

sub wa_KillMode
{
	#quest::debug("Killmode begin for " . $npc->GetName() . ""); #Wrong place to put this as it prevents the script
	my $npc = plugin::val('$npc'); #this was what I was missing. without this the plugin was not knowing who was calling
	my $entity_list = plugin::val('$entity_list');
	my $wa_minRange = $_[0]; #pulled from first position in the plugin call
	my $wa_maxRange = $_[1]; #pulled from second position in the plugin call

	$wa_disUpper = plugin::RandomRange($wa_minRange, $wa_maxRange);
	#$wa_rangelower = plugin::RandomRange(1, $wa_varRange);

    #my @npc_list = $entity_list->GetNPCList(); # "@" is for array... "my" is for a single... I am an idiot
	@npc_list = $entity_list->GetNPCList(); #not sure in a plugin why this works and not the one with a "my"
	#quest::debug("Killmode begin for " . $npc->GetName() . "");

	foreach $npc_ent (@npc_list) 
	{ ###This whole next if has me bonkers...seems counter intuitive...oposites...">" is less than. "==" is NOT equal 
		#quest::debug("Killmode subscript begin for " . $npc->GetName() . ""); #This debug will repeat for each NPC in the GetNPCList()
		next if $npc_ent->CalculateDistance($x, $y, $z) > $wa_disUpper; #skip mobs OVER $wa_disUpper distance, check those BELOW
		next if $npc_ent->CalculateDistance($x, $y, $z) < $wa_minRange; #skip mobs BELOW $wa_minRange distance, check those OVER
		next if $npc_ent->GetLevel() > $npc->GetLevel(); # Enemy level parameters...works...but some mobs are never attacked, do not know why
		next if $npc_ent->IsEngaged(); # Is target in combat?...works
		next if $npc_ent->GetID() == $npc->GetID(); #Lets not kill ourself..have not tested this
		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...have not tested this
		next if $npc_ent->GetBodyType() == 11; #skip untargetable NPCs...have not tested this
		next if $npc_ent->GetOwnerID(); #skip pets...have not tested this
		next if $npc_ent->CheckNPCFactionAlly(faction_id) == $npc->CheckNPCFactionAlly(faction_id); #We are brothers and sisters in arms, lets not kill each other
		#quest::shout("I am coming for you, " . $npc_ent->GetCleanName() . "!");
		quest::SetRunning(1);
		$npc->AddToHateList($npc_ent, 1); #We now HATE HIM!...Will go through the list thats left and pick the npc at the bottom of the list to attack
		#quest::debug("Killmode subscript end for " . $npc->GetName() . "");	
		last; #we found a valid target jump out of the loop
    }
}

####################################
#:: Usage:			plugin::wa_RandomName();
#:: Created:		13Apr2020
#:: Version:		wa_1.00
#:: Author:			Akkadius, and 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:		plugin::val('$npc');
#:: Future Plans	Turn this into an array plugin.
####################################

sub wa_RandomName
{
	my $npc = plugin::val('$npc');
	my $wa_RanRoll = int(rand(3)); #Need to make a gender and maybe race checks. Hence why I will make a array plugin sometime soon, 3 means total of three int not 1-3

	if ($wa_RanRoll == 0)
		{
			$npc->TempName("Kid_one");
		}
	if ($wa_RanRoll == 1)
		{
			$npc->TempName("Kid_two");
		}
	if ($wa_RanRoll == 2)
		{
			$npc->TempName("Kid_three");
		}
}

####################################
#:: Usage:			plugin::wa_ChatMode();
#:: Created:		12Apr202
#:: Version:		wa_1.00
#:: Author:			Akkadius, and 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:		plugin::val('$npc'); plugin::SetAnim("sit"); plugin::DoAnim("dance"); plugin::RandomRange(1, 100);
#:: Future Plans	Turn this into an array.
####################################

sub wa_ChatMode
{
	my $npc = plugin::val('$npc');
	my $wa_intCHAT = plugin::RandomRange(1, 100); #Random int used localy

	#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...I believe I know why now. Working on this for next version.
				
	if ($wa_intCHAT <= 33) #Below or at 33
	{
		plugin::SetAnim("sit"); #Options (stand/sit/duck/dead/kneel)		
		#quest::shout2("worldwide only shout"); #Does not use...relies on the datbase name
		#quest::we(14, "World emote");
		#quest::debug("wa_intCHAT Sarcastic chat");
	}
	if ($wa_intCHAT > 33 && $wa_intCHAT <= 66) #Above between 33 66
	{
		plugin::SetAnim("stand"); #Options (stand/sit/duck/dead/kneel)
		#quest::debug("wa_intCHAT Positive chat");
	}
	if ($wa_intCHAT > 66) #above 66
	{
		plugin::DoAnim("dance");		
		#quest::shout("Zone shout"); #Does not use...relies on the dataase name
		#quest::ze(14, "Zone emote");
		#quest::debug("wa_intCHAT idiot chat");
	}
}

return 1;	#This line is required at the end of every plugin file in order to use it


#@a = (1..5);
#@a = (1..3, 5, 7..11);
Reply With Quote