HeRO's myriad of custom monsters are often not detected as monsters by homunculus AIs.??This is caused by a bug in Gravity's built in function, IsMonster(id).??Here's a general solution to this that will work for any AI.
First, create a file in your AI called CustomIsMonster.lua and paste the following into it:
Code:
function CustomIsMonster(ID)
if (IsMonster(ID)==1) then
return 1
elseif (CustomMonsters[GetMonsterID(ID)]==true) then
return 1
else
return 0
end
end
function GetMonsterID(ID)
return GetV(V_HOMUNTYPE, ID)
end
code tags should let you use indentations to properly display lua, but they don't here.??Yet another thing here that doesn't work.??Anyway, here's it properly formatted:
http://pastie.org/8732515
Next, create a file called CustomMonsters.lua and paste the following into it:
Code:
CustomMonsters = {}
CustomMonsters[2590] = true -- Nekoring
CustomMonsters[2502] = true -- Autumn LeafCat
This file is a list of all monsters that are not recognized which you would like the AI to recognize.??Yes, they have to be added manually.??There's a way to get around this, but it makes the homunculus see pets as monsters too, which is no good.
Then, add the following two lines to your AI.lua:
Code:
require "./AI/CustomMonsters.lua"
require "./AI/CustomIsMonster.lua"
Put them with other require statements.??You'll know it when you see it.
Finally, replace every instance of "IsMonster" in the AI with "CustomIsMonster" EXCEPT the one in CustomIsMonster.lua