Little Fighter Empire - Forums
3 questions - 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: 3 questions (/showthread.php?tid=9014)



3 questions - Nyamaiku - 11-02-2013

so now im writing a ddraw AI for aiden...
everything was going smoothly until i have to do the D^J move, so...

1. how to make the character detect if a ball is coming towards him?

2. how to make him NOT press A,J or D during certain frames when he is not close enough to the enemy?

3. how to make the AI choose where to move along the z-axis while in those certain frames? i want him to move away from the enemy(along z) while making sure he wouldnt get stuck to the z-boundary of the map


EDIT: seriously...no replies after such a long time? is it that these 3 cant be solved or is someone still experimenting? if this really cant be solved, i will have to edit a bit of the data for the AI to work....
EDIT2: finally, someone replied


RE: 3 questions - Azriel - 11-09-2013

1. how to make the character detect if a ball is coming towards him?
loop through each object
if the object is type 3 and on the other team
check its x coordinate and your x coordinate, and its dvx
if its dvx < 0 and its x coordinate is > your x coordinate, it is coming towards you from the right.

2. how to make him NOT press A,J or D during certain frames when he is not close enough to the enemy?
assuming you are using the built-in target (the target selected by the lf2 exe)
check your x/y/z coordinate compared to the target's x/y/z coordinate (subtract)
if the absolute value of the subtractions is not within some chosen values (your specified distance), then make your character walk/run towards it

3. how to make the AI choose where to move along the z-axis while in those certain frames? i want him to move away from the enemy(along z) while making sure he wouldnt get stuck to the z-boundary of the map
if target's z is greater than yours, then it is further down from you on the map.
if target's z is less than yours, then it is further up from you on the map.
if your z value is approaching map.zboundary, then make it walk the other way.


if you want example code, http://www.lf-empire.de/forum/showthread.php?tid=7946 should help. I'm not sure if you have access to the current map's zboundary etc. for your 3rd question.



Azriel~


RE: 3 questions - Nyamaiku - 11-09-2013

FINALLY! A REPLY!!!
anyway...thanks a lot! but there are still a bit of problems:
(11-09-2013, 11:43 AM)Azriel Wrote:  assuming you are using the built-in target (the target selected by the lf2 exe)
check your x/y/z coordinate compared to the target's x/y/z coordinate (subtract)
if the absolute value of the subtractions is not within some chosen values (your specified distance), then make your character walk/run towards it
problem about 2, is for a move which the character is flying with state15 over enemy projectiles, and can cancel the flying by pressing A/J or D.
so the original lf2 AI keep pressing D and causes the character to go down, my guess is this cant be solved using pure AI scripting? maybe i should just cancel the press D to stop?

(11-09-2013, 11:43 AM)Azriel Wrote:  if target's z is greater than yours, then it is further down from you on the map.
if target's z is less than yours, then it is further up from you on the map.
if your z value is approaching map.zboundary, then make it walk the other way.
about 3, it is for controling z movement during that flying move mentioned above. i have manage to write one like the one mentioned by you, the AI should move away from the enemy in z-axis , but the original AI kept trying to move back towards the enemy, causing the character still being on the same line as the enemy. is there a way to overwrite the original AI in this situation, but still have the int ego for other actions?


RE: 3 questions - Boop - 11-09-2013

(11-09-2013, 02:27 PM)Nyamaiku Wrote:  problem about 2, is for a move which the character is flying with state15 over enemy projectiles, and can cancel the flying by pressing A/J or D.
so the original lf2 AI keep pressing D and causes the character to go down, my guess is this cant be solved using pure AI scripting? maybe i should just cancel the press D to stop?

Any problem can be solved using AI scripting. You can rewrite the ENTIRE AI if you use id instead of ego. http://www.lf-empire.de/forum/showthread.php?tid=8016 Look at my henry AI. When you use id then you control EVERYTHING about the AI. Which means you'd need to write a "basic" ai first. When you use ego, you only control "special move" AI, this makes writing AI easier but means you lose some control.


RE: 3 questions - Nyamaiku - 11-09-2013

i have tried your henry AI a long time ago. its amazing
but that level of coding is beyond my brain's limit for now:s
guess i should just stick to ego AI then, though it may not work as fine but at least its better than nothing.
just thinking about having to write a basic AI that works just like an ordinary lf2 AI makes me depressed.
at least this AI still quite pwn in 1v1 battles most of the time:D