• Check out the results of the Techtree Contest #19!
  • 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[AI] AI not building certain units.

Status
Not open for further replies.
Level 6
Joined
Jul 8, 2018
Messages
129
I'm having some trouble with vjass AI. Bassicly the AI will produce one coppy of a certain unit and then will stop producing any other units past this. I have the AI code in the spoiler below.
globals
player user = PlayerEx (1)
endglobals

function main takes nothing returns nothing
call CampaignAI(BURROW,null)
call SetReplacements(2,2,1)
call SetSlowChopping(false)
call SetPeonsRepair(true)
call SetBuildUnit ( 10, 'o001' )
call CampaignDefenderEx( 2, 4, 6, 'o005' )
call CampaignDefenderEx( 2, 4, 6, 'o002' )
call CampaignDefenderEx( 1, 1, 2, 'n002' )
call CampaignDefenderEx( 1, 2, 4, 'o00A' )
call CampaignDefenderEx( 1, 2, 4, 'o00B' )
//***wave 1
call InitAssaultGroup()
call CampaignAttackerEx( 2, 3, 5, 'o005' ) < builds one of
call CampaignAttackerEx( 4, 5, 7, 'o002' ) < works
call CampaignAttackerEx( 1, 1, 1, 'O00G' ) < builds none
call CampaignAttackerEx( 3, 4, 6, 'o003' ) < builds none
call SuicideOnPlayerEx( M6, M5, M4, user )
//***wave 2
call InitAssaultGroup()
call CampaignAttackerEx( 2, 4, 5, 'o005' ) < none
call CampaignAttackerEx( 5, 6, 8, 'o002' ) < all
call CampaignAttackerEx( 3, 4, 6, 'o003' ) < one
call CampaignAttackerEx( 1, 1, 1, 'O00G' ) < none
call CampaignAttackerEx( 1, 2, 3, 'o00C' ) < none
call SuicideOnPlayerEx( M6, M5, M4, user )
//***wave 3

Didn't include the waves below
 
Don't see any problem with the script. Check the following:

1. Make sure the unit strings you gave are all correct. That sort of problem can stop the AI. In general, I suggest you give names to your units as global variables, as can be seen here. Your script will be much easier to read like that for you as well.

2. Make sure there is enough food for all the units.

3. If all else fails, add another 2 minutes to every attack wave, see if it builds anything else in that time.
 
You should also create some of those bugued units in his base.

If AI uses them, the error is due to the production. Check if they have the correct building, enough resources or are allowed to procude it.
If they don't, it comes from the code.


You can also provide your map to allow testing.
 
Will try that as well. I have noticed that the ais that start with at least 1 copy of those units work fine so ill look at that. There is probably another fix that doesn't require that I'm guessing but that doesn't matter too much in a campaign mission.
 
You should also create some of those bugued units in his base.

If AI uses them, the error is due to the production. Check if they have the correct building, enough resources or are allowed to procude it.
If they don't, it comes from the code.


You can also provide your map to allow testing.
Works perfectly now. Seems the ai requires at least one copy of the unit beforehand to properly produce it some reason.
 
Status
Not open for further replies.
Back
Top