- Joined
- Jan 9, 2005
- Messages
- 2,126
So I've been reading a tutorial to make my own AI for a campaign map but I can't get it to run. I pretty much know next to nothing about AI so I have no idea what I'm doing wrong. I was told to check the syntax with JassCraft, but that program is giving me an endless list of errors when I try to run it so no-can-do there. Any help is appreciated.
I call the AI on map init.
I call the AI on map init.
-
Initialisaton
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Game - Set the time of day to 12.00
-
Visibility - Disable fog of war
-
Visibility - Disable black mask
-
Player - Set Player 10 (Light Blue) Current gold to 1000
-
Player - Set Player 10 (Light Blue) Current lumber to 1000
-
-------- -------- --------
-
Set TempPlayer = Player 4 (Purple)
-
Player - Set TempPlayer Current gold to 999999
-
Player - Set TempPlayer Current lumber to 999999
-
Visibility - Create an initially Enabled visibility modifier for TempPlayer emitting Visibility across (Playable map area)
-
AI - Start campaign AI script for TempPlayer: war3mapImported\AR_MAP1.ai
-
Set TempPlayer = Player 6 (Orange)
-
Player - Set TempPlayer Current gold to 999999
-
Player - Set TempPlayer Current lumber to 999999
-
Visibility - Create an initially Enabled visibility modifier for TempPlayer emitting Visibility across (Playable map area)
-
AI - Start campaign AI script for TempPlayer: war3mapImported\AR_MAP1.ai
-
-
JASS:
globals
//CONFIG
player HUMAN_PLAYER = Player(9) //Player 10
integer TOWN_HALL_1 = 'unpl'
integer TOWN_HALL_2 = 'unp1'
integer TOWN_HALL_3 = 'unp2'
//Where do I find a list of the AI constants?
integer WORKER_1 = 'uaco' //Eg: Peasant Acolyte Wisp Peon
integer WORKER_2 = 'ugho' //Eg: - Ghoul - -
integer FOOD_SOURCE = 'uzig' //Eg: Farm Ziggurat Moon Well Burrow
integer ALTAR = 'uaod' //Eg: Altar of Kings Altar of Darkness Altar of Elders Altar of Storms
integer SPECIAL_1 = '0000' //Eg: Lumber Mill - - -
integer SPECIAL_2 = 'usap' //Eg: - Sacrificial Pit - -
integer TECH = 'ugrv' //Eg: Blacksmith Graveyard Hunter's Hall War Mill
integer SHOP = 'utom' //Eg: Arcane Vault Tomb of Relics Ancient of Wonders Voodoo Lounge
integer DEFENSE_1 = 'uzg1' //Eg: Guard Tower Spirit Tower Ancient Protector Watch Tower
integer DEFENSE_2 = '0000' //Eg: Cannon Tower - - -
integer DEFENSE_3 = '0000' //Eg: Arcane Tower - - -
integer PRODUCTION_1 = 'usep' //Eg: Barracks (Human) Crypt Ancient of War Barracks (Orc)
integer PRODUCTION_2 = 'utod' //Eg: Arcane Sanctum Temple of the Damned Ancient of Lore Spirit Lodge
integer PRODUCTION_3 = 'uslh' //Eg: Workshop Slaughterhouse Ancient of Wind Beastiary
integer PRODUCTION_4 = 'ubon' //Eg: Gryphon Aviary Boneyard Chimera Roost Tauren Totem
//ENDCONFIG
endglobals
function ConfigureAI takes nothing returns nothing
call SetUnitsFlee( false )
call SetHeroesFlee( false )
call SetGroupsFlee( false )
call SetSlowChopping( true )
call SetPeonsRepair( true )
call DoCampaignFarms( false )
call GroupTimedLife( true )
endfunction
function main takes nothing returns nothing
call CampaignAI( FOOD_SOURCE, null )
call ConfigureAI()
// **********************************
// * Building Strategy *
// **********************************
call SetReplacements( 3, 5, 6 )
set campaign_gold_peons = 5
set campaign_wood_peons = 4
// Tier 1
call SetBuildUnitEx( 1, 1, 1, TOWN_HALL_1 )
call SetBuildUnit( 10, WORKER_1 )
call SetBuildUnit( 4, WORKER_2 )
call SetBuildUnitEx( 1, 2, 3, FOOD_SOURCE )
call SetBuildUnit( 1, PRODUCTION_1 )
call SetBuildUnit( 1, ALTAR )
call SetBuildUnit( 1, TECH )
call CampaignDefenderEx( 2, 3, 5, GHOUL)
call CampaignDefenderEx( 1, 2, 3, CRYPT_FIEND)
call CampaignDefenderEx( 0, 1, 1, ABOMINATION)
call CampaignDefenderEx( 1, 1, 2, NECROMANCER)
call CampaignDefenderEx( 0, 1, 1, OBSIDIAN_STATUE)
call CampaignDefenderEx( 2, 2, 2, DEFENSE_1)
// Tier 2
call SetBuildUnit( 1, TOWN_HALL_2 )
call SetBuildUnit( 1, PRODUCTION_2 )
call SetBuildUnit( 1, PRODUCTION_3 )
// Tier 3 buildings
call SetBuildUnit(1, TOWN_HALL_3)
call SetBuildUnitEx(0, 1, 1, PRODUCTION_4)
// **********************************
// * End Building Strategy *
// **********************************
//*** Wave 1 ***
call InitAssaultGroup()
call CampaignAttackerEx( 3, 3, 4, GHOUL )
call CampaignAttackerEx( 0, 1, 2, CRYPT_FIEND )
call SuicideOnPlayerEx( M5, M4, M4, HUMAN_PLAYER )
//*** Wave 2 ***
call InitAssaultGroup()
call CampaignAttackerEx( 3, 3, 4, GHOUL )
call CampaignAttackerEx( 1, 2, 3, CRYPT_FIEND )
call SuicideOnPlayerEx( M4, M4, M3, HUMAN_PLAYER )
//*** Wave 3 ***
call InitAssaultGroup()
call CampaignAttackerEx( 3, 3, 4, GHOUL )
call CampaignAttackerEx( 0, 1, 2, CRYPT_FIEND )
call CampaignAttackerEx( 0, 1, 1, MEAT_WAGON )
call SuicideOnPlayerEx( M3, M4, M3, HUMAN_PLAYER )
//*** Wave 4 ***
call InitAssaultGroup()
call CampaignAttackerEx( 3, 3, 4, GHOUL )
call CampaignAttackerEx( 1, 1, 2, CRYPT_FIEND )
call CampaignAttackerEx( 1, 1, 2, GARGOYLE )
call CampaignAttackerEx( 0, 1, 1, MEAT_WAGON )
call SuicideOnPlayerEx( M3, M4, M3, HUMAN_PLAYER )
loop
//*** Wave 5 ***
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 3, GHOUL )
call CampaignAttackerEx( 1, 1, 2, CRYPT_FIEND )
call CampaignAttackerEx( 1, 1, 2, GARGOYLE )
call CampaignAttackerEx( 0, 1, 1, ABOMINATION )
call CampaignAttackerEx( 0, 1, 1, MEAT_WAGON )
call SuicideOnPlayerEx( M4, M4, M4, HUMAN_PLAYER )
//*** Wave 6 ***
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 3, GHOUL )
call CampaignAttackerEx( 1, 1, 2, NECROMANCER )
call CampaignAttackerEx( 1, 1, 2, OBSIDIAN_STATUE )
call CampaignAttackerEx( 0, 1, 1, ABOMINATION )
call CampaignAttackerEx( 0, 1, 1, MEAT_WAGON )
call SuicideOnPlayerEx( M4, M4, M4, HUMAN_PLAYER )
//*** Wave 7 ***
call InitAssaultGroup()
call CampaignAttackerEx( 5, 7, 12, GARGOYLE )
call SuicideOnPlayerEx( M4, M4, M4, HUMAN_PLAYER )
endloop
endfunction