- Joined
- May 12, 2018
- Messages
- 145
Hi, I'm writing new integer variables for my convenience and custom races in common.ai, referring to InsaneMonster's Advanced AI guide.
www.hiveworkshop.com
Ex, basic common.ai declared Priest Adept Training(Rhpt) as UPG_PRAYING. but cases like this is unfamiliar to me, so I declare it again (didnt remove existed)
In this way, all the previously declared variables remain the same, and they are coexisting with the variables I have declared newly.
And my custom races are not modifications to existing units, but newly created ones from object data.
I also recognized that I needed to work separately on the TownCountEx function to avoid that AI constructing duplicated Halls, and I decided to modify common.ai.
I imported my edited common.ai(from InsaneMonster's v2) and other ai scripts to my campaign pack file and modified their path 'Scripts\common.ai', 'Scripts\06BloodElf.ai',
But now they don't work at all. This is my first time to fix the common ai itself, so I can't even fathom where the problem occurred.
DemoJassSyntaxChecker seems to recognize only the original common.ai. (Probably 1.06 version)
[JASS] - JASS Campaign AI 2.0
JASS CAMPAIGN AI 2.0 We all know JASS Campaign AI is... clunky, at best. I always loved its ease of use and even tried to imitate it in Starcraft 2 in the past. However, while working on Warcraft 3 Re-Reforged, I soon realized some of the built-in limitations were an hindrance to my game...

Ex, basic common.ai declared Priest Adept Training(Rhpt) as UPG_PRAYING. but cases like this is unfamiliar to me, so I declare it again (didnt remove existed)
JASS:
constant integer UPG_PRAYING = 'Rhpt' // basic
constant integer UPG_HUMAN_TRAIN_PRIEST = 'Rhpt' // mine new variable
And my custom races are not modifications to existing units, but newly created ones from object data.
I also recognized that I needed to work separately on the TownCountEx function to avoid that AI constructing duplicated Halls, and I decided to modify common.ai.
JASS:
constant integer UNIT_BLOODELF_WORKER = 'nhew'
constant integer UNIT_BLOODELF_FOOTMAN = 'hhes'
constant integer UNIT_BLOODELF_ARCHER = 'nhea'
constant integer UNIT_BLOODELF_GLAIVE = 'e000'
constant integer UNIT_BLOODELF_TROOPER = 'nbel'
constant integer UNIT_BLOODELF_PHOENIX = 'h009'
constant integer UNIT_BLOODELF_PHOENIX_ALT = 'h00A'
constant integer UNIT_BLOODELF_GOLEM = 'n02H'
constant integer UNIT_BLOODELF_PRIEST = 'hmpr'
constant integer UNIT_BLOODELF_SORCERESS = 'hsor'
constant integer UNIT_BLOODELF_BREAKER = 'h01R'
constant integer UNIT_BLOODELF_HAWKRIDER = 'h01S'
constant integer UNIT_BLOODELF_ASSAULT = 'nws1'
constant integer BUILD_BLOODELF_HALL1 = 'h001'
constant integer BUILD_BLOODELF_HALL2 = 'h002'
constant integer BUILD_BLOODELF_HALL3 = 'h003'
constant integer BUILD_BLOODELF_FARM = 'nefm'
constant integer BUILD_BLOODELF_BARRACKS = 'nheb'
constant integer BUILD_BLOODELF_LUMBERMILL = 'h00B'
constant integer BUILD_BLOODELF_BLACKSMITH = 'h015'
constant integer BUILD_BLOODELF_ALTAR = 'h016'
constant integer BUILD_BLOODELF_TOWER = 'negt'
constant integer BUILD_BLOODELF_TOWER_AG = 'negf'
constant integer BUILD_BLOODELF_TOWER_AA = 'negm'
constant integer BUILD_BLOODELF_SANCTUM = 'h601'
constant integer BUILD_BLOODELF_OBSERVATORY = 'haro'
constant integer BUILD_BLOODELF_SHOP = 'h01Q'
constant integer BUILD_BLOODELF_AVIARY = 'h01A'
function TownCountEx takes integer unitid, boolean only_done, integer townid returns integer
local integer have_qty = GetUnitCountEx(unitid,only_done,townid)
// Official units
if unitid == TOWN_HALL then
set have_qty = have_qty + GetUnitCountEx(KEEP,false,townid) + GetUnitCountEx(CASTLE,false,townid)
elseif unitid == KEEP then
set have_qty = have_qty + GetUnitCountEx(CASTLE,false,townid)
elseif unitid == WATCH_TOWER then
set have_qty = have_qty + GetUnitCountEx(GUARD_TOWER,false,townid) + GetUnitCountEx(CANNON_TOWER,false,townid) + GetUnitCountEx(ARCANE_TOWER,false,townid)
elseif unitid == PEASANT then
set have_qty = have_qty + GetUnitCountEx(MILITIA,false,townid)
// Custom units
// Human
elseif unitid == UNIT_HUMAN_FOOTMAN then
set have_qty = have_qty + GetUnitCountEx(UNIT_HUMAN_CAPTAIN,false,townid)
elseif unitid == UNIT_HUMAN_SIEGEENGINE then
set have_qty = have_qty + GetUnitCountEx(UNIT_HUMAN_SIEGEENGINE_ALT,false,townid)
// Blood Elf
elseif unitid == UNIT_BLOODELF_PHOENIX then
set have_qty = have_qty + GetUnitCountEx(UNIT_BLOODELF_PHOENIX_ALT,false,townid)
elseif unitid == BUILD_BLOODELF_HALL1 then
set have_qty = have_qty + GetUnitCountEx(BUILD_BLOODELF_HALL2,false,townid) + GetUnitCountEx(BUILD_BLOODELF_HALL3,false,townid)
elseif unitid == BUILD_BLOODELF_HALL2 then
set have_qty = have_qty + GetUnitCountEx(BUILD_BLOODELF_HALL3,false,townid)
elseif unitid == BUILD_BLOODELF_TOWER then
set have_qty = have_qty + GetUnitCountEx(BUILD_BLOODELF_TOWER_AA,false,townid) + GetUnitCountEx(BUILD_BLOODELF_TOWER_AG,false,townid)
I imported my edited common.ai(from InsaneMonster's v2) and other ai scripts to my campaign pack file and modified their path 'Scripts\common.ai', 'Scripts\06BloodElf.ai',
But now they don't work at all. This is my first time to fix the common ai itself, so I can't even fathom where the problem occurred.
DemoJassSyntaxChecker seems to recognize only the original common.ai. (Probably 1.06 version)