heRO-Server Forum

Full Version: Fixing AI after the last update
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Good night all
Since the last update this week (october 2015) mostly AI stopped working and crashed, making it unnable to play with homuns.

Not too long I posted here (Default AI) a default AI used on test server, so you can at least log in with your alchemist.

Analyzing the errors messages when the client crashes it has found that some commands on the old AIs doesnt work anymore for the new client. I've found 3 types of errors that il try to show how to fix:

Cannot open "file"
This happens because the client runs the AI.lua first and this one "calls" other files.
The error happens because of two things:
- The old AI uses a command called "require "file"", which may seem to be not working anymore. To fix this, change the
PHP Code:
require "./AI/USER_AI/Const.lua" 
to
PHP Code:
dofile("./AI/USER_AI/Const.lua"
for example, you will need to search on all files from your USER_AI folder for those lines and change this. do not forget to close the () before any --
-- means that line is a comment and the client will not recognize anything after it, for example

PHP Code:
require "./AI/USER_AI/Config.lua" -- configuration file 
change to
PHP Code:
dofile("./AI/USER_AI/Config.lua") -- configuration file 
instead of
PHP Code:
dofile("./AI/USER_AI/Config.lua" -- configuration file

-The second part of this error is that now the client will only recognize the files from AI_sakray folder instead of AI folder, so, you will need to create another folder called AI_sakray and put all files on it.
After that you will need to correct the way the command dofile calls those files from, all of them should be "./AI/USER_AI/file", you will need to change to "./AI_sakray/USER_AI/file", for example:

PHP Code:
dofile("./AI/USER_AI/Const.lua"
change to
PHP Code:
dofile("./AI_sakray/USER_AI/Const.lua"

again, do this TO ALL FILES ON YOUR AI FOLDER.

attempt to call a table value
This is another error I found, but I cant just explain how it works, if you are curious you can read this (Tables Tutorial - LUA), basically it tries to check a value from a table, but the syntax is not recognized by the new client.

to fix this you will need to log into your char and crash it, it will show a error message with a number, which is the number of the line with the error on the code.
go to this line and you will find something like this:

PHP Code:
for i,v in NoAggroMobList do 
the name can vary but the important is to change it to something like this:
PHP Code:
for iv in pairs(NoAggroMobList) do 

again, do it on all lines like this on your code. If you miss any line the client will crash again and say which is the line with the error.

I hope you guys understand this.

Good luck
Gianluca

@edit: One more thing. You should expect some crashes even after those corrections, which means that you probably forgot to correct some lines of the code or this is a new error (which I doubt but is possible). In this case, please send the screenshot with the error log.
Much thanks for this Icon_smile
I'll do the code changes to my own AI, then post the resulting files, as not everyone is extremely tech savvy.

Edit:

Here's the link to the file download. Let me know if the link is bad. Was apparently too big to be uploaded on the forums :/

Fixed Files

[Image: b425bfefffd1a7c468a5ca464d77b353.png]
Thanks a TON for all of this! I edited the bejeezus out of my own files and now it appears to be fully functioning again. \o/ Including ALT+T making my Amistr go attack things.

Also, if anyone wants to add the new custom monsters from Poporing Island to their CustomMonsters.lua file (tutorial here for those who don't have it yet):

CustomMonsters[2576] = true -- Cupcakering
CustomMonsters[2581] = true -- Deviruchiring
CustomMonsters[2863] = true -- Foxring
CustomMonsters[2865] = true -- Jailring
CustomMonsters[2864] = true -- Orcring
I am totally lost.. overall... (How do you name all the files? Not sure I'm understanding this... help please)
I log on my Alchemist, which the Homunc is already summoned...
I get the following two AI.lua errors:
"cannot open ./AI_sakray/AI.lua: No such file of directory"
&
"attempt to call a nil vale"
Rei, I did the fixed files following sac's instructions so you didnt have to dig through lines of code. :x
Hmm, you should create a new folder named AI_sakray on RO folder, then put the files from old AI inside this one. After you will have 2 folders with the same files, AI and AI_sakray. I dont know why or if AI is still needed, I just leaved mine there.
Of course you can download the files summer uploaded, I believe she uses mirAI too, but you will need to reconfig it, probably.
Yeah, I use MirAI, Sac. Its the AI provided by the server.
From doing the code, you still need both folders actually. I had errors in both directories when I was working. Once I figured out how to fix things at least.
I am having no luck with the files you provided.. Is there someway I can start with a new AI folder? I have a custom one already and I doubt it's MirAI, and seems like something else isn't working... Sorry to bother you all more about this, I just want to get on my alchemist. I appreciate your help and patience, now and in advance Icon_biggrin
Dx
Its perfectly fine!

Can you tell me exactly how you are moving the files into your RO folder? If you can, rename your old AI folders as old.AI and old.AI_sakray before moving the files. This way we can determine if its the files, or something in your old AI.

There is also going to be a patch released tomorrow, as posted by GM-Garr, for the homun AI.
Pages: 1 2
Reference URL's