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 10-13-2020, 09:28 AM
macdaddy02
Fire Beetle
 
Join Date: Oct 2020
Posts: 13
Default

Could I do something like this?

Code:
sub EVENT_SPAWN {
    #:: Match BLpet70 (528)
    if ($mob->GetNPCTypeID() == 528) {
        #:: Create a scalar variable to store the pet owner's entity list ID
        my $PetOwner = $entity_list->GetClientByID($npc->GetOwnerID());
        #:: Match owner race 1 - Human
        if ($PetOwner->GetRace() == 1) {
            #:: Set race 22 - Beetle
            $npc->SetRace(22);
        }
        #:: Etc.
    }
    #:: Etc.
}
This doesn't seem to work. I get the wolf every time still.
Reply With Quote
  #2  
Old 10-13-2020, 06:31 PM
macdaddy02
Fire Beetle
 
Join Date: Oct 2020
Posts: 13
Default

Ok after hours and hours if trying these, I got some effects to work.

Code:
sub EVENT_SPAWN {
    if ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 1) { # Human
            $npc->SetRace(468);
            $npc->ChangeSize(12);
        }
    }
}

sub EVENT_SPAWN {
	if ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 2) { # Barbarian
            $npc->SetRace(528);
            $npc->ChangeSize(4);
        }
	}
}
When I do it this way the Barbarian actually works, but if I put anymore code (other races) below it then it won't work on the Barbarian. It's like only the last one works.

I then tried this:

Code:
sub EVENT_SPAWN {
    if ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 1) { # Human
            $npc->SetRace(468);
            $npc->ChangeSize(12);
        }
    }
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 2) { # Barbarian
            $npc->SetRace(528);
            $npc->ChangeSize(4);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 3) { # Erudite
            $npc->SetRace(602);
            $npc->ChangeSize(8);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 4) { # Wood Elf
            $npc->SetRace(64);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 5) { # High Elf
            $npc->SetRace(473);
            $npc->ChangeSize(5);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 6) { # Dark Elf
            $npc->SetRace(365);
            $npc->ChangeSize(8);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 7) { # Half Elf
            $npc->SetRace(560);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 8) { # Dwarf
            $npc->SetRace(16);
            $npc->ChangeSize(6);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 9) { # Troll
            $npc->SetRace(259);
            $npc->ChangeSize(8);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 10) { # Ogre
            $npc->SetRace(135);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 11) { # Halfling
            $npc->SetRace(321);
            $npc->ChangeSize(6);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 12) { # Gnome
            $npc->SetRace(570);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 128) { # Iksar
            $npc->SetRace(389);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 330) { # Froglok
            $npc->SetRace(245);
            $npc->ChangeSize(7);
        }
	}
	elsif ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 522) { # Drakkin
            $npc->SetRace(611);
            $npc->ChangeSize(7);
        }
	}
}
But it doesn't work at all.

So I tried to come up with this one:

Code:
sub EVENT_SPAWN {
    if ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 1) { # Human
            $npc->SetRace(468);
            $npc->ChangeSize(12);
		elsif ($petowner->GetRace() == 2) { # Barbarian
            $npc->SetRace(528);
            $npc->ChangeSize(4);
		elsif ($petowner->GetRace() == 3) { # Erudite
            $npc->SetRace(602);
            $npc->ChangeSize(8);
		elsif ($petowner->GetRace() == 4) { # Wood Elf
            $npc->SetRace(64);
            $npc->ChangeSize(7);
          }
	    }
      }
    }
  }
}
Again, it doesn't work. This is my very first attempt at perl, but as I stated I managed to get the first one somewhat working, but it fails if anything is below the first code (only the last one works).

So, anyone know where I am going wrong and how to make it work so that all the races work in one file?
Reply With Quote
  #3  
Old 10-13-2020, 06:57 PM
macdaddy02
Fire Beetle
 
Join Date: Oct 2020
Posts: 13
Default

FINALLY GOT IT FIGURED OUT!! WOOHOO!!! <--- Not bad for someone who has only been messing with the PEQ database, private server and .pl files for a week, eh? :P

**Special Thanks to: TurmoilToad and Huppy for helping me figure this out.

To anyone who wants to use a .pl file instead of hard coding or messing up the actual beastlord pet spells, here you are

Code:
sub EVENT_SPAWN {
    if ($npc->GetNPCTypeID() == 837) {
        my $petowner = $entity_list->GetClientByID($npc->GetOwnerID());
        if ($petowner->GetRace() == 1) { # Human
            $npc->SetRace(468);
            $npc->ChangeSize(12);
		}
		elsif ($petowner->GetRace() == 2) { # Barbarian
            $npc->SetRace(528);
            $npc->ChangeSize(4);
		}
		elsif ($petowner->GetRace() == 3) { # Erudite
            $npc->SetRace(602);
            $npc->ChangeSize(8);
		}
		elsif ($petowner->GetRace() == 4) { # Wood Elf
            $npc->SetRace(64);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 5) { # High Elf
            $npc->SetRace(473);
            $npc->ChangeSize(5);
        }
		elsif ($petowner->GetRace() == 6) { # Dark Elf
            $npc->SetRace(365);
            $npc->ChangeSize(8);
        }
        elsif ($petowner->GetRace() == 7) { # Half Elf
            $npc->SetRace(560);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 8) { # Dwarf
            $npc->SetRace(16);
            $npc->ChangeSize(6);
        }
		elsif ($petowner->GetRace() == 9) { # Troll
            $npc->SetRace(259);
            $npc->ChangeSize(8);
        }
		elsif ($petowner->GetRace() == 10) { # Ogre
            $npc->SetRace(135);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 11) { # Halfling
            $npc->SetRace(321);
            $npc->ChangeSize(6);
        }
		elsif ($petowner->GetRace() == 12) { # Gnome
            $npc->SetRace(570);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 128) { # Iksar
            $npc->SetRace(389);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 330) { # Froglok
            $npc->SetRace(245);
            $npc->ChangeSize(7);
        }
		elsif ($petowner->GetRace() == 522) { # Drakkin
            $npc->SetRace(611);
            $npc->ChangeSize(7);
        }
    }
}
Tested and working great as of today
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 04:37 AM.


 

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 - 2026, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3