PDA

View Full Version : Making an NPC and Client stop attacking


Greyhelm
02-18-2015, 05:45 PM
I have a problem in a script,

sub EVENT_SPAWN{
quest::emote("text");
quest::setnexthpevent(45);
}
sub EVENT_SAY{
if($text=~/text/i){
quest::say("respone");
}
}
sub EVENT_HP{
if($hpevent <=45){
$npc->SetBodyType(11); #make untargettable to stop client attack
$npc->WipeHateList(); #remove hatelist
$npc->DisableMelee(1); #ensure npc cannot attack further
quest::emote("mob gives up");
quest::say("this line links to EVENT_SAY text");
$npc->SetBodyType (3); #To be able to target again for quest say
$npc->WipeHateList(); #ensure hatelist wiped to enable dialogue
}
}

The npc stops attacking and client stops attacking, but if I do #hatelist on npc it shows client is still on hatelist though damage is low and hate is low. Example -name: Greyhelm, damage:301, hate:16
When I had to do 20,120 damage just to get the npc to 45% to trigger HP_Event. Any thoughts or did I miss something in my script?

If event is triggered and client is say triple attacking would that cause this?

Maceblade
02-19-2015, 09:02 AM
if ($hpevent <= 45) {
quest::emote("shakes with laughter and says, 'You are much stronger than I thought. I give up.");
quest::modifynpcstat("special_attacks",ABfHG);
quest::settimer(1,60);
$npc->WipeHateList();
}

This will keep it targetable just sets it immune. This is what I used for one of my bosses but I removed a bunch of stuff.

Greyhelm
02-19-2015, 12:44 PM
That worked like a charm.. I tried that before but now I see I was trying $npc->modifynpcstats not quest::modifynpcstats... Thanks!