Originally Posted by
Queso
2.) NPC finding. I want to set up multiple TMSObjects for different goblins (they look a lil different) and I was using the tutorial by @Flight found
here. Question is: does the inner and outer colors truly have to be "inner" or "outer"? In the case of goblins, I want to find the body and head colors, respectively, with some sort of tolerance ... so would I use the body color as the inner color & head as outer? Also the tutorial doesn't really elaborate how the hue and saturation tolerance affects its findings ... is there a tutorial that elaborates on those? I have a basic understanding of both but would like to read up more on it & if certain values are recommended in different cases.
Thanks!
No they aren't truly inner & outer colors any more. In my very original system they were in fact utilized that way; the outer color found first, TPAs were split, boundaries for each TPA were found, and within each boundary the inner color would then be searched for and so on... This system was actually a by product of my original herb-farming script, truly one of my best creations. It also produced neat functions like ForceATPA, which I'd like to throw in the next revision of AeroLib.
Now it's just a matter of dual-colors being found within a given distance of each other. I suppose a more appropriate title would be "Color A/Color B". Most of the base functions that find TMSObjects have a parameter for declaring the max distance between the two colors, whereas some of the overloaded versions default back to 10 simply for easier scripting.
Simba Code:
if rock_Iron.find() then Mine();
vs...
if rock_Iron.find(10, MSCP, FOUND_POINT) then Mine();
And also something to keep in mind is if you're searching for a TMSObject that has both "inner & outer" colors then you should keep in mind that it's the inner color that will ultimately be the result of the finder. I know that may be a bit confusing so here's and example: A TMSObject of a goblin is declared. You make the inner color as the body and the outer color as its head. Calling these two different functions would then result as given:
Simba Code:
Goblin.findAll(10, MSCP, FOUND_POINTS);
If this function results True then it'll spit back a TPointArray (in this case, "FOUND_POINTS") of the center point of every inner color cluster (TPA) found that was within distance (in this case, 10) of the outer color. So you'll have a TPointArray of the center of every goblin's body (inner color) rather than a TPA of the center of every goblin's head (outer color). And the other way to find TMSObjects by having the finder go a step further and manually check each possible point for the TMSObject's uptext:
Simba Code:
Goblin.find(10, MSCP, FOUND_POINT);
"FOUND_POINT" would be the point at which the first matching TMSObject is found and verified via moving the mouse to it and checking the uptext. However since your mouse is already over the goblin then you really don't need to store this point at all, just click to begin attacking right? If that's the case, try this:
Simba Code:
if Goblin.find() then fastClick(MOUSE_LEFT);
Easy as pie.
You might wonder what's the point of having the finder return a TPA of all of the matching TMSObjects rather than right away moving the mouse to each possible object to check uptext. Well, this would work better if you wanted to find all of a certain NPC and then go a step further to check if each of those found TMSObjects had a HP bar above them, indicating they're currently in combat and unavailable to attack. Just an example.
So I hope that sheds some light on the subject. I see Dan's already given you a link to AutoColorAid and how to use that to create unique, accurate colors. Post back if you've still questions or you run into any issues; I'll be happy to lend a hand and I'm sure Dan would be as well; he's knowledgeable and does a wonderful job of answering & explaining. By the way, if you'd like an example of a fighting script that targets NPCs with TMSObjects tied to them, take a look at AeroFighter Lite. And here's the NPC file I made for goblins in the Stronghold of Security:
Code:
[NPC_Obj_Main]
ObjCount=2
XPMod=65
[NPCObj_0]
Name=Goblin
UpText(C)=3
UpText[0]=ck Gob
UpText[1]=Goblin
UpText[1]=oblin
ColI=3048061
TolI=12
hModI=0.04
sModI=0.13
[NPCObj_1]
Name=Goblin
UpText(C)=3
UpText[0]=ck Gob
UpText[1]=Goblin
UpText[1]=oblin
ColI=4813108
TolI=11
hModI=0.04
sModI=0.12
[GI_Array_Main]
GICount=0
CheckNotedItems=False
[Map_Settings]
UseMap=True
UseDots=False
MapName=SecurityStronghold
MapX=126
MapY=205
You can see I declared 2 TMSObjects for this NPC; one for the lighter colored goblins, the other for darker colored ones.