View Single Post
  #1  
Old 06-27-2017, 09:00 PM
Eealer
Fire Beetle
 
Join Date: Jul 2016
Location: Alberta, Canada
Posts: 29
Default NPC Script - only casting 1 spell of many

Hello again,

Is there some way that I can make my NPC cast a series of spells without using selfcast? I finally got "CastSpell" to work but in the section of the code I am testing, the NPC will only cast the first spell and then stop. Does anyone have any suggestions for how I can make it continue casting all of the spells in its cast list?

Code:
sub EVENT_SAY
{
	my $Buff = quest::saylink("Buffs", 1);
	my $heal = quest::saylink("Healing", 1);


		if($text=~/Hail/i)
		{
			$client->Message(315, "Hello, $name. Do you need some $Buff? Or maybe you're in need of some $heal?'");
		}
		
		if($text=~/Healing/i)
		{
			$npc->CastSpell(13);
			$client->Message(315, "You have been healed, $name");
		}

		if($text=~/Buffs/i) 
		{			

				
				if ($ulevel >= "61") 
				{
					$npc->CastSpell(5257, $userid);
					$npc->CastSpell(5258, $userid);
					$npc->CastSpell(5261, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(62, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
				if (($ulevel >= "47") && ($ulevel < "61")) 
				{
					$npc->CastSpell(3467, $userid);
					$npc->CastSpell(3472, $userid);
					$npc->CastSpell(4091, $userid);
					$npc->CastSpell(3469, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(62, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
				if ($ulevel == "46") 
				{
					$npc->CastSpell(3467, $userid);
					$npc->CastSpell(3472, $userid);
					$npc->CastSpell(4091, $userid);
					$npc->CastSpell(1548, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(62, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
				if ($ulevel == "45") 
				{
					$npc->CastSpell(1447, $userid);
					$npc->CastSpell(3576, $userid);
					$npc->CastSpell(4090, $userid);
					$npc->CastSpell(1548, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(62, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
				if ($ulevel >= "43") 
				{
					$npc->CastSpell(3692, $userid);
					$npc->CastSpell(3576, $userid);
					$npc->CastSpell(4090, $userid);
					$npc->CastSpell(1548, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(62, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
				if ($ulevel <= "42") 
				{
					$npc->CastSpell(3692, $userid);
					$npc->CastSpell(3576, $userid);
					$npc->CastSpell(4089, $userid);
					$npc->CastSpell(63, $userid);
					$npc->CastSpell(64, $userid);
					$npc->CastSpell(61, $userid);
					$npc->CastSpell(60, $userid);
					$npc->CastSpell(62, $userid);
					$client->Message(315, "It's Dangerous to adventure alone, Take this and stay safe");
				}
			}
		}
Reply With Quote