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 05-24-2011, 09:39 PM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default NPC / Mob Variable

Is there a variable that would returns the name of the npc that triggered the Event?

Like for example. If one of the guard attack a newbie mob (a large rat). Guard would say "Time to die a large rat!".

So far I haven't been able to find the right variable to script it. I thought maybe $mname would do it but instead it returns the name of the npc instead of the mob that triggered it. Something like "Time to die Guard_Soyler0001!" instead of the actual "Time to die a large rat!"
Reply With Quote
  #2  
Old 05-24-2011, 09:50 PM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

Looks like $targetname would do it. Sometime the name does not show up and sometime it shows up as a_large_rat000. Be cool if that underscore and zeros were left out. lol. I could probably try to pause the npc to give it time to target or put in $combatstate==0.
Reply With Quote
  #3  
Old 05-24-2011, 09:52 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

$npc->GetHateTop()->GetName();
or GetCleanName() should strip the _000

I didn't test it, but something close to this.
__________________
The Realm
Reply With Quote
  #4  
Old 05-24-2011, 10:47 PM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

yeah I test it with getcleanname() and doesn't take out the _000. Perhaps I don't have it arrange in right. $targetname works half the time tho. better than none at all. quest::pause() doesn't really work. it just pause the npc after the kill.
Reply With Quote
  #5  
Old 05-25-2011, 12:26 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

GetCleanName()
I ran into that a long time ago with $targetname, and I can't remember what my workaround was. I'll look for it again later and let you know what I did.

quest::pause()
What did you expect it to do?
Reply With Quote
  #6  
Old 05-25-2011, 12:58 AM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

I was hoping that it would pause the npc long enough to give itself some time to target the mob instead of prematurely before the quest::say.
Reply With Quote
  #7  
Old 05-25-2011, 01:56 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

I'm not at my system to check, but I thought pause was for the grids/waypoints system. You could always use a timer to introduce a pause.
Reply With Quote
  #8  
Old 05-25-2011, 02:17 AM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

right, it is fun to learn the perl questing and to experiment with them. I managed to make the south qeynos campfire event where npcs would stand near the fire at night then make it move during the day. So livelike, I'm loving it. Anyway if you find getcleanname() and how I would use it, that would be great. I can probably dig up something in the quests folder to see if I can find something.
Reply With Quote
  #9  
Old 05-25-2011, 02:54 PM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

Hmm I haven't had much luck with this kind of coding. Any thing wrong with this code? Guard doesn't say anything at all when in combat.

sub EVENT_COMBAT {
if($combat_state == 1){
my $cur_target = $npc->GetHateTop()->GetTarget();
if($cur_target) {
my $target_name = $cur_target->GetCleanName();
quest::say("Time to die $target_name!");
}
}
}
Reply With Quote
  #10  
Old 05-25-2011, 03:17 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

my $cur_target = $npc->GetHateTop();
should be good enough. If you then do GetTarget() it probly just goes points back to npc.
__________________
The Realm
Reply With Quote
  #11  
Old 05-25-2011, 03:26 PM
Robregen
Developer
 
Join Date: May 2011
Posts: 109
Default

wow, that works like a charm. this code works like it should for those that had trouble:

sub EVENT_COMBAT {
if($combat_state == 1){
my $cur_target = $npc->GetHateTop();
if($cur_target) {
my $target_name = $cur_target->GetCleanName();
quest::say("Time to die $target_name!");
}
}
}


Thanks Congdar!!!
Reply With Quote
Reply


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 08:51 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