• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your 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
 
Level 12
Joined
Jun 15, 2016
Messages
472
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.
 
Level 16
Joined
Apr 20, 2014
Messages
525
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.
 
Level 6
Joined
Jul 8, 2018
Messages
129
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.
 
Level 6
Joined
Jul 8, 2018
Messages
129
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.
Top