- Joined
- Jan 10, 2023
- Messages
- 248
Hello,
I am trying to make a very simple AI, but I am having trouble getting anything whatsoever going.
What I want is simply AI players to order their heroes to creep, the rest I intend to handle via triggers.
As you will see by my "script", I don't know anything about warcraft's AI, and I have been trying to understand it for days now and am not getting anywhere because I can't get a single thing to move. I know the code I'm sharing is just about worthless, but it might convey what I am trying to do here.
I don't want the AI player to care what the hero type is, I just want them order their captain to attack creep camps, ideally with the help of allies from time to time (or all the time).
Players have only a hero unit and whatever units they may summon, so the hero should be the only thing I have to worry about.
I am trying to make a very simple AI, but I am having trouble getting anything whatsoever going.
What I want is simply AI players to order their heroes to creep, the rest I intend to handle via triggers.
As you will see by my "script", I don't know anything about warcraft's AI, and I have been trying to understand it for days now and am not getting anywhere because I can't get a single thing to move. I know the code I'm sharing is just about worthless, but it might convey what I am trying to do here.
I don't want the AI player to care what the hero type is, I just want them order their captain to attack creep camps, ideally with the help of allies from time to time (or all the time).
Players have only a hero unit and whatever units they may summon, so the hero should be the only thing I have to worry about.
JASS:
//ATTACK
//------------------------------------------------
function AttackLoop takes nothing returns nothing
local unit target = GetAllianceTarget()
if target == null then
set target = GetCreepCamp( 0, GetHeroLevelAI() * 9, false )
call SetAllianceTarget( target )
call AttackMoveKill( target )
call ReformUntilTargetDead( target )
call SleepInCombat()
call InitAssault()
endif
endfunction
//COMMAND Loop
//------------------------------------------------
function CommandLoop takes nothing returns nothing
loop
call AttackLoop()
endloop
endfunction
//MAIN FUNCTION
//------------------------------------------------
function main takes nothing returns nothing
call CampaignAI( 0, null )
call DoCampaignFarms( false )
call SetTargetHeroes( true )
call SetRandomPaths( true )
call SetDefendPlayer( true )
call SetHeroesFlee( true )
call SetHeroesBuyItems( true )
call SetWatchMegaTargets( true )
call SetHeroesTakeItems( true )
call SetUnitsFlee( true )
call SetGroupsFlee( true )
call SetCaptainChanges( true )
call SetCampaignAI()
call CreateCaptains()
call StartThread( function CommandLoop )
endfunction