PDA

View Full Version : The Ultimate Guard


Bandor
01-02-2015, 09:32 AM
So ive been looking around through page of page of quest submission/Q&A , but havent been able to find anything relating to this...Im trying to write a script for the ultimate guard, A Npc who is permaroot but aggros any npc that is within a certain range of him. I know the range part would be fairly easy with Event timer or whatever it is ( Ive seen the plugin before just to tired to remember exact name) but I have no idea how to make him attack npcs. Trying to avoid faction if possible but will use it if I must. Anyone know of a way of achieving this using perl?

Kingly_Krab
01-02-2015, 01:04 PM
You can do this in Perl, yes, but writing them to attack on a timer on proximity-based entities isn't as good as just having them aggro the NPC. Doing this with faction would be the much simpler route. There is an npc_aggro column in npc_types which you can turn on and off to make an NPC aggro on to other NPCs. If you haven't deleted the Mines of Gloomingdeep (tutorialb, zone 189) guards, you can take a look at how their faction works and what the faction of the trash in their zone looks like. Hopefully this will help you out.

chrsschb
01-02-2015, 01:16 PM
What KC said. There's a faction that's KOS to all. I believe simply using that will take care of your issue. Then you just need to set the guard to have an appropriate aggro range.

Bandor
01-02-2015, 06:13 PM
Would making him KOS to all make him attack players aswell?

Bohbo
01-13-2015, 11:40 AM
Try this I wrote this today for an encounter.

sub EVENT_SPAWN{
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
#$h = $npc->GetH();

quest::set_proximity($x - 70, $x + 70, $y - 70, $y + 70);
$zoneid = $npc->GetZoneID();
quest::setnexthpevent(90);
}


sub EVENT_ENTER {
my $n = $client->GetName();
quest::emote("you dare challenge me $n?");
quest::attack($n);
quest::movepc($zoneid, $x, $y, $z); #summons player to him on agro

}