How To Count How Many Mobs Engaged?

lixleon

Member
Is there any command for count how many mobs engaged on group?
I checked wiki, but didn't get any lucky.
I know Ogre can do this for whole cast orders.
But I want to adjust every single spell in different counting.
Thanks for help.
 

lixleon

Member
I did this code, MobNum will return how many mobs engaged within 15 m.
Code:
function main()
{
variable int MobNum=0
variable int MobCon=1
	EQ2:CreateCustomActorArray[byDist,15,NPC]
	if ${EQ2.CustomActorArraySize}>=1
	{
		while ${MobCon}<=${EQ2.CustomActorArraySize}
		{
			if ${CustomActor[${MobCon}].InCombatMode}
			MobNum:Inc
			MobCon:Inc
		}
	 }
	echo ${MobNum} Mobs engaged.
}
 

Kannkor

Ogre
One thing to note: EQ2:CreateCustomActorArray uses internal memory that is global. If you run this script, while a different script is trying to iterate through them, you will change their data.

Now, in a perfect world, everyone knows this, and no code block that isn't atomic, would use this to prevent the conflict.

(I'm not implying there is anything wrong with it at all, just pointing out possible conflicts if you start having any issues).
 

lixleon

Member
Sounds like this code will conflict with Ogre?
So Is there any mobs data I can use from Ogre? I just want to make a script that enable and disable cast order in Ogre to make sure bots cast correct AoE spell.
 

lixleon

Member
One thing to note: EQ2:CreateCustomActorArray uses internal memory that is global. If you run this script, while a different script is trying to iterate through them, you will change their data.

Now, in a perfect world, everyone knows this, and no code block that isn't atomic, would use this to prevent the conflict.

(I'm not implying there is anything wrong with it at all, just pointing out possible conflicts if you start having any issues).
Yeah it will conflict with OSA, I just noticed.
 

lixleon

Member
I rewritten like this:

Code:
function mobschecker()
{
	;;EQ2:CreateCustomActorArray[byDist,20,NPC]
	if ${EQ2.CustomActorArraySize}>=1
	{
		while ${MobCon}<=${EQ2.CustomActorArraySize}
		{
		   if ${CustomActor[${MobCon}].Type.Equal[NPC]} || ${CustomActor[${MobCon}].Type.Equal[NamedNPC]}
			{
			if ${CustomActor[${MobCon}].InCombatMode} && ${CustomActor[${MobCon}].Distance}<=20
			MobNum:Inc
			}
		   MobCon:Inc
		}
	 }
}
 

Kannkor

Ogre
If it's affecting OSA, I'll look into fixing that. OSA is pretty old, so it's possible.
Come to think of it, it's possible all of Ogrebot uses it, but shares it with a global controller... which works great except when others try to use it too apparently... :)
What you should use is EQ2:GetActors. More information and I think an example can be found in isxeq2 wiki.
 

user01

Member
One thing worth noting, is that if you're in a public area this will include any mobs that are engaged with other players, not just you/your group/your raid. May not matter for your uses.

If it does matter for you, you can just add a check to see whether ${CustomActor[${MobCon}].Target.Name.Equals[groupmembername]} for everyone in your party
 
Top Bottom