- Joined
- Mar 3, 2006
- Messages
- 1,564
I started recently learning AI, I started with this tutorial. But there are those line that say:
The problem is that every time I kill the trained archer, the AI replaces it with another one indefinitely, not according to the number in the
I hope that someone could help me especially that I asked many questions about AI before but no one was able answer (are there members on THW that understand AI ?)
Thanks.
I make this code in my map:Let's explain the new functions:
SetReplacements(e, n, i)
: Set how many times the AI replaces killed defenders, in the code above, it makes this replacement once for easy mode, twice for normal mode and three times in insane mode.CampaignDefenderEx(e, n, i, UnitID)
: similar toSetUnitBuild
, but the units trained with this function will be replaced if they're killed n times according with the functionSetReplacements
.
JASS:
globals
endglobals
function main takes nothing returns nothing
call CampaignAI(MOON_WELL,null)
call SetSlowChopping(true)
call SetPeonsRepair(false)
call SetReplacements( 1, 2, 3 )
call CampaignDefenderEx( 1, 1, 1, ARCHER )
endfunction
SetReplacements
function.I hope that someone could help me especially that I asked many questions about AI before but no one was able answer (are there members on THW that understand AI ?)
Thanks.