| 08-05-2008, 04:58 AM | #1 |
Is it possible to have the effect of multiple assault groups controlled by a single AI? So far I can not see how it is possible. And is there any documentation on the "harass" variables and how they relate to functions like SuicideOnPlayer, AttackMoveKill, etc. Finally, is there a reasonable way of passing handles between the map script and an AI script? Hell, is there any place where I can find extensive documentation for all this AI scripting stuff? |
| 08-05-2008, 06:34 AM | #2 |
The person to ask about AI stuff would be Moyack, as I know he has experience with JASS AI. |
| 08-05-2008, 01:45 PM | #3 | ||
Hmmm... it has been a lot of time since I haven't touch the common.ai, but let me check... Quote:
FormGroup function in common.ai:function FormGroup takes integer seconds, boolean testReady returns nothing local integer index local integer count local integer unitid local integer desire local integer readyPercent // normally test for CaptainReadiness() of 50% if testReady == true then set readyPercent = 50 call Trace("forming group, requiring healthy guys\n") //xxx else set readyPercent = 0 call Trace("forming group, unit health not important\n") //xxx endif call Trace("trying to gather forces\n") //xxx loop call SuicideSleep(seconds) call InitAssault() set index = 0 loop exitwhen index == harass_length set unitid = harass_units[index] set desire = harass_max[index] set count = TownCountDone(unitid) call Conversions(desire,unitid) if count >= desire then call AddAssault(desire,unitid) else set desire = harass_qty[index] if count < desire then call AddAssault(desire,unitid) else call AddAssault(count,unitid) endif endif set index = index + 1 endloop //xxx if form_group_timeouts and (sleep_seconds < -60) then call Trace("exit form group -- timeout\n") elseif CaptainInCombat(true) then call Trace("exit form group -- can't form while already in combat\n") elseif CaptainIsFull() and CaptainReadiness() >= readyPercent then call Trace("exit form group -- ready\n") endif //xxx // time out and send group anyway if time has already expired exitwhen form_group_timeouts and (sleep_seconds < -60) exitwhen CaptainInCombat(true) exitwhen CaptainIsFull() and CaptainReadiness() >= readyPercent endloop endfunction You can avoid these variable and use directly the AddAssault() function if you consider it appropriate. This function is the native which group the units and internally (hardcoded) the functions SuicideOnPlayer, AttackMoveKill, etc, will order to that group to attack. About how to do 2 separated attack groups.... I haven't found the way, but I know it's possible because AMAI does this strategy. Quote:
JASS:native CommandAI takes player num, integer command, integer data returns nothing I hope it helps you with your needs. |
| 08-06-2008, 12:00 AM | #4 |
Thanks for the help (it is a bit disappointing that AI scripts can't pass information to triggers, though). I will try to fiddle around and get multiple assault groups working. |
