Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Monster Detection for Homunculus AIs
Author Message
Ange Offline
Senior Member
****

Posts: 254
Joined: Aug 2009
Post: #1
Custom Monster Detection for Homunculus AIs

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
02-14-2014 04:09 AM
Find all posts by this user Quote this message in a reply
The Legendary Joe Offline
Raging Alt-a-holic
*****

Posts: 3,691
Joined: Mar 2007
Post: #2
RE: Custom Monster Detection for Homunculus AIs

hmm, I must be doing something wrong... I'm getting a buncha error messages saying stuff is coming up as a Nill value after modding the AI.lua

[Image: giphy.gif]
The Oka Compendium
: A glorified record of my alt-a-holic-ism. May or may not be up to date at any given point.
05-01-2014 04:28 PM
Find all posts by this user Quote this message in a reply
Laenaya Offline
Where's my flyswatter?!
***

Posts: 124
Joined: Jun 2010
Post: #3
RE: Custom Monster Detection for Homunculus AIs

You might have replaced "IsMonster2" for "CustomIsMonster2" while replacing "IsMonster" for "CustomIsMonster".

If this isn't the case, you could have placed the newly created files (CustomIsMonster.lua and CustomMonsters.lua) inside "<heRO folder>/AI/USER_AI", but referenced them as if they were one level up:

require "./AI/CustomMonsters.lua"
require "./AI/CustomIsMonster.lua"

If that's the case change them to:

require "./AI/USER_AI/CustomMonsters.lua"
require "./AI/USER_AI/CustomIsMonster.lua"

A last possibility would be that you're editing the lua files in "<heRO folder>/AI/" (official AI), instead of the ones in "<heRO folder>/AI/USER_AI" (custom AI).

If anything, I can test this later and give you a copy of my mirAI with this mode, if you use/want it of course.

[Image: CWsTYo5.png]
Dem friends!
05-02-2014 02:34 PM
Find all posts by this user Quote this message in a reply
The Legendary Joe Offline
Raging Alt-a-holic
*****

Posts: 3,691
Joined: Mar 2007
Post: #4
RE: Custom Monster Detection for Homunculus AIs

(05-02-2014 02:34 PM)Laenaya Wrote:  
You might have replaced "IsMonster2" for "CustomIsMonster2" while replacing "IsMonster" for "CustomIsMonster".

If this isn't the case, you could have placed the newly created files (CustomIsMonster.lua and CustomMonsters.lua) inside "<heRO folder>/AI/USER_AI", but referenced them as if they were one level up:

require "./AI/CustomMonsters.lua"
require "./AI/CustomIsMonster.lua"

If that's the case change them to:

require "./AI/USER_AI/CustomMonsters.lua"
require "./AI/USER_AI/CustomIsMonster.lua"

A last possibility would be that you're editing the lua files in "<heRO folder>/AI/" (official AI), instead of the ones in "<heRO folder>/AI/USER_AI" (custom AI).

If anything, I can test this later and give you a copy of my mirAI with this mode, if you use/want it of course.
Oh derp, both of those were the cause. thanks for the troubleshoot. Up and running without any noticable problems.

[Image: giphy.gif]
The Oka Compendium
: A glorified record of my alt-a-holic-ism. May or may not be up to date at any given point.
(This post was last modified: 05-02-2014 11:06 PM by The Legendary Joe.)
05-02-2014 11:06 PM
Find all posts by this user Quote this message in a reply
demishock Offline
Natural Selection
*****

Posts: 444
Joined: May 2009
Post: #5
RE: Custom Monster Detection for Homunculus AIs

Thanks so much for this! I don't know how I missed the original thread when it came up, but I'm glad I finally saw it now.

I've compiled a list of all the custom monsters I could think of, for copy/paste-ability, in three formats...

In order by ID number: http://pastie.org/9147690

In order by monster name: http://pastie.org/9147687

In order by map/category: http://pastie.org/9147680
*Neko Island
*True Poring Island
*Muspelheim
*Orcus Dungeon
*Byalan Dungeon
*Magma Dungeon
*Christmas
*Halloween
*Fairy Paradise

ETA: I've added a link to this thread to the Homunculus page on the heRO wiki.

To help:
Join Test & Dev and/or our heRO wiki
Apply to be a GM or mod
Vote and Review

For help:
Submit a support ticket
Check the heRO wiki

[Image: 29bnhpd.jpg]
(This post was last modified: 05-07-2014 12:25 AM by demishock.)
05-07-2014 12:14 AM
Find all posts by this user Quote this message in a reply
kysp Offline
Junior Member
**

Posts: 47
Joined: Sep 2012
Post: #6
RE: Custom Monster Detection for Homunculus AIs

(05-07-2014 12:14 AM)demishock Wrote:  ...

In order by map/category: http://pastie.org/9147680
*Neko Island
*True Poring Island
*Muspelheim
*Orcus Dungeon
*Byalan Dungeon
*Magma Dungeon
*Christmas
*Halloween
*Fairy Paradise

ETA: I've added a link to this thread to the Homunculus page on the heRO wiki.

Thanks for the list! No1

(05-02-2014 02:34 PM)Laenaya Wrote:  You might have replaced "IsMonster2" for "CustomIsMonster2" while replacing "IsMonster" for "CustomIsMonster".

I did that too. So turn on "Match whole word only" or something similar in the Search & Replace dialog.
05-22-2014 07:51 AM
Find all posts by this user Quote this message in a reply
Blake81 Offline
Junior Member
**

Posts: 17
Joined: Sep 2014
Post: #7
RE: Custom Monster Detection for Homunculus AIs

Could someone please upload their modified lua files here? I've been trying to get this working for the last two hours and I still get the Nil Value error message, and I've done all it says here....
09-25-2014 03:51 PM
Find all posts by this user Quote this message in a reply
whitedraw Offline
YUKI! xD
*****

Posts: 899
Joined: May 2010
Post: #8
RE: Custom Monster Detection for Homunculus AIs

I think this post was once before the SVN updated, I think it might be better for you to check out others AIs that support this new update. Some similar configuration might be required though

[Image: GLgDZOF.gif]

Nya~~ what are you looking at nya???
09-25-2014 09:54 PM
Find all posts by this user Quote this message in a reply
GM-Garr Offline
Local friendly code monkey
****

Posts: 431
Joined: Apr 2014
Post: #9
RE: Custom Monster Detection for Homunculus AIs

Actually, homunculus AI is client-side thing, and has nothing to do with SVNs. So this will still work regardless. I haven't tried it much, but I think it works. At least it ignored custom monster I set it to ignore in the configuration.

(Place it inside USER_AI directory, replacing AI.lua. Also, don't forget to use /hoai ingame to switch to custom AI)


Attached File(s)
.zip  Changed_AI.zip (Size: 66.38 KB / Downloads: 37)

Want to help HeRO with new content? Join the T&D Team!

For info on the server, check out the HeRO wiki.
To see your ingame account, visit the Control Panel.
If you encounter any problems, don't hesitate to submit a Support Ticket.

And don't forget:
Not all dragons are bad...
09-26-2014 04:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump: