EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Plugins & Mods (https://www.eqemulator.org/forums/forumdisplay.php?f=678)
-   -   plugin::CountNPCTYPE (https://www.eqemulator.org/forums/showthread.php?t=32607)

Kayen 12-02-2010 08:49 PM

plugin::CountNPCTYPE
 
Usage: plugin::CountNPCTYPE($NPC_TYPE_ID);

Counts the number of NPC's in a zone that have the same npc type id.

Code:

sub CountNPCTYPE {

        my $npc = plugin::val('npc');
        my $entity_list = plugin::val('$entity_list');
        my $NPC_TYPE_ID = $_[0];

        @npclist = $entity_list->GetNPCList();

                $Count_NPC_TYPE = 0;
                    foreach $cur (@npclist) {
                my $NPC_TYPEid = $cur->GetNPCTypeID();
                               
                        if ($NPC_TYPEid == $NPC_TYPE_ID) {
                        $Count_NPC_TYPE++;
                        }
                }
        return $Count_NPC_TYPE;
}

Kayen
GM Storm Haven

Akkadius 12-02-2010 10:35 PM

Quote:

Originally Posted by Kayen (Post 194752)
Usage: plugin::CountNPCTYPE($NPC_TYPE_ID);

Counts the number of NPC's in a zone that have the same npc type id.

Code:

sub CountNPCTYPE {

        my $npc = plugin::val('npc');
        my $entity_list = plugin::val('$entity_list');
        my $NPC_TYPE_ID = $_[0];

        @npclist = $entity_list->GetNPCList();

                $Count_NPC_TYPE = 0;
                    foreach $cur (@npclist) {
                my $NPC_TYPEid = $cur->GetNPCTypeID();
                               
                        if ($NPC_TYPEid == $NPC_TYPE_ID) {
                        $Count_NPC_TYPE++;
                        }
                }
        return $Count_NPC_TYPE;
}

Kayen
GM Storm Haven

Put this in npc_tools.pl - Revision 4


All times are GMT -4. The time now is 02:06 PM.

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