Quote:
Originally Posted by Astal
You can send a signal from one npc to another correct?
If so am I using $npc->SetHP correctly here? Can you have a -# inside the brackets or do you have to do that a different way?
Code:
#azog mon
sub EVENT_SIGNAL {
quest::shout("Signal Sent");
$npc->SetHP(-100000); #damage azog mon by 5%
}
Code:
#hand
sub EVENT_DEATH {
quest::signal(999430, 0); #signal azog mon to get damaged
}
|
As for the SetHP, it sets the HP to a value within the hitpoints of the NPC. So you will need to grab the NPC hitpoints first.
Code:
my $curhp = $npc->GetHP();
my $HealPoints = -100000;
$npc->SetHP($curhp + $HealPoints);
Or you can use the plugin::MobHealPoints(Hitpoints to heal); from the plugins repo.
plugin::MobHealPoints(-100000);
Will achieve the same effect.
And usually a good way to go about using signals is to lace them with an ID using signalwith so that you can use different signals that do different things throughout an event.
For example:
quest::signalwith(int npc_id, int signal_id, int wait_ms);
Code:
#hand
sub EVENT_DEATH {
quest::signalwith(999430, 4, 1); #signal azog mon to get damaged
}
Code:
#azog mon
sub EVENT_SIGNAL {
if($signal == 4){
quest::shout("Signal Sent");
$my $curhp = $npc->GetHP();
my $HealPoints = -100000;
$npc->SetHP($curhp + $HealPoints); #damage azog mon by 5%
}
}