Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Since you already have your "specific path", create waypoints (regions) along this path. Order your units to attack move first waypoint, when they reached nth waypoint order them to attackc (n+1)th waypoint.
Since you already have your "specific path", create waypoints (regions) along this path. Order your units to attack move first waypoint, when they reached nth waypoint order them to attackc (n+1)th waypoint.
I apologize, there is a misunderstanding, I have a "specific path" only in my head. In-game, the units are Attack-Moving to the Town Hall because that is how it works using Jasscraft, I need a function from Jasscraft to get them to attack move to my theoretical locations before attacking the Town Hall because there are dangers for the AI if they attack directly.
There are no unit groups or waves in the World Editor, it is all done by Jasscraft in my map and the AI is just imported as a .ai file.
First of all, there is actually an AI native which tells your attack captain (the group of your attacking units) to attack a location: AttackMoveXY.
Second, you wouldn't want to use it alone because it has no control structure. What you would probably want to use is SuicideOnPointEx, which works just like SuicideOnPlayerEx but with a point. That means the the computer waits until it gathered the attacking units it needs, and returning to base if no Target is found, etc.
Third, you can find all this and more here - the common.ai file contains all of the AI functions and variables, and will make your work much easier once you get a bit more familiar with it.
First of all, there is actually an AI native which tells your attack captain (the group of your attacking units) to attack a location: AttackMoveXY.
Second, you wouldn't want to use it alone because it has no control structure. What you would probably want to use is SuicideOnPointEx, which works just like SuicideOnPlayerEx but with a point. That means the computer waits until it gathered the attacking units it needs, and returning to base if no Target is found, etc.
Third, you can find all this and more here - the common.ai file contains all of the AI functions and variables and will make your work much easier once you get a bit more familiar with it.
Thank you for your reply it was very helpful, especially the JASS Manual, I have one question.
Can I set multiple SuicideOnPointEx within one wave?
For example, the wave suicides on point A, then point B, then point C?
The reason I ask is that the function is formatted like SuicideOnPlayerEx where you define the minutes and the user, so if I use it multiple times would this mess it up?
For example, the wave may go to the first point then wait for x minutes before moving to the next location.
Not exactly. There are a couple of problems, all related to the general purpose attack function that SuicideOnPointEx calls: CommonSuicideOnPlayer.
JASS:
function SuicideOnPoint takes integer seconds, player p, integer x, integer y returns nothing
call CommonSuicideOnPlayer(false,false,seconds,p,x,y)
endfunction
You can read more about it CommonSuicideOnPlayer itself here, but to keep things short an AI attack is split into three steps:
1. Gathering units (using the FormGroup function)
2. Attacking
3. Waiting for attack termination (using the SuicideOnPlayerWave function)
Each step is done in a loop, your problem is with how attacking a point works in this function:
JASS:
function CommonSuicideOnPlayer takes boolean standard, boolean bldgs, integer seconds, player p, integer x, integer y returns nothing
local integer save_peons
if not PrepSuicideOnPlayer(seconds) then
return
endif
set save_peons = campaign_wood_peons
set campaign_wood_peons = 0
loop
//xxx
if allow_signal_abort and CommandsWaiting() != 0 then
call Trace("ABORT -- attack wave override\n")
endif
//xxx
exitwhen allow_signal_abort and CommandsWaiting() != 0
//THIS IS THE PART YOU CARE ABOUT=============================================
loop
exitwhen allow_signal_abort and CommandsWaiting() != 0
call FormGroup(5,true)
exitwhen sleep_seconds <= 0
call TraceI("waiting %d seconds before suicide\n",sleep_seconds) //xxx
endloop
if standard then
if bldgs then
exitwhen SuicidePlayer(p,sleep_seconds >= -60)
else
exitwhen SuicidePlayerUnits(p,sleep_seconds >= -60)
endif
else
call AttackMoveXYA(x,y)
endif
call TraceI("waiting %d seconds before timeout\n",60+sleep_seconds) //xxx
call SuicideSleep(5)
endloop
//THIS IS THE PART YOU CARE ABOUT=============================================
set campaign_wood_peons = save_peons
set harass_length = 0
call SuicideOnPlayerWave()
endfunction
You'll notice you're calling AttackMoveXYA inside a loop, and the loop is not stopping. This is an error on Blizzard's side, but since they never used this function no one noticed (UNTIL TODAY!!!). A simple solution to that is copying CommonSuicideOnPlayer, adding a line exitwhen true right after the line call AttackMoveXYA(x,y), and using it instead. This will make your attacks actually finish.
But that still doesn't answer your question!
You can call SuicideOnPointEx a couple of times with different points. It's worth the try, but because of problems in how SuicideOnPlayerWave works (too long to get into), I think your units will go to point A, then back to base, then to point B, and so on.
So your other option is to create a function which works like SuicideOnPointEx, but with more points and better control on your units. Some hints for native functions you'll need:
CaptainAtGoal - check if your unit are near the point. CaptainInCombat - checks if your units are in combat (call it with true argument). CaptainIsEmpty - all attacking units are dead.
If you're having trouble/questions about it, you can create a new post here or message me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.