View Single Post
  #3  
Old 10-15-2014, 06:43 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

Try this for the NPC:
Code:
sub EVENT_SPAWN {
    $npc->TempName("");
    quest::settimer("armor", 30);
}

sub EVENT_TIMER {
    if ($timer eq "armor") {
        my @clientlist = $entity_list->GetClientList();
        my @itemlist = (0000,0000,0000,0000,0000,0000,0000,0000);
        foreach $c (@clientlist) {
            if (plugin::check_hasitemequipped($c, @itemlist)) {
                $c->Message(315, "Your armor protects you from harm.");
            }
            else {
                $c->CastSpell(7026, $c->GetID());
                quest::ze(4, $c->GetCleanName() . " suffers in the throes of anguish.");
            }
        }
    }
}
Try this for the plugin:
Code:
sub check_hasitemequipped {
    my $client = shift;
    my @itemlist = shift;
    foreach $item (@itemlist) {
        for ($i = 0; $i <= 22; $i++) {
            if ($i == 22) {
                $i == 9999;
            }
            if ($client->GetItemIDAt($i) == $item) {
                return 1;
            }
        }
    }
    return 0;
}
EDIT: Slot information can be found here.
Reply With Quote