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
  #12  
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
 


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 04:21 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