[JASS] Custom IA do nothing

Level 3
Joined
Aug 19, 2025
Messages
18
JASS:
globals
       player user = PlayerEx (0)
endglobals

function main takes nothing returns nothing

call CampaignAI (MOON_WELL,null)
call SetReplacements (1,1,1)
call SetSlowChopping (true)
call SetPeonsRepair (true)

call SetBuildUnitEx (1,1,1, TREE_LIFE)
call SetBuildUnitEx (5,5,5, WISP)
call SetBuildUnitEx (1,1,1, ANCIENT_WAR)
call SetBuildUnitEx (1,1,1, ANCIENT_LORE)
call SetBuildUnitEx (1,1,1, HUNTERS_HALL)
call SetBuildUnitEx (1,1,1, ANCIENT_WIND)
call SetBuildUnitEx (1,1,1, TREE_AGES)
call SetBuildUnitEx (1,1,1, ELF_ALTAR)
call SetBuildUnitEx (1,1,1, TREE_ETERNITY)
call SetBuildUnitEx (1,1,1, CHIMAERA_ROOST)

call CampaignDefenderEx (1,2,4, CHIMAERA)
call CampaignDefenderEx (1,6,8, ARCHER)
call CampaignDefenderEx (1,4,6, HUNTRESS)

call WaitForSignal()


call InitAssaultGroup ()
call CampaignAttackerEx (2,4,6, ARCHER)
call SuicideOnPlayerEx (M3,M3,M2,user)

call InitAssaultGroup ()
call CampaignAttackerEx (2,4,6, ARCHER)
call CampaignAttackerEx (2,4,4, HUNTRESS)
call SuicideOnPlayerEx  (M2,M4,M6,user)

call InitAssaultGroup ()
call CampaignAttackerEx (2,4,6, ARCHER)
call CampaignAttackerEx (0,1,2, CHIMAERA)
call SuicideOnPlayerEx  (M5,M5,M4,user)

    loop

     call InitAssaultGroup ()
     call CampaignAttackerEx (2,4,6, ARCHER)
     call SuicideOnPlayerEx (M3,M3,M2,user)

     call InitAssaultGroup ()
     call CampaignAttackerEx (2,4,6, ARCHER)
     call CampaignAttackerEx (2,4,4, HUNTRESS)
     call SuicideOnPlayerEx  (M6,M4,M2,user)

     call InitAssaultGroup ()
     call CampaignAttackerEx (2,4,6, ARCHER)
     call CampaignAttackerEx (0,1,2, CHIMAERA)
     call SuicideOnPlayerEx  (M5,M5,M4,user)

      endloop
endfunction

I can't understand why it doesn't do anything, the syntax check passes correctly. I've reviewed several similar threads but I can't find one similar to mine.
 
Last edited by a moderator:
What's PlayerEx? Perhaps you meant Player?
PlayerEx is handy in that it indexes from 1 rather than 0 to avoid confusion.

So PlayerEx(1) is player 1 (red) compared to Player(0) which is also player 1 (red). Personally I quite like the QoL of the PlayerEx function just for keeping things clear.

Also if the AI is doing NOTHING then that's usually a big indicator of a syntax error somewhere. Double check all the brackets, all the variable names etc and make sure they're all correct.

Actually I already noticed you put a space between the function and brackets, that might not be valid in JASS there should be no space.

Also as I said earlier PlayerEx(0) is an invalid reference as there is no Player 0 in warcraft 3.
 
Try adding call SetBuildUnitEx (1,1,1, WISP) before the tree of life
ok I will do it

PlayerEx is handy in that it indexes from 1 rather than 0 to avoid confusion.

So PlayerEx(1) is player 1 (red) compared to Player(0) which is also player 1 (red). Personally I quite like the QoL of the PlayerEx function just for keeping things clear.

Also if the AI is doing NOTHING then that's usually a big indicator of a syntax error somewhere. Double check all the brackets, all the variable names etc and make sure they're all correct.

Actually I already noticed you put a space between the function and brackets, that might not be valid in JASS there should be no space.

Also as I said earlier PlayerEx(0) is an invalid reference as there is no Player 0 in warcraft 3.
I understood that player 0 was 1 in the player property slot, thanks for the clarification.

ok, lo haré
:thumbs_up:

Entendí que el jugador 0 era 1 en la ranura de propiedad del jugador, gracias por la aclaración.
:thumbs_up:

I understood that player 0 was 1 in the player's owned slot, thanks for the clarification. OSU
PlayerEx is handy in that it indexes from 1 rather than 0 to avoid confusion.

So PlayerEx(1) is player 1 (red) compared to Player(0) which is also player 1 (red). Personally I quite like the QoL of the PlayerEx function just for keeping things clear.

Also if the AI is doing NOTHING then that's usually a big indicator of a syntax error somewhere. Double check all the brackets, all the variable names etc and make sure they're all correct.

Actually I already noticed you put a space between the function and brackets, that might not be valid in JASS there should be no space.

Also as I said earlier PlayerEx(0) is an invalid reference as there is no Player 0 in warcraft 3.
now it trains units and collects resources but does not initiate attack waves
 
Last edited by a moderator:
Back
Top