EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   need the client to issue a command (https://www.eqemulator.org/forums/showthread.php?t=33273)

lanystvyl 04-03-2011 11:01 AM

need the client to issue a command
 
I thought this would be easy but I can't find the right way to do this.

#need to check if client has pet not sure if i need to but it makes sense to, if pet == true then remove the pet on zone from player.

sub EVENT_ENTERZONE {

GetPetID()

#assuming this will let me know if there is a pet, not sure on syntax.

how do you force the client issue the pet kill command? I cant find this part.
/pet get lost

joligario 04-03-2011 12:16 PM

Should be something like this:

Code:

sub EVENT_ENTERZONE {
  my $pet_id = $client->GetPetID();
  if ($pet_id) {
    $pet = $entity_list->GetNPCByID($pet_id);
    $pet->Depop();
  }
}


lanystvyl 04-03-2011 05:54 PM

This almost works Depop() doesn't depop the pet. It leaves the pet at the zone-line, and also keeps it in the pet window. Although the pet is no longer yours.

joligario 04-03-2011 08:48 PM

Then it's most likely the server and client arent synced. Your client may see a ghost. You can add a delay using a timer to ensure pet and client are in zone for the client before it depops.

lanystvyl 04-04-2011 08:15 AM

Going to try this when i get the chance;

Code:

for ($count = 10; $count >= 1; $count--) {

sub EVENT_ENTERZONE {
  my $pet_id = $client->GetPetID();
  if ($pet_id) {
    $pet = $entity_list->GetNPCByID($pet_id);
    $pet->Depop();
      }
  }
       
}

If it looks wrong let me know.

joligario 04-04-2011 10:14 AM

Yeah, I wouldn't do it that way. I would use a timer. Something like this:

Code:

sub EVENT_ENTERZONE {
  my $pet_id = $client->GetPetID();
  if ($pet_id) {
    quest::settimer($pet_id, 3);
  }
}

sub EVENT_TIMER {
  quest::stoptimer($timer);
  $pet = $entity_list->GetNPCByID($timer);
  $pet->Depop();
}

And if lag seems to still make it not catch the pet, move the entire function underneath the timer.

lanystvyl 04-05-2011 07:51 AM

Thank you, this works. I adjusted the time a little for each zone I want it to work in. It takes 3 seconds after zone before the name turns red, so after that the pet can die off. pretty cool stuff.


All times are GMT -4. The time now is 08:03 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.