PDA

View Full Version : Npc detection help



chief herb
02-27-2018, 04:26 AM
How would I go about more accurately finding an npc then being able to tell if it is in combat. Want to keep current scrit private atm.will pm only

Sk1nyNerd
02-27-2018, 09:02 PM
Use a color finding function based off of the head of the NPC and then create a static search box for the health bar "y" amount of pixels above the location of the color found on the NPC's head.

Might run into problems in populated combat areas.

chief herb
04-14-2018, 06:59 PM
Use a color finding function based off of the head of the NPC and then create a static search box for the health bar "y" amount of pixels above the location of the color found on the NPC's head.

Might run into problems in populated combat areas. sounds good, but have no idea how to look for a static box from the position of my mouse after it found the npc/color.

Aspect
04-14-2018, 11:49 PM
sounds good, but have no idea how to look for a static box from the position of my mouse after it found the npc/color.

GetMousePos(var x, y: integer);
http://docs.villavu.com/simba/scriptref/mouseandkeyboard.html
Will return mouse position

But you'd be better off just using using the variables the position was stored in using the findColor function:
FindColor(var x, y: Integer; col, x1, y1, x2, y2: Integer)
http://docs.villavu.com/simba/scriptref/color.html

Then you would just use the findColors within a specific region relating to the point where you found the color.
Because health bars are typically above the NPCs head, you would just search for health bar colors (green/red) at a Y distance downwards of color found.

So If your color of the npc is found at 100, 100, you would search the NPCs health bar at around 90, 80 - 110, 90.
If found, you know that NPC is in combat.

chief herb
04-15-2018, 05:26 PM
GetMousePos(var x, y: integer);
http://docs.villavu.com/simba/scriptref/mouseandkeyboard.html
Will return mouse position

But you'd be better off just using using the variables the position was stored in using the findColor function:
FindColor(var x, y: Integer; col, x1, y1, x2, y2: Integer)
http://docs.villavu.com/simba/scriptref/color.html

Then you would just use the findColors within a specific region relating to the point where you found the color.
Because health bars are typically above the NPCs head, you would just search for health bar colors (green/red) at a Y distance downwards of color found.

So If your color of the npc is found at 100, 100, you would search the NPCs health bar at around 90, 80 - 110, 90.
If found, you know that NPC is in combat.

ok i was thinking it'd be something like this. but how do i go about the procedure knowing where the "100(x),100(y)" is at after finding it, and then searching from the x, y? do is assign my hp bar search co ords as x1 -10 y1 -10 x2 +10 y2 +10?

Aspect
04-15-2018, 06:59 PM
Yes, you are on the right track.
FindColor will store the color position(if found) in the x y value you passed to it. You can then use those for parameters for your next color search functions area