HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Bad AI Natives

07-18-2007, 07:10 PM#1
TheSecretArts
Does anyone know the list of natives that DON'T work when used in a JASS AI. I know about ExecuteFunc but i don't really know any others. If anyone knows, please tell me... i'll give rep!
07-18-2007, 07:25 PM#2
Naakaloh
In general, the functions that are available for an AI to use are in common.ai
07-18-2007, 07:50 PM#3
TheSecretArts
i meant compatible common.j functions.
07-18-2007, 08:31 PM#4
moyack
I worked with this question and all the functions except the ones related with triggers works fine, because you can't have triggers in AI scripts.
07-18-2007, 08:33 PM#5
TheSecretArts
thanks. I wasnt too sure if that was the case or if it was for something else.
+ REP
07-19-2007, 01:45 AM#6
PitzerMike
What doesn't work in ai scripts are:

1) Functions that take callbacks (that means triggers, timers, ExecuteFunc, as well as ForGroup -> you can work around it with a FirstOfGroup loop)

2) Functions returning a string (I2S -> can be manually implemented, SubString ...) The AI scripts seem to use a different base offset in the string table, so you get random strings returned.
07-19-2007, 02:40 AM#7
TheSecretArts
ok then. Thats weird that strings dont work... but they arent that needed anyway. Though a a ForGroup would be useful. Well, +REP
07-19-2007, 02:49 AM#8
darkwulfv
Quote:
Though a a ForGroup would be useful.
The workaround for that is as follows.

Collapse JASS:
function Rawr takes nothing returns nothing
//blah blah blah
  local group g = CreateGroup()
  local unit f
    call //Whatever GroupEnum... function you need to fill your group
set f = FirstOfGroup(g)
   loop
   exitwhen f == null
       //do what you want to the units here
       call GroupRemoveUnit(g, f)
   set f = FirstOfGroup(g)
   //other stuff you may wanna do
   endloop
//cleanup
endfunction
It's supposed to be faster, but the difference is almost unnoticeable. However, it requires one less function and you dont need to find a way to carry over locals since they'll be right there.
07-19-2007, 05:37 AM#9
Av3n
I think TSA is just takin precautions if there is an JASS A.I contest... Well you can check human.ai files etc. AMAI .ai files as well

-Av3n
07-21-2007, 12:46 AM#10
TheSecretArts
actualy, yes. AND im making an AI Editor and a targeting system that picks the best unit to attack based on all parameter.