Little Fighter Empire - Forums
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)

Pages: 1 2 3 4 5 6 7


RE: How to: script Artificial Intelligence - Memento - 06-26-2013

I am getting the following error:

ai\690.as(4, 36): ERROR : / 'target' is not a member of 'const int&'

I probably has something to do with brackets that are placed wrong or something.. however, I can't get it fixed. When I add brackets, I get other errors (expected expression value). Who knows what this error means and how to fix it?

int ego(){
//close range:
if (target.y == 0 && abs(target.z-self.z) < 9) {
if (self.x-target.x > 0 && (self.x.target.x) < 50 && self.mp >= 180){DuA();} //D^A

EDIT: I may have figured it out, not sure... could the error mean that I have to make a true/false choice, and therefor I am using the wrong code?


RE: How to: script Artificial Intelligence - Silverthorn - 06-26-2013

I'm not quite up-to-date with the latest AI-stuff but this one caught my attention:

self.x.target.x

self.x should be a scalar value. That's at least what the error-message implies: it should be a "const"(ant) "int"(eger). Looking for a child-object "target" seems a little off in such case :p
Guess you mean something like self.x-target.x?


RE: How to: script Artificial Intelligence - Memento - 06-26-2013

(06-26-2013, 08:59 PM)Blue Phoenix Wrote:  I'm not quite up-to-date with the latest AI-stuff but this one caught my attention:

self.x.target.x

self.x should be a scalar value. That's at least what the error-message implies: it should be a "const"(ant) "int"(eger). Looking for a child-object "target" seems a little off in such case :p
Guess you mean something like self.x-target.x?

You may be right. It seems like the error originated because I used 'self.x.target.x' instead of 'self.x-target.x'.


RE: How to: script Artificial Intelligence - The Hari - 08-15-2013

Code:
int ego(){

int xdistance = (self.x-target.x)*(2*(self.facing?1:0)-1);

int hitable = (target.y == 0 && target.state != 6 || target.state != 14);

How can i create more variables? When there is only one (int xdistance) everythings working, after add another one (int hitable), I'm getting this error:
Can't implicitly convert from 'bool' to 'int'.


RE: How to: script Artificial Intelligence - YinYin - 08-15-2013

your hitable is a boolean and not an integer

bool hitable = (condition);


RE: How to: script Artificial Intelligence - Alapottra - 02-10-2014

Thanks for the tutorial i kinda need it for a reason


RE: How to: script Artificial Intelligence - pikol - 05-07-2014

How do you use arest and vrest? No matter what I do my arest is always = 0. I I want my character to wait until make the same action again.


RE: How to: script Artificial Intelligence - YinYin - 05-07-2014

arest is a value on the attacking character, so you'll have to look into self.arest.
It runs back down to 0 pretty quickly and usually doesn't interfere with being able to hit again (Template has a rather high arest on the super punch).

vrest is a value on the attacked character(s), so that'll be found on target.vrest.
This affects game play more often due to the attacker being stuck in hit lag while new opponents can keep walking into his itr (see Davis' D^A against a big crowd of Knights for example).

Maybe provide us with the respective itr and AI that only returns 0?


RE: How to: script Artificial Intelligence - AmadisLFE - 05-18-2014

YinYin, I tried to make a small Davis AI, to shoot energy balls when he is under 250 HP(Newbie AI I know), but, If I use DlA he randomly shoots left and gets himself kicked in the back, but if I try to make another one with DrA it worked the first I tested it, it is not working right now, here's what I coded.

Code:
int ego(){
if (self.hp < 250){
  DrA();
}
return 0;
}

int ego(){
if (self.hp < 250){
  DlA();
}
return 0;
}

Is something actually wrong with the AI, or did I do something wrong in it?
Oh Also, if I delete one of the code lines, It works again, but after I redo it, it again sends the same error, that 2 functions have the same name
I think I kinda figured it out, so, I will test if that works.
Nope, didn't work.


RE: How to: script Artificial Intelligence - YinYin - 05-18-2014

You can only have unique functions, not multiple ones with the same name.

So every condition the character is supposed to act upon needs to be inside the ego function.