call HarvestWood(0,N)
In fact, when TownThreatened() returns true, this function cannot take effect on GHOUL. AI always makes all GHOUL participate in defense, resulting in no GHOUL harvesting wood
This leads to another problem
GetUnitGoldCost(unitid)
GetUnitWoodCost(unitid)
What is obtained here is always the cost set by the physical editor
Don’t forget that the resurrection of heroes does not require wood, and the gold amount does not equal the cost of construction
and In the melee map, build first hero only needs food
So when the birth points of two or more players are very close and their vision can see each other,will go TownThreatened() , so the first type of BUG will inevitably occur for the undead
This will result in the wood being 0
When his hero is killed, he will think that resurrection requires wood, and then the entire construction sequence will be stuck and unable to continue developing
at StartUnit
GetUnitWoodCost(unitid) not 0
so
if afford_qty < 1 then
return false
endif
A dead loop has been born
here is my amai fix
function GetUnitGoldCost2 takes integer id returns integer
if needed3[id] == UPGRADED then
return GetUnitGoldCost(old_id[id]) - GetUnitGoldCost(old_id[needed1[id]])
else
if id == hero[1] then
if hero_unit[1] != null then
return Min(GetUnitGoldCost(old_id[id]) * 4, Min(GetUnitGoldCost(old_id[id]) * R2I(0.4 + 0.1 * (GetHeroLevel(hero_unit[1]) - 1)), 700))
endif
return 0 // fix , first hero gold is 0 , not friendly to custom maps
elseif id == hero[2] and hero_unit[2] != null then
return Min(GetUnitGoldCost(old_id[id]) * 4, Min(GetUnitGoldCost(old_id[id]) * R2I(0.4 + 0.1 * (GetHeroLevel(hero_unit[2]) - 1)), 700))
elseif id == hero[3] and hero_unit[3] != null then
return Min(GetUnitGoldCost(old_id[id]) * 4, Min(GetUnitGoldCost(old_id[id]) * R2I(0.4 + 0.1 * (GetHeroLevel(hero_unit[3]) - 1)), 700))
endif
endif
return GetUnitGoldCost(old_id[id])
endfunction
function GetUnitWoodCost2 takes integer id returns integer
if needed3[id] == UPGRADED then
return GetUnitWoodCost(old_id[id]) - GetUnitWoodCost(old_id[needed1[id]])
elseif (id == hero[1]) or (id == hero[2] and hero_built[2]) or (id == hero[3] and hero_built[3]) then // fix , when build done or first hero, wood is 0
return 0
endif
return GetUnitWoodCost(old_id[id])
endfunction
and HarvestGold bug
use Naga or amphibious peon automatic harvest gold or wood ,if go to the tree or mine must need across the deepwater , the peon will stop at the shore , like the unit forget he is amphibious and can swim
and more