How to: script Artificial Intelligence - Printable Version +- Little Fighter Empire - Forums (https://lf-empire.de/forum) +-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7) +--- Forum: AI Scripting (https://lf-empire.de/forum/forumdisplay.php?fid=56) +--- Thread: How to: script Artificial Intelligence (/showthread.php?tid=7946) |
|||
RE: How to: script Artificial Intelligence - Dragon5 - 04-30-2013 Both links are down. RE: How to: script Artificial Intelligence - YinYin - 04-30-2013 updated RE: How to: script Artificial Intelligence - Memento - 05-02-2013 I made quite the noob script probably, lol. I'm also expected a real noob mistake.. I don't really understand it all just yet. I'm getting the following error(s): ai\692.as: INFORMATION : Building. ai\692.as: <12, 2>: ERROR : Unexpected token 'else' ai\692.as: ERROR : Unable to build module Spoiler (Click to View) RE: How to: script Artificial Intelligence - YinYin - 05-02-2013 Well just like normal mathematics you need to open and close your braces properly. Your second if statement is missing the {do stuff}. if (abs(self.x-target.x) > 0 && (self.state == 2 || self.state == 0)) { } And I think you are missing/closing other {/} braces too. First return 1;} closes the main ego() function (this should happen at the end). Second if after long/mid again is missing braces. if (abs(self.x-target.x) > 0 && (self.state == 1 || self.state == 0)) { } Maybe use Someoneelse's data changer and choose new AI file, it will make braces that belong together bold when your cursor is near them. RE: How to: script Artificial Intelligence - Som1Lse - 05-02-2013 (05-02-2013, 11:03 AM)Neocrypt Wrote: ai\692.as: INFORMATION : Building.<x,y> means that there is a mistake on line x, in this case 12. The mistake is that everything beyond "//basic move conditions:" isn't within a function, and once it encounters something that should be inside a function (such as an "else"-statement), it throws an error. Also the "else"-statement has to follow an "if"-statement, but in this case it is following the function declaration ("int ego(){"). (05-02-2013, 11:03 AM)Neocrypt Wrote: I also don't really understand when I should use certain characters such as {. And yes, I used Clide as a base for his AI...{'s and }'s are used to indicate a block of code. An example of this is in an "if"-statement. If you want to execute multiple lines of code you'll have to group it within the two brackets like this:
If we were to leave out the brackets like this:
it would only be the next statement ("do_one_thing();"), and the statements after that would be executed no matter the the result of the "if"-statement. Also note that the indentation of the lines doesn't matter, so all the following pieces of code mean exactly the same thing
RE: How to: script Artificial Intelligence - A-Man - 05-07-2013 (05-07-2013, 12:08 PM)Neocrypt Wrote: I am starting to understand the scripting a little. I now want to set a dodging move for attacks that cause >= 70 injury (AI will only do it when it has >= 400 MP so it won't be a cheap move). Is there a way to do this? An alternative would be using target.state == 3, perhaps with a target.mp condition.. but it would not have the same effectI don't think a class parent that checks the target's itr injury value is implemented. I don't want to be nosy, but I wouldn't advice being that specific with your AI's. Imagine a scenario where your opponent is about to hit you with a super deadly combo with 10 hits. Each hit causes 30 damage (which means your character won't do the dodging move D: ), and thus 300 of your hp. Checking all that would just be a waste of time. (05-07-2013, 12:08 PM)Neocrypt Wrote: Another problem. I want to make my character use DJA+A+A+A.... when the opponent is at a distance. It's a move to charge MP. However, he DOES go to the charging stance (caused by DJA), but he only starts tapping A when I walk.Can you please show use the code above the "else if" statement? Namely the original first "if" statement. (05-07-2013, 12:08 PM)Neocrypt Wrote: And is there a way to make him avoid picking objects?Well, if the script you are working isn't an extension for a main AI - a brand new AI where you even control walking and stuff-, it won't pick items by default. RE: How to: script Artificial Intelligence - YinYin - 05-07-2013 (05-07-2013, 02:54 PM)A-MAN Wrote: I don't think a class parent that checks the target's itr injury value is implemented. I don't want to be nosy, but I wouldn't advice being that specific with your AI's. Imagine a scenario where your opponent is about to hit you with a super deadly combo with 10 hits. Each hit causes 30 damage (which means your character won't do the dodging move D: ), and thus 300 of your hp. Checking all that would just be a waste of time.Actually you can - but I agree that this isn't the best approach. RE: How to: script Artificial Intelligence - Memento - 05-07-2013 (05-07-2013, 03:03 PM)YinYin Wrote:(05-07-2013, 02:54 PM)A-MAN Wrote: I don't think a class parent that checks the target's itr injury value is implemented. I don't want to be nosy, but I wouldn't advice being that specific with your AI's. Imagine a scenario where your opponent is about to hit you with a super deadly combo with 10 hits. Each hit causes 30 damage (which means your character won't do the dodging move D: ), and thus 300 of your hp. Checking all that would just be a waste of time.Actually you can - but I agree that this isn't the best approach. I'm making this pretty confusing: moved the post to a new topic just before you guys replied. I will add the first part of the code in that new topic.. Also, the character should only dodge sometimes, not always.. that is the main reason for choosing a higher injury. If there are other ways, I'm fine with that too. RE: How to: script Artificial Intelligence - A-Man - 05-07-2013 Also one more thing, that is here: Code: (self.mp <= 400 && (abs(self.z-target.z) > 40) || (abs(self.x-target.x) < 1000 && abs(self.x-target.x) > 320)) P.S: a mod should please merge these to the new thread. RE: How to: script Artificial Intelligence - dctbullshit - 05-08-2013 wonder why my exe file crashes when com character begins to move! |