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 08-28-2008, 03:09 PM
phinius
Fire Beetle
 
Join Date: Aug 2008
Location: norrath
Posts: 8
Default

I dereferenced as Andrew said. I googled it and from what I found all you need to do is add an extra $. So here is my new code:

Code:
sub EVENT_ATTACK{

quest::shout("rawr");
quest::settimer(1, 10);


		}




sub EVENT_TIMER{

	if ($timer == 1){

			my $hate_target = $npc->GetHateRandom();  
			quest::shout("My hate target is $$hate_target"); 
			$npc->CastSpell(1588, $$hate_target);
			quest::level(1);
			quest::shout("k");
			}

		}
The npc now returns:

Code:
My hate target is 122026464
No zone crash, but the npc will not cast the spell on me, the number is not directing to me. The NPC casts the spell, but is then interrupted, I assume because it has no valid target. Is the GetHateRandom function not working?

Also, the only way the script will get to my "k" shout, is if the level(1) line is a quest::, it will not progress to the shout if it is a $client->level or $npc->level. It also does not actually level me to 1.
Reply With Quote
  #2  
Old 08-28-2008, 03:31 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Deref. does not give the id for CastSpell(spell_id, target_id)

$npc->CastSpell(spellid, $hate_target->GetID())

The member function for setting level on a specific PTR_OBJ is SetLevel()

$client->SetLevel(1, 0);

You can use
$hate_target->GetName() to actually have it say which target is the target by name instead of cryptic pointers
Reply With Quote
  #3  
Old 08-28-2008, 04:22 PM
phinius
Fire Beetle
 
Join Date: Aug 2008
Location: norrath
Posts: 8
Default

Awesome thanks KLS. The NPC can now actually pick me up as the random hate target, and cast a spell on me. The level function is still not working though, I don't think it knows who to cast it on.

Here's code:

Code:
sub EVENT_TIMER{

	if ($timer == 1){

			my $hate_target = $npc->GetHateRandom();
			my $hate_name = $hate_target->GetName();
			my $hate_id = $hate_target->GetID();  
			quest::shout("My hate target is $hate_name"); 
			$npc->CastSpell(1588, $hate_id);
			$client->SetLevel(1, 0);
			}
Anyone have any ideas? If not I may just make the NPC cast some spell that would produce the same sort of end result, but I'd really like it to actually delevel if possible.
Reply With Quote
  #4  
Old 08-28-2008, 05:30 PM
phinius
Fire Beetle
 
Join Date: Aug 2008
Location: norrath
Posts: 8
Default

Also, an update for anyone wanting to perform this sort of process, I needed to add a line that undefined the hate_target variable so that it would get a new random hate target next time the timer rolled around. Before I did this, it would keep the original hate target indefinately.

Code:
sub EVENT_TIMER{

	if ($timer == 1){
			my $hate_target = $npc->GetHateRandom();
			my $hate_name = $hate_target->GetName();
			my $hate_id = $hate_target->GetID();  
			quest::shout("My hate target is $hate_name"); 
			$npc->CastSpell(5051, $hate_id);
			undef $hate_target;
			}

		}
Reply With Quote
  #5  
Old 08-28-2008, 06:05 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

$client shouldn't be exported on timer as there's no client trigger for that event.

Code:
if($hate_target->IsClient()){
	$hate_target->SetLevel(1, false);
}
Reply With Quote
  #6  
Old 08-28-2008, 07:05 PM
phinius
Fire Beetle
 
Join Date: Aug 2008
Location: norrath
Posts: 8
Default

Success! Thanks KLS and everyone else that helped.

Final product for those wanting to do something similar in the future:

Code:
sub EVENT_TIMER{

	if ($timer == 1){
			my $hate_target = $npc->GetHateRandom();
			my $hate_name = $hate_target->GetName();
			my $hate_id = $hate_target->GetID();  
			quest::shout("My hate target is $hate_name"); 
			
			if($hate_target->IsClient()){
				$hate_target->SetLevel(1, false);
							}

			undef $hate_target;

			}

		}
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 02:49 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