No, that is not correct. You almost have the plugin correct, but you have extra script lines at the end that will break your plugins:
You should be able to delete this:
Code:
return;
# Sample code to work from
my $random_result = int(rand(100));
if(($combat_state == 1) &&($random_result<=50)){
quest::say("Death!! Death to all who oppose the Crushbone orcs!!");
}else{
quest::say("You've ruined your lands. You'll not ruin mine!");
}
At the end of your plugin file you posted.
Next, you would want to call that plugin from your default.pl file. You do not want to put the default.pl directly in your quests folder, you want it in quests/templates/default.pl so it will effect all NPCs that do not already have a script associated with them.
Then, in that default.pl file, you would have the following code:
Code:
sub EVENT_COMBAT {
plugin::defaultCombat();
}
That will make it call the plugin you added to restore their HPs to 100%.
As mentioned, any NPC that already has a script associated with them in your templates folder or in the quests zone folder for the zone they are in will still need to be modified to have the new plugin added to them. If they already have an EVENT_COMBAT, you would just need to add the plugin line "plugin::defaultCombat();" inside the EVENT_COMBAT. If they don't have an EVENT_COMBAT already, you would need to add the sub EVENT_COMBAT as I posted above for your default.pl file.
Since this seems to be a bit confusing to you, there is a MUCH easier way to accomplish what you are wanting to do without even having to worry about scripts at all. You can just edit your rule_values table and set " NPC:OOCRegen" to 100. This will make all NPCs regen to 100% about 6 seconds after it leaves combat.