Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-12-2011, 10:59 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Question $npc->CastSpell Working on Target, Not Self

Evening gents, I've gone and broken something again!

I am experiencing a weird issue with CastSpell. If I use it to cast on a player, it works fine. If I use it on the npc that is casting (as in self buffing) it is always interrupted.

A few previous posts I've found say to use $npc-GetID() for self targetting, but that just end in the script refusing to run certain parts.

Enclosed are relevant portions of the script:

This is the 'header' to the subroutine. Note @groupMembers is not listed here as it is filled in at the start of the fight on agro (which is relevant, but isn't broken).
Code:
sub doDiscord
{
	my $victim = "";
	my $randy = int(rand(1000));
	my @moblist = $entity_list->GetMobList();
	foreach $ent (@moblist)
	{
		if($ent->GetID() == 999173)
		{
			$selfEnt = $ent;
		}
	}
This next part fails to set $victim to the top threat target. Gives an unknown variable error in logs. Both spells always give Interrupted (guessing due to lack of legitimate target). The spell referenced is a targetted AoE with snare component.
Code:
	
	if($randy > 875)
	{
		quest::say("Slow down friend. No need to be in such a hurry.");
		$victim = $npc->GetHateTop();
		$npc->CastSpell(9895, $victim, 10, 0, 0);		## cast druid 4.0 vines on top threat
		$npc->CastSpell(9895, $victim, 10, 0, 0);		## cast druid 4.0 vines on top threat
	}
This bit was me trying 3 different ways of getting it to work. The spells referenced here are spell damage bonus, melee haste, and casting haste (respectively). The error produced is "Perl runetime error: Can't call method "GetID" without a package or object reference at quest/xxx/yyy.pl line 151". Line 151 is the Ancient: Vampiric Thunder line.
Code:
	elsif($randy > 625)
	{
		quest::say("Let's play pretend! I pretend to be an Enchanter!");
		$npc->CastSpell(9936, $selfEntity->GetID(), 10, 0, 0);		## buff self with Ancient: Vampiric Thunder
		$npc->CastSpell(9937, $selfEnt, 10, 0, 0);		## buff self with Ancient: Melee Haste
		$npc->CastSpell(9938, $selfEntity, 10, 0, 0);		## buff self with Ancient: Spell Haste
		
	}
This section will randomly mezz a few player but refuses to actually do the heal cast. I am assuming it has something to do with targetting again.
The spell first referenced is unresistable npc mezz, second is incredibly strong Complete Heal v2.
Code:
	elsif($randy > 125)
	{
		quest::say("Stop that! I need to heal...");
		my $temp = int(rand($size)) - 1;			## random pick a number of players to mezz
		if($temp < 1) {$temp = 1};				## minor catch to ensure no out of bounds
		for ($i = 0; $i < $temp; $i++)
		{
			$npc->CastSpell(9757, $groupMembers[$i], 10, 0, 0);	## cast NPC Mesmerize on target
		}
		
		$npc->CastSpell(9712, $selfEntity, 10, 8, 0);			## 8 second cast of Cleric CH 2 (with Amp Healing, should do ~400k)
	}
This just produces a massive block of interrupts. Again, targetting I guess :-P
Spell referenced is a 25k x 5 (per cast) wizard nuke.
Code:
	elsif($randy < 50)
	{
		quest::say("Hmm...never used this spell before!");
		$npc->CastSpell(9746, $selfEntity, 10, 0, 0);    ## wiz t3 nuke
		$npc->CastSpell(9746, $selfEntity, 10, 0, 0);    ## wiz t3 nuke
		$npc->CastSpell(9746, $selfEntity, 10, 0, 0);    ## wiz t3 nuke
		$npc->CastSpell(9746, $selfEntity, 10, 0, 0);    ## wiz t3 nuke
		$npc->CastSpell(9746, $selfEntity, 10, 0, 0);    ## wiz t3 nuke
		quest::say("OWW! Now I remember what that does.");
	}
}
Thank you in advance!


-Hate
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:58 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3