EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Have NPC Guards only assist players with > indifferent faction (https://www.eqemulator.org/forums/showthread.php?t=39242)

iluvseq 01-17-2015 10:48 AM

Have NPC Guards only assist players with > indifferent faction
 
I understand the 'normal' way to configure a guard, where you enable NPC Aggro and make them aggressive to a faction, and then assign that faction to the beasts in the area.

However, this makes the guards attack those beasts whenever in range, and regardless of if they are attacking a player or not.

While I do want that for some guards, what I really want are faction based "defensive" guards who do not attack unprovoked, but will assist players who are at least amiable to their faction, and refuse to help players who are not.

I guess the issue is that players don't do a 'call for help' so there is nothing that kicks in like when NPCs have aggro.

I guess I could do some sort of proximity triggered quest on the NPC and have it look for creatures in range that have the friendly player on their hatelist or something like that, but I was hoping there was a more elegant mechanism.

iluvseq 01-17-2015 11:08 AM

Looks like set_proximity() creates an immobile zone, which would be fine for static guards, but I'm trying to implement this on a roamer. Any ideas?

trevius 01-18-2015 06:30 AM

If you are going to use proximities for that and want them to work for a moving guard, you probably need to use a timer to update the proximity on a regular basis. Here is an example from a script I use:

Code:

$ProxRangeXY = 100;
$ProxRangeZ = 25;

sub EVENT_SPAWN {
        quest::set_proximity($x - $ProxRangeXY, $x + $ProxRangeXY, $y - $ProxRangeXY, $y + $ProxRangeXY, $z - $ProxRangeZ, $z + $ProxRangeZ);
        quest::settimer("setprox", 2);
}


sub EVENT_TIMER {

        if ($timer eq "setprox") {
                quest::clear_proximity();
                quest::set_proximity($x - $ProxRangeXY, $x + $ProxRangeXY, $y - $ProxRangeXY, $y + $ProxRangeXY, $z - $ProxRangeZ, $z + $ProxRangeZ);
        }

}


iluvseq 01-18-2015 10:06 AM

That'll work, thank you!


All times are GMT -4. The time now is 03:45 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.