• 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.

[AI] AI working on one map, but not on other.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
877
Ok, so I am currently trying to make a 2 player version of the 8th orc mission, but there is one tiiny little problem... None of the AI's work - they just mine and thats it. They did at some point but I guess I had changed something and I hadnt noticed it later. The only thing that I had done involving AI's was move them into a new trigger, which is run correctly, and I added 2 more AI's (each for the same player but for a different difficulty), both have been tested in a separate map, by importing the object data from the map and adding it to the new one. Both of them ran as they should - it built units and buildings, attacked with proper units on proper intervals.

JASS:
//============================================================================
//2PlayerOrc08_Purple_Normal
//============================================================================
globals
player user=Player(0)
player jaina=Player(9)
endglobals

//============================================================================
//main
//============================================================================
function main takes nothing returns nothing

call CampaignAI('ocbw',null)
call SetReplacements(5,5,5)
set do_campaign_farms=false

call SetBuildUnitEx(1, 1, 1, 'ogre')
call SetBuildUnit(1, 'ncpn')
call SetBuildUnitEx(1, 1, 1, 'ocbw')
call SetBuildUnitEx(1, 1, 1, 'oalt')
call SetBuildUnit(1, 'U000')
call SetBuildUnitEx(1, 1, 1, 'obar')
call SetBuildUnit(8, 'ncpn')
call SetBuildUnitEx(4, 4, 4, 'ocbw')
call SetBuildUnitEx(1, 1, 1, 'ofor')
call SetBuildUnitEx(1, 1, 1, 'ostr')
call SetBuildUnitEx(1, 1, 1, 'obea')
call SetBuildUnitEx(1, 1, 1, 'osld')

call CampaignDefenderEx(1,1,1,'nchg')
call CampaignDefenderEx(1,1,1,'nchw')
call CampaignDefenderEx(1,1,1,'nchr')

call SetBuildUpgrEx(3,3,3,'Rosp')
call SetBuildUpgrEx(1,1,1,'Robs')
call SetBuildUpgr(1,'Roen')

call WaitForSignal()

//***WAVE1***
call InitAssaultGroup()
call CampaignAttackerEx(6,6,6,'nchg')
call SuicideOnPlayer(M3,user)

//***WAVE2***
call InitAssaultGroup()
call CampaignAttackerEx(4,4,4,'nchg')
call CampaignAttackerEx(3,3,3,'nchr')
call SuicideOnPlayer(M9,jaina)

//***WAVE3***
call InitAssaultGroup()
call CampaignAttackerEx(3,3,3,'nchg')
call CampaignAttackerEx(2,2,2,'nchr')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M6,user)

//***WAVE4***
call InitAssaultGroup()
call CampaignAttackerEx(4,4,4,'nchg')
call CampaignAttackerEx(1,1,1,'nckb')
call CampaignAttackerEx(2,2,2,'ocat')
call SuicideOnPlayer(M7,jaina)

//***WAVE5***
call InitAssaultGroup()
call CampaignAttackerEx(6,6,6,'nchr')
call CampaignAttackerEx(3,3,3,'nchw')
call SuicideOnPlayer(M6,user)

//***WAVE6***
call InitAssaultGroup()
call CampaignAttackerEx(7,7,7,'nchg')
call CampaignAttackerEx(2,2,2,'ocat')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M7,jaina)

//***WAVE7***
call InitAssaultGroup()
call CampaignAttackerEx(7,7,7,'nchr')
call CampaignAttackerEx(1,1,1,'nckb')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M6,user)

//***WAVE8***
call InitAssaultGroup()
call CampaignAttackerEx(9,9,9,'nchg')
call CampaignAttackerEx(3,3,3,'nchw')
call SuicideOnPlayer(M7,jaina)

//***WAVE9***
call InitAssaultGroup()
call CampaignAttackerEx(5,5,5,'nchg')
call CampaignAttackerEx(2,2,2,'ocat')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M6,user)

//***WAVE10***
call InitAssaultGroup()
call CampaignAttackerEx(4,4,4,'nchg')
call CampaignAttackerEx(4,4,4,'nchr')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M7,jaina)

loop
//***WAVE11***
call InitAssaultGroup()
call CampaignAttackerEx(5,5,5,'nchg')
call CampaignAttackerEx(2,2,2,'nckb')
call CampaignAttackerEx(2,2,2,'ocat')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M6,user)

//***WAVE12***
call InitAssaultGroup()
call CampaignAttackerEx(4,4,4,'nchg')
call CampaignAttackerEx(4,4,4,'nchr')
call CampaignAttackerEx(2,2,2,'nchw')
call SuicideOnPlayer(M7,jaina)

//***WAVE13***
call InitAssaultGroup()
call CampaignAttackerEx(8,8,8,'nchr')
call SuicideOnPlayer(M6,user)

//***WAVE14+***
call InitAssaultGroup()
call CampaignAttackerEx(8,8,8,'nchg')
call CampaignAttackerEx(4,4,4,'nchw')
call SuicideOnPlayer(M7,jaina)
endloop
endfunction

EDIT: I forgot to add the AI code. The second one is almost the same but with different atack waves.
EDIT2: The problem was some triggers that were unhiding/unpausing all the units in the map that made it not work.
 
Last edited:
Level 12
Joined
Nov 3, 2013
Messages
989
I've had a problem with this too, copy the entire AI and delete it, then make a new one based on the same object editor data and paste the AI.

In my case it appeared to me that it had to do with when I changed the map file name, not sure if that actually were the cause but it seemed so.

Either way just recreating the AI worked for me.
 
Status
Not open for further replies.
Top