Some AI Questions

Level 10
Joined
Jun 6, 2007
Messages
392
I have some questions regarding AI:

1. Is it possible to write ai script directly in the trigger editor, or does it have to be imported? That would simplify the debugging process...

2. I need an algorithm for a triggered ai: I want to find point X within A radius of point Y, which has most enemy units within radius B. In other words I want to find an optimal casting point for area spells.
 
1. Sure you also can manipulate comuputer player's behaviour via trigger editor and create a custom ai.

2.
A solution would be to pick every enemy in your wanted radius, then for each picked enemy you again pick all enemies in range with condition it's in range of caster = true.
In this second enumeration you increment an unit specific counter (for 1st picked unit), and each time you increase the counter you check if it's the biggest counter so far.
If it's biggest --> you have to store 1st picked unit into a variable.
After all enumerations you check if your unit variable != No Unit, if true you can cast it to it's location.
 
Last edited:
Top