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 12-22-2008, 12:00 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default npc finds player and gives an item?

i made a new spell that spawns a pet. not i wish to get the owner of that pet have the npc give the owner a random item then kill off the pet. how would i do that?

i know to kill the pet i make the owner cast reclaim energy.
i know how to pick a random item

what i dont know is how to get the pets owner and then make them call the script parts related to the client.

this is what im working with so far.

Code:
sub EVENT_SPAWN 
{
quest::say("im up.");
$target = $npc->GetOwnerID();
$clientwho = $EntityList->GetClientByID($target);
$clientset->SummonItem(1333);
}
of course this don't work and its pissing me off been working on this for hours.. anyone go a clue on how to do this or a diff way to do it even?

what im trying to do is have a gift time when someone cast the spell on it it summons a invis pet (so he can run a script) gives a random item then despawns.. it dont even have to be a pet actually i would prefer that but i figure its easyer to get the pet owner then the person that caster the spell.
Reply With Quote
  #2  
Old 12-22-2008, 01:04 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Whenever I am trying anything new like that, I always test it by setting quest::say to report what the quest is actually getting. So, when you get the owner ID, I would add a quest::say after that to see exactly what ID it is getting, if any:

Code:
sub EVENT_SPAWN  {
  quest::say("im up.");
  $target = $npc->GetOwnerID();
  quest::say("My owner's ID is $target");
}
And then, if it returned nothing, then most likely the object isn't being used properly. If something is returned, then you need to know what kind of ID it is getting. Most likely it is getting the character's entity ID, which would be something like 222 (and can be verified by doing a #showstats on yourself). It could also be getting the character, which is a string of characters more like EBDSX=11ASDF13 or something (completely made that up). In this case, it should be getting the entity ID. So, now we need to get the client using that entity ID. Here is how to do that:

Code:
sub EVENT_SPAWN  {
  quest::say("im up.");
  $target = $npc->GetOwnerID();
  quest::say("My owner's ID is $target");
  $getclient = $entity_list->GetClientByID($target);
  quest::say("I got client $getclient");
}
Using says after each step will show where the script is failing, if it is. Next, you should be able to summon the item for them:

Code:
sub EVENT_SPAWN  {
  quest::say("im up.");
  $target = $npc->GetOwnerID();
  quest::say("My owner's ID is $target");
  $getclient = $entity_list->GetClientByID($target);
  quest::say("I got client $getclient");
  $getclient->SummonItem(1333, 1);
  quest::say("All Done");
}
That is basically the same thing you have already done, but it explains the steps of how I would do it and I think corrects a couple of mistakes in the script you posted.

If that doesn't work, you might be able to use something like this:

Code:
sub EVENT_SPAWN  {
  quest::say("im up.");
  $target = $npc->GetOwnerName();
  quest::say("My owner's name is $target");
  $npc->SetTarget($target);
  quest::say("Target has been set to $target");
  quest::summonitem(1333);
  quest::say("All Done");
}
Let me know if none of that helps. We can probably think of some way to do it. I am not at home atm, so I can't test any of it for you.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 12-23-2008, 05:24 AM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

thanks the first one worked..
ps.
the sec one did not work but its all good.
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 12:06 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3