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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-25-2011, 05:22 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

I am almost completely stuck. I cannot get this bugger to do anything other than stand there like a goon. I am clueless as to where this is failing as it produces no output.

Occasionally it will get an error involving "$i->AddToHateList($attackerID,100)" but I found a post leading me to believe that AddToHateList used entityID instead.

Code:
	$calledIt = 0;
	$markPlayer = 0;

sub EVENT_SPAWN
{
	
}

sub EVENT_DEATH
{
	quest::signalwith(999147,999148,0);
	quest::emote("yelps in pain.");
	undef $calledIt;
	undef $markPlayer;
}

sub EVENT_ATTACK
{
		# my @NPCLIST = $entity_list->GetNPCList();
		# my @victimList = $npc->GetHateList();
		# my $victimCount = scalar (@victimList);
		# quest::shout("DEBUG: $victimCount");
		
	if($calledIt == 0)
	{
		$calledIt = 1;
		charge(0, $client);
	}
}

sub EVENT_AGGRO
{
	if($calledIt == 0)
	{
		$calledIt = 1;
		charge(0, $client);
	}
}

sub EVENT_SIGNAL
{
	if($calledIt == 0)
	{
		$calledIt = 1;
		$markPlayer = $signal;
		charge($markPlayer, 0);
	}
	
	if($signal eq "tmHT")
	{
		castHT();
		quest::stoptimer("tmHT");
		quest::settimer("tmHT", 15);
	}
}

sub charge
{
	my $var1 = $_[0];		## character id storage
	my $var2 = $_[1];		## client id storage
	
	if($var1 == 0)
	{
		$attacker = $var2->GetName();
		$attackerID = $var2->CharacterID();
	}
	else
	{
		$var2 = $entity_list->GetClientByCharID($var1);
		$attacker = $var2->GetName();
		$attackerID = $var1;
	}
	
	# warn players
	quest::shout("Blackburrrroooooow!");
	quest::attack($attacker);
	
	
	
	# call up lists of gnolls
	my @NPCLIST = $entity_list->GetNPCList();
	#my @fippy = $entity_list->GetMobByNpcTypeID(999150);
	#my @tranixx = $entity_list->GetMobByNpcTypeID(999149);
	my $fippy = 999150;
	my $tranixx = 999149;
	my $tempScalar = 0;
	
	foreach $i (@NPCLIST){
		if($i->GetNPCTypeID() == ($fippy || $tranixx)) {
			$i->AddToHateList($attackerID, 1000);
		}
	}

	
	# if gnoll(s) exist, set them on player
	# $tempScalar = scalar (@fippy);
	# quest::say("DEBUG: Fippy $tempScalar");
	# if($tempScalar > 0)
	# { 
		# foreach $i(@fippy)
		# {
			# $i->AddToHateList($attackerID,100);
		# }
	# }
	# 
	# $tempScalar = scalar (@tranixx);
	# quest::say("DEBUG: Tranixx $tempScalar");
	# if($tempScalar > 0)
	# { 
		# foreach $i(@tranixx)
		# {
			# $i->AddToHateList($attackerID,100);
		# }
	# }
	quest::settimer("tmHT", 15);
}

sub castHT
{
	my $victim = $mob->GetHateRandom();
	quest::say("$victim");
	
}

The castHT also completely fails for no given reason that I can figure out. Any insight/pointers would be greatly useful!

-Hate
Reply With Quote
  #2  
Old 03-25-2011, 09:09 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

I'm not sure what your coding process is but if it involves writing the entire script and then seeing if it works, its probably not a good idea until you are more confident with the code and syntax.

I see many problems with this, such as:
Code:
if($i->GetNPCTypeID() == ($fippy || $tranixx)) {
Is not valid syntax.

Code:
quest::settimer("tmHT", 15);
Yet you have no timer event.

You also pass a string in the signal event and Im not sure if that works(Im too lazy to look) but since you are not using that to pass anything useful(like say the charID so you wouldnt need a charge event), just have it pass a number.

There is probably more but I just skimmed it. I've also had problems with scripts not running if I only use a single # to comment things.

The proper way to debug this script is to back it up and delete everything except one event, then add another, then another, etc. For large events, add them in small pieces until you are sure its going to work.
Reply With Quote
  #3  
Old 03-25-2011, 11:44 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

Although I appreciate insightful input, I am perfectly capable of treating myself like trash...

The $fippy || $tranixx thing was me trying to explain SQL to class mate while trying to fix perl at the same time. I clearly failed MISERABLY.

I kept getting bizarre errors in server logs. It stemmed from the $victim variable and AddToHateList, so I moved add code with the sole purpose of creating VISIBLE results. It failed, then I went all tunnel vision.

(I went back and cleaned it up. I was so determined to get it to display the $victim variable, I forgot to go back and clean it before posting.)

Code:
	$calledIt = 0;			## essentially true or false variable
	$markPlayer = 0;		## stores player character id

sub EVENT_SPAWN
{
	
}

sub EVENT_DEATH
{
	quest::signalwith(999147,999148,0);   ## send signal of npc being killed to battlemaster to tally points
	quest::emote("yelps in pain.");
	undef $calledIt;
	undef $markPlayer;
}

sub EVENT_ATTACK
{
		
	if($calledIt == 0)		## if this hasn't occured yet, then do it
	{
		$calledIt = 1;
		charge(0, $client);
	}
}

sub EVENT_AGGRO
{
	if($calledIt == 0)		## if this hasn't occured yet, then do it
	{
		$calledIt = 1;
		charge(0, $client);
	}
}

sub EVENT_SIGNAL
{
	if($calledIt == 0)			## if this hasn't occured yet, then do it
	{
		$calledIt = 1;
		$markPlayer = $signal;		## setting public variable markPlayer to the passed signal (which is character id)
		charge($markPlayer, 0);
	}
	
}

sub EVENT_TIMER
{
	if($timer eq "tmHT")
	{
		castHT();
		quest::stoptimer("tmHT");		## did this because I had issues with timers "adjusting" their length
		quest::settimer("tmHT", 15);		## obviously if I want this to continue after stopping, i have to restart
	}
}

sub charge
{
	my $var1 = $_[0];		## character id storage
	my $var2 = $_[1];		## client id storage
	
	if($var1 == 0)		## if character id not found, used client id to FIND client id
	{
		$attacker = $var2->GetName();	
		$attackerID = $var2->CharacterID();
	}
	else
	{
		$var2 = $entity_list->GetClientByCharID($var1);
		$attacker = $var2->GetName();
		$attackerID = $var1;
	}
	
	
	## warn players
	quest::shout("Blackburrrroooooow!");
	quest::attack($attacker);
		
	
	## call up lists of gnolls
	my @NPCLIST = $entity_list->GetNPCList();		## get list of all npcs
	my $fippy = 999150;					## set fippy npctypeid
	my $tranixx = 999149;					## set traniix npctypeid
	my $tempScalar = 0;					## using as a junk variable for get scalar variables and such
	
	## checking each npc in the npclist
	foreach $i (@NPCLIST){
		## if i's npctypeid is fippy's, then					
		if($i->GetNPCTypeID() == $fippy) {
			## add the 1k threat on fippy against player
			$i->AddToHateList($attackerID, 1000);  ## Is this entity id?
		}
	}

	## start tmHT
	quest::settimer("tmHT", 15);
}

sub castHT
{
	my $victim = $mob->GetHateRandom();
	quest::say("$victim");			## announce instead of casting atm
	
}

Basically:
1) NPC is aggro'ed, signal is hit, or player attacks NPC. Set the calledIt variable to 1 (preventing charge() from being called a second time).
2) If client id is passed, find the character ID. If character ID is passed, run with it.
3) Shout out and rush player.
4) Get list of all NPCs in zone.
5) Check NPCList for an npc matching Fippy's npctypeid. If one is found, set 1k threat on player that triggered the event.
6) Start timer "tmHT" with 15 seconds.
7) On 15 second mark, announce the object of the soon to be 'affection' ($victim).

$victim would NOT work even when I just put in a basic "hail" say event. I am trying to learn some of the commands by digging up the perl_mob.cpp and deciphering exactly what type of data must be passed in/out with each item.

Most of the references are coming from the EQEmu Quest Objects list, but I am still (as mentioned above) trying to find what does and doesn't work.

I have a 1200 line script for the battlemaster that works flawlessly for randomly spawning enemy groups, tallying points for those killed, and allowing a quit/continue option at fight number 5 & 10.

However a simple aggro and call-to-arms script defeats me :-\


-Hate
Reply With Quote
Reply

Thread Tools
Display Modes

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 07:39 PM.


 

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