EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   NPC selecting a specific player from a group (https://www.eqemulator.org/forums/showthread.php?t=25588)

kayen85 06-28-2008 03:44 PM

NPC selecting a specific player from a group
 
Anyone know of a good way to code an event where an NPC who is fighting a group of people will select a player randomly out of that group and cast a spell on it?

I am not so concerned about the random part or the spell but just if there is a way to have an npc to select which player in a group it would attack.

trevius 06-28-2008 06:50 PM

I don't think it is possible for it to pick anything other than it's primary target and maybe the rampage or secondary target. But, if there is a way, you probably would be best to look for it in the quest object wiki here:

http://www.eqemulator.net/wiki/wikka...a=QuestObjects

AndMetal 06-30-2008 12:16 AM

I'm not sure if this is quite what you're looking for, but you could use a Quest Global to select someone at random from the Hate List:

Code:

$mob->GetHateRandom();
I think you could then use another Quest Global to cast the spell on them:

Code:

$mob->CastSpell(123, $mob->GetHateRandom());
That should cast a spell with a Spell ID of 123 on a random person in the hate list.

You might be able to find a way to work back from that Client ID given by GetHateRandom to get the group ID, then find out who's in it, but I wasn't able to find anything like that just browsing through the quest globals.

Hope this helps.

Striat 06-30-2008 05:38 PM

I've changed up GroupCount to account for names and also used count and member id of group to do something like this. Basically, if you're number 2 in a group of 4, I'd have a random integer of 1-GroupCount if Group. Get the client name and perform the action. It can make raid encounters a little sticky;p I'm trying to dig up the code, but no dice yet. Will keep it posted.


All times are GMT -4. The time now is 07:23 PM.

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