From 1cdc0ba99709e08d817710b410bf55082f959204 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Wed, 22 May 2024 15:02:18 +0800 Subject: [PATCH 01/19] Update common.eai --- common.eai | 74 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/common.eai b/common.eai index 0dae80518..9ea2c8133 100644 --- a/common.eai +++ b/common.eai @@ -9298,7 +9298,15 @@ endfunction //============================================================================ function BuildUnit takes integer qty, integer unitid, integer prio returns nothing - call SetBuildAllAM(BUILD_UNIT,qty,unitid,-1, BLOC_STD, prio) + local integer i = BLOC_STD + if buy_type[unitid] == BT_BUILDING and not IsRacialHallId(unitid , 1) and GetRacialBuildHallLV(unitid) > 1 then + if minebuild then + set i = BLOC_MINE + elseif not homebuild and not shredderbuild then + set i = BLOC_FRONT + endif + endif + call SetBuildAllAM(BUILD_UNIT,qty,unitid,-1, i, prio) endfunction //============================================================================ @@ -10014,11 +10022,12 @@ endfunction //============================================================================ function GetBuildLocation takes integer bloc returns location - if bloc == BLOC_MINE then + local integer i = Max(GetRandomInt(0, front_loc_num - 1),0) + if bloc == BLOC_MINE and mine_loc != null then return mine_loc endif - if front_loc[0] != null then - return front_loc[GetRandomInt(0, front_loc_num - 1)] + if front_loc[i] != null then + return front_loc[i] endif return home_location endfunction @@ -10114,15 +10123,29 @@ endfunction //============================================================================ function BuildAtSpecialLoc takes integer unitid, integer town, integer bloc returns integer - local unit u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) - local location l = GetUnitLoc(u) local unit peon = GetExpansionPeon() - - if peon == null then - set peon = GetExpansionPeon2(peon) // In case we can't get the expansion peon + local unit utemp1 = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], home_location, 270.0) + local unit utemp2 = null //utemp is seat, leave a passage , unit can ensure correct position + local unit u = null + local location l = null + local real d = 0 + local integer i = 0 + if bloc != BLOC_MINE then + set utemp2 = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) + endif + set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) + set l = GetUnitLoc(u) + call RemoveUnit(utemp1) + set utemp1 = null + if utemp2 != null then + call RemoveUnit(utemp2) + set utemp2 = null endif call RemoveUnit(u) set u = null + if peon == null then + set peon = GetExpansionPeon2(peon) // In case we can't get the expansion peon + endif if l == null then //call Trace("BuildatspecialLoc: No location found") //call RemoveLocation(l) @@ -10133,15 +10156,32 @@ function BuildAtSpecialLoc takes integer unitid, integer town, integer bloc retu call Trace("BuildatspecialLoc: No peon available") call RemoveLocation(l) set l = null - return CANNOT_BUILD - elseif not IssuePointOrderByIdLoc(peon, old_id[unitid], l) then - //call Trace("Building at special point") - //else - // call Trace("BuildatspecialLoc: Not able to build here") - call RemoveLocation(l) - set l = null - set peon = null return CANNOT_BUILD + else + if bloc == BLOC_FRONT then + set d = DistanceBetweenPoints(l,home_location) + if d >= front_base_distance + 400 or d < 600 then + call Trace("BuildatspecialLoc: Build loc too far or close, fix build loc") + if front_loc_num > 0 then + set i = GetRandomInt(0, front_loc_num - 1) + call RemoveLocation(l) + if front_loc[i] != null then + set l = AIGetProjectedLoc(front_loc[i], home_location, 200, 0) + else + set l = AIGetProjectedLoc(front_loc[0], home_location, GetRandomInt(100, 200), GetRandomInt(-90, 90)) + endif + endif + endif + endif + if not IssuePointOrderByIdLoc(peon, old_id[unitid], l) then + //call Trace("Building at special point") + //else + // call Trace("BuildatspecialLoc: Not able to build here") + call RemoveLocation(l) + set l = null + set peon = null + return CANNOT_BUILD + endif endif call RemoveLocation(l) set l = null From 7f6da90c9afeb267770761c4412106c2a7d58570 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Wed, 22 May 2024 15:02:54 +0800 Subject: [PATCH 02/19] Update Jobs.txt --- Jobs.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Jobs.txt b/Jobs.txt index a38a2b9ff..b3eeeef0b 100644 --- a/Jobs.txt +++ b/Jobs.txt @@ -46,3 +46,4 @@ BUILD_EXPANSION 10 BuildExpansionJob(unit_par, unit_par2) false 0 0 ITEM_EXPANSION 20 ItemExpansionJob() false 0 0 ITEM_EXPANSION_CHECK 30 ItemExpansionCheck() race_item_expansion_available 60 80 ITEM_REPEAT_CHECK 160 ItemRepeatCheck() true 200 220 +FIX_BLOCK 220 FixBlockJob() true 220 260 From 35428d720e0ad09d5ad8e7dbb522ceefca72d46f Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Wed, 22 May 2024 15:03:38 +0800 Subject: [PATCH 03/19] Add files via upload --- Jobs/FIX_BLOCK.eai | 244 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 Jobs/FIX_BLOCK.eai diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai new file mode 100644 index 000000000..cfe4c67cf --- /dev/null +++ b/Jobs/FIX_BLOCK.eai @@ -0,0 +1,244 @@ +#IFDEF GLOBAL + integer blockstate = 0 + integer movetotal = 0 + location ancientrootloc = Location(0, 0) + unit blockpathunit = null + unit blockancient = null + unit blockunit = null +#ELSE + +// ######################## Fix Block ############################### +// Created by JZY 15/04/24. +// blockstate : 0 check home block , 1 & 2 check altar and tavern block , 3 check other block +// fix mode : 0 and 2 move ancient or kill build and with compensation , 1 harvest or attack tree , 2 give path unit move aside or check other block +// ################################################################## +function TryAttackTree takes unit u, integer id, location l returns nothing + if id == 'ebal' or id == 'hmtm' or id == 'ocat' or id == 'umtw' or id == 'ncat' then + call RemoveGuardPosition(u) + call IssuePointOrderLoc(u, "attackground", l) + call TQAddUnitJob(6, RESET_GUARD_POSITION_ONLY, 0, u) + call CreateDebugTag("fix block : attack tree", 10, u, 3.00, 1.50) + elseif id == 'Ekee' then + call IssuePointOrderLoc(u, "forceofnature", l) + call CreateDebugTag("fix block : use skill to tree", 10, u, 3.00, 1.50) + endif +endfunction + +function MoveAncient takes unit u returns nothing + local unit utemp = null + if GetUnitCurrentOrder(u) != OrderId("root") then + set utemp = CreateUnitAtLoc(ai_player, GetUnitTypeId(u), front_loc[0], 270) + call IssueImmediateOrder(u, "cancel") + call IssueImmediateOrder(u, "unroot") + call RemoveLocation(ancientrootloc) + set ancientrootloc = GetUnitLoc(utemp) + call RemoveUnit(utemp) + set utemp = null + endif + call CreateDebugTagLoc("fix block : root here", 10, GetLocationX(ancientrootloc), GetLocationY(ancientrootloc), 3.00, 1.50) + call IssuePointOrderLoc(u, "root", ancientrootloc) // build no n need RESET GUARD POSITION + set movetotal = movetotal + 1 +endfunction + +function RootAncient takes nothing returns nothing + call RemoveLocation(ancientrootloc) + set ancientrootloc = GetUnitLoc(blockancient) + call IssuePointOrderLoc(blockancient, "root", ancientrootloc) + set blockancient = null +endfunction + +function TeleportFixBlock takes unit u returns nothing + if GetSlotsFreeOnUnit(u) == 0 then + call SetItemPosition(UnitItemInSlot(u, 0), GetLocationX(home_location), GetLocationY(home_location)) + endif + call UnitUseItemPoint(u, UnitAddItemById(u, old_id[tp_item]), GetLocationX(home_location), GetLocationY(home_location)) +endfunction + +function TryFixBlock takes integer fixmode, location l, real range, boolean attacktree, boolean moveaside returns nothing + local group g = CreateGroup() + local unit u = null + local unit utemp = null + local player p = null + local integer i = 0 + call GroupEnumUnitsInRangeOfLoc(g, l, range, null) + call GroupRemoveUnit(g, blockpathunit) + if fixmode == 0 then + loop + set u = FirstOfGroup(g) + exitwhen u == null or blockancient != null or (GetPlayerRace(ai_player) != RACE_NIGHTELF and utemp != null) // first move ancient + if GetOwningPlayer(u) == ai_player and IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_TOWNHALL) and UnitAlive(u) and not IsUnitHidden(u) then + if IsUnitType(u, UNIT_TYPE_ANCIENT) then + call MoveAncient(u) + set blockancient = u + endif + set i = GetUnitTypeId(u) // Prevent kill mine , altar , lumber + if blockancient == null and utemp == null and i != old_id[racial_expansion] and i != old_id[racial_altar] and i != old_id[racial_lumber] then + set utemp = u + endif + endif + call GroupRemoveUnit(g,u) + endloop + if blockancient == null and utemp != null then + call CreateDebugTag("fix block : kill build", 10, utemp, 3.00, 1.50) + call KillUnit(utemp) + call SetPlayerGold(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_GOLD) + GetUnitGoldCost(GetUnitTypeId(utemp)) * 2) // Prevent training unit or research technology + call SetPlayerGold(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_LUMBER) + GetUnitWoodCost(GetUnitTypeId(utemp)) * 2) + endif + set utemp = null + elseif fixmode == 1 then + if attacktree then + loop + set u = FirstOfGroup(g) + exitwhen u == null + if GetOwningPlayer(u) == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and not IsUnitLoaded(u) and not IsUnitInvisible(u, Player(PLAYER_NEUTRAL_AGGRESSIVE)) then + call TryAttackTree(u, GetUnitTypeId(u), l) + endif + call GroupRemoveUnit(g,u) + endloop + else + loop + set u = FirstOfGroup(g) + exitwhen u == null or i > 2 + if GetOwningPlayer(u) == ai_player and UnitAlive(u) and not IsUnitHidden(u) and GetUnitCurrentOrder(u) == OrderId("harvest") and not IsUnitBuying(u) and not IsUnitLoaded(u) then + call RemoveGuardPosition(u) + call IssuePointOrderLoc(u, "move", l) // hope harvest near tree + call TQAddUnitJob(4, RESET_GUARD_POSITION, 0, u) + call CreateDebugTag("fix block : harvest tree", 10, u, 3.00, 1.50) + set i = i + 1 + endif + call GroupRemoveUnit(g,u) + endloop + endif + else + if moveaside then + loop + set u = FirstOfGroup(g) + exitwhen u == null + if GetOwningPlayer(u) == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and not IsUnitLoaded(u) and not IsUnitInvisible(u, Player(PLAYER_NEUTRAL_AGGRESSIVE)) then + if IsStandardUnit(u) then + call AddAssault(10,GetUnitTypeId(u)) + elseif GetUnitCurrentOrder(u) != OrderId("cannibalize") then + call IssuePointOrderLoc(u, "move", front_loc[0]) // no need send to home_location + endif + call CreateDebugTagLoc("move aside", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + endif + call GroupRemoveUnit(g,u) + endloop + else // check other block , once check one + loop + set u = FirstOfGroup(g) + exitwhen u == null or blockunit != null + set p = GetOwningPlayer(u) + if p == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_HERO) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and IsStandardUnit(u) and not IsUnitLoaded(u) then + call CreateDebugTagLoc("other block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + call AddAssault(1,GetUnitTypeId(u)) + set blockunit = u + elseif p != ai_player and IsPlayerAlly(ai_player, p) and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and not town_threatened and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) then + call CreateDebugTagLoc("ally hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + call TeleportFixBlock(u) + endif + call GroupRemoveUnit(g,u) + endloop + set p = null + endif + endif + call DestroyGroup(g) + set g = null + set u = null +endfunction + +function RemoveBlockPathUnit takes nothing returns nothing + if blockpathunit != null and UnitAlive(blockpathunit) then + call RemoveUnit(blockpathunit) + endif + set blockpathunit = null +endfunction + +function FindTree takes real x, real y returns nothing + call RemoveBlockPathUnit() + call TryFixBlock(2, home_location, 1000, true, true) //Move aside + set blockpathunit = CreatePathingUnitFull(blockpathunit, ai_player, 'ewsp', x, y) + call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) + call SetUnitMoveSpeed(blockpathunit, 300) // unable use fastest speed + call IssueImmediateOrder(blockpathunit, "autoharvestlumber") +endfunction + +function FixBlockJob takes nothing returns nothing + local location l = null + local unit u = null + local integer i = 1 + if TownThreatened() or CaptainIsHome() or towerrush or teleporting or not pathing_done or water_map then // army no at home is key , town_threatened include ally so not check + if blockancient != null and UnitAlive(blockancient) then + call RootAncient() // case townthreatened + endif + call RemoveBlockPathUnit() + set blockunit = null + call TQAddJob(240, FIX_BLOCK, 0) + return + endif + if blockancient != null and UnitAlive(blockancient) then + if movetotal > 3 or DistanceBetweenPoints_kd(ancientrootloc, GetUnitLoc(blockancient)) < 300 then + call RootAncient() + else + call MoveAncient(blockancient) + call TQAddJob(4, FIX_BLOCK, 0) + return + endif + elseif blockunit != null and UnitAlive(blockunit) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockunit)) < front_base_distance then + call CreateDebugTag("hero block at here", 10, blockunit, 3.00, 1.50) + call FindTree(GetUnitX(blockunit), GetUnitY(blockunit)) + set blockunit = null + call TQAddJob(1, FIX_BLOCK, 0) // tree must close + return + elseif blockpathunit != null and UnitAlive(blockpathunit) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockpathunit)) < front_base_distance then + if GetUnitTypeId(blockpathunit) == 'ewsp' then + set l = GetUnitLoc(blockpathunit) + if GetUnitCurrentOrder(blockpathunit) == OrderId("harvest") then + call TryFixBlock(1, l, 1200, race_no_wood_harvest or GetPlayerRace(ai_player) == RACE_NIGHTELF, true) + else + call TryFixBlock(0, l, 300, true, true) + endif + call RemoveBlockPathUnit() + call RemoveLocation(l) + set l = null + else + call CreateDebugTag("unit block at here", 10, blockpathunit, 3.00, 1.50) + call FindTree(GetUnitX(blockpathunit), GetUnitY(blockpathunit)) + endif + call TQAddJob(1, FIX_BLOCK, 0) + return + endif + call RemoveBlockPathUnit() + set blockancient = null + set blockunit = null + set movetotal = 0 + call DisplayToAllJobDebug("Fix_Block Job Start, state : " + Int2Str(blockstate)) + call CreateDebugTagLoc("Fix Block state : " + Int2Str(blockstate), 8, GetLocationX(home_location) - 300, GetLocationY(home_location) + 300, 60.00, 55.00) + call TryFixBlock(2, home_location, 1000, true, blockstate != 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern + if blockstate == 0 then + set l = GetPlayerStartLocationLoc(enemy_force[0]) + set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive + call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) // Prevent player defeat unit not remove or home too close then unit block pther palyer + call IssuePointOrderLoc(blockpathunit, "move", l) + call RemoveLocation(l) + set l = null + elseif blockstate == 2 then // 1 wait hero move , 2 check hero - altar block or tavern to close maybe block , like map lastmanstanding + loop + exitwhen i > 3 + set u = hero_unit[i] + if hero_built[i] and UnitAlive(u) and not IsUnitLoaded(u) and not IsUnitBuying(u) and IsStandardUnit(u) and (DistanceBetweenPoints_kd(home_location, GetUnitLoc(u)) < front_base_distance or (nearest_neutral[NEUTRAL_TAVERN] != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(nearest_neutral[NEUTRAL_TAVERN])) < front_base_distance and DistanceBetweenUnits(u, nearest_neutral[NEUTRAL_TAVERN]) < 1000)) then + call CreateDebugTagLoc("hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + call TeleportFixBlock(u) + set i = 3 // once check one + endif + set i = i + 1 + endloop + set u = null + endif + set blockstate = blockstate + 1 + if blockstate > 3 then + set blockstate = 0 + endif + call TQAddJob(240 - Min(blockstate, 1) * 230, FIX_BLOCK, 0) +endfunction +#ENDIF \ No newline at end of file From 385c8da9e7eec289f0c08938db2ef8fd2606d709 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Fri, 24 May 2024 21:48:05 +0800 Subject: [PATCH 04/19] fix Compilation error --- common.eai | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common.eai b/common.eai index 9ea2c8133..36169270b 100644 --- a/common.eai +++ b/common.eai @@ -6626,6 +6626,21 @@ function IsRacialHallId takes integer id, integer min_tier returns boolean return false endfunction +//============================================================================ +function GetRacialBuildHallLV takes integer id returns integer + local integer i = 1 + if id != 0 then + loop + exitwhen i > tiernum + if racial_hall[i] != 0 and (needed1[id] == racial_hall[i] or needed2[id] == racial_hall[i] or needed3[id] == racial_hall[i]) then + return i + endif + set i = i + 1 + endloop + endif + return 1 // hall 1 , base BARRACKS , tower , farm , altar , shop , expansion , lumber , goldmine , UPGRADED +endfunction + //============================================================================ function ChooseExpansion takes nothing returns nothing local integer i = 0 From b3fac26ea7f18d4c6b7d7f23f8bd9594f492ca26 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Fri, 24 May 2024 23:10:37 +0800 Subject: [PATCH 05/19] Remove army at home --- Jobs/FIX_BLOCK.eai | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index cfe4c67cf..5c6aa4298 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -167,7 +167,7 @@ function FixBlockJob takes nothing returns nothing local location l = null local unit u = null local integer i = 1 - if TownThreatened() or CaptainIsHome() or towerrush or teleporting or not pathing_done or water_map then // army no at home is key , town_threatened include ally so not check + if TownThreatened() or towerrush or teleporting or not pathing_done or water_map then // town_threatened include ally so not check if blockancient != null and UnitAlive(blockancient) then call RootAncient() // case townthreatened endif @@ -241,4 +241,4 @@ function FixBlockJob takes nothing returns nothing endif call TQAddJob(240 - Min(blockstate, 1) * 230, FIX_BLOCK, 0) endfunction -#ENDIF \ No newline at end of file +#ENDIF From 06bbb6b7fa986218adf43e6ce2c1615777b0a37d Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Sat, 25 May 2024 00:26:37 +0800 Subject: [PATCH 06/19] Add files via upload --- Jobs/STRUCTURE_CONTROL.eai | 106 +++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Jobs/STRUCTURE_CONTROL.eai diff --git a/Jobs/STRUCTURE_CONTROL.eai b/Jobs/STRUCTURE_CONTROL.eai new file mode 100644 index 000000000..1ae03040f --- /dev/null +++ b/Jobs/STRUCTURE_CONTROL.eai @@ -0,0 +1,106 @@ +#IFDEF GLOBAL + location rally_point = null + boolean homebuild = true + boolean minebuild = false + boolean shredderbuild = false +#ELSE + +function CheckBurrow takes nothing returns nothing + local group g = CreateGroup() + call GroupEnumUnitsOfPlayer(g, ai_player, null) + set g = SelectById(g, old_id[BURROW], true) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + call GroupImmediateOrder( g, "standdown" ) //fix orc peon go battlestations , but can not standdown + call DestroyGroup(g) + set g = null +endfunction + +function CheckBuildLoc takes location l, real range returns integer + local group g = CreateGroup() + local integer i = 0 + call GroupEnumUnitsInRangeOfLoc(g, l, range, null) + set g = SelectByPlayer(g, ai_player, true) + set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + set i = BlzGroupGetSize(g) + call DestroyGroup(g) + set g = null + return i +endfunction + +function CheckShredderLoc takes nothing returns nothing + local real d = 0 + local location l = null + local unit u = null + local group g = CreateGroup() + call GroupEnumUnitsOfPlayer(g, ai_player, null) + set g = SelectById(g, old_id[neutral_shredder], true) + set g = SelectByAlive(g, true) + set u = FirstOfGroup(g) + if u != null then + set d = GetUnitCurrentOrder(u) + if d == OrderId("harvest") or d == OrderId("resumeharvesting") then + set l = GetUnitLoc(u) + set d = DistanceBetweenPoints(home_location, l) + if d >= 1000 and d <= 2000 then //Ensure to be near home_location + call GroupClear(g) + call GroupEnumUnitsInRangeOfLoc(g, l, 800, null) + set g = SelectByPlayer(g, ai_player, true) + set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + set shredderbuild = BlzGroupGetSize(g) < 5 + endif + call RemoveLocation(l) + set l = null + endif + set u = null + endif + call DestroyGroup(g) + set g = null +endfunction + +function CheckRallyPoint takes location l, real range returns nothing + local group g = null + if l != null then + set g = CreateGroup() + call GroupEnumUnitsInRangeOfLoc(g, home_location, range, null) // ohter town no need set + set g = SelectByPlayer(g, ai_player, true) + set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + call GroupPointOrderLoc(g, "setrally",l) + call DestroyGroup(g) + set g = null + endif +endfunction + +function StructureControlJob takes nothing returns nothing + if not town_threatened then + call DisplayToAllJobDebug("STRUCTURE_CONTROL JOB START") + if rally_point == null then + if front_loc[0] != null and GetLocationX(front_loc[0]) !=0 and GetLocationY(front_loc[0]) !=0 then + set rally_point = AIGetProjectedLoc(front_loc[0], home_location, -1200, 0) + endif + else + call CheckRallyPoint(rally_point,1600) + endif + call CheckRallyPoint(home_location,1100) //avoid being blocked by front_loc build + if racial_lumber == 0 or race_no_wood_harvest then //help fix ELF build blocking , ture is build may be dismantled after being attacked + set homebuild = CheckBuildLoc(home_location,800) < 5 + set minebuild = mine_loc != null and CheckBuildLoc(mine_loc,700) < 4 + if TownCountDone(neutral_shredder) > 0 then + call CheckShredderLoc() // harvest wood will have new loc can build + endif + endif + if TownCountDone(BURROW) > 0 then + call CheckBurrow() + endif + endif + if not pathing_done then + call TQAddJob(sleep_multiplier * 5, STRUCTURE_CONTROL, 0) + endif +endfunction +#ENDIF \ No newline at end of file From 60dbe984b8e8c44b3adead65966417104ed0e327 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Sat, 25 May 2024 00:28:43 +0800 Subject: [PATCH 07/19] Update Jobs.txt --- Jobs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jobs.txt b/Jobs.txt index b3eeeef0b..88c04f8d0 100644 --- a/Jobs.txt +++ b/Jobs.txt @@ -25,7 +25,7 @@ MICRO_UNITS 10 MicroUnitsJob() true 10 20 ZEPPELIN_MOVE 15 ZeppelinMoveJob(par, unit_par, group_par) false 0 0 TELEPORT 15 TeleportJob(unit_par) false 0 0 HARASS 25 HarassJob(par, unit_par, group_par) false 0 0 -RALLY_POINT 5 RallypointJob() true 20 30 +STRUCTURE_CONTROL 5 StructureControlJob() true 20 30 NEUTRAL_ENEMY_CHECK 20 NeutralEnemyCheckJob(par) false 0 0 ARMY_TRACK 30 ArmyTrackJob() false 50 60 TOWN_TRACK 15 TownTrackJob() true 50 60 From ca90e45a527c175c2cd92c1f6d0aa581315ba0bf Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Sun, 9 Jun 2024 18:08:50 +0800 Subject: [PATCH 08/19] =?UTF-8?q?Not=20running=20when=20there=20are=20too?= =?UTF-8?q?=20few=20buildings=20=EF=BC=8Cblockstate=203=20always=20check?= =?UTF-8?q?=20the=20heroes=20of=20other=20AI=20allies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jobs/FIX_BLOCK.eai | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 5c6aa4298..28a55a1f0 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -124,12 +124,12 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta endif call GroupRemoveUnit(g,u) endloop - else // check other block , once check one + else // check other block , once check one own unit loop set u = FirstOfGroup(g) - exitwhen u == null or blockunit != null + exitwhen u == null set p = GetOwningPlayer(u) - if p == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_HERO) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and IsStandardUnit(u) and not IsUnitLoaded(u) then + if blockunit == null and p == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_HERO) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and IsStandardUnit(u) and not IsUnitLoaded(u) then call CreateDebugTagLoc("other block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call AddAssault(1,GetUnitTypeId(u)) set blockunit = u @@ -167,7 +167,7 @@ function FixBlockJob takes nothing returns nothing local location l = null local unit u = null local integer i = 1 - if TownThreatened() or towerrush or teleporting or not pathing_done or water_map then // town_threatened include ally so not check + if TownThreatened() or towerrush or teleporting or not pathing_done or water_map or GetPlayerStructureCount(ai_player, true) < 8 then // town_threatened include ally so not check if blockancient != null and UnitAlive(blockancient) then call RootAncient() // case townthreatened endif From e10e8245216ff6f4654f7c4abc5fce159aacaec6 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Fri, 14 Jun 2024 23:18:16 +0800 Subject: [PATCH 09/19] add town_threatened --- Jobs/FIX_BLOCK.eai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 28a55a1f0..e4d3ffacb 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -167,7 +167,7 @@ function FixBlockJob takes nothing returns nothing local location l = null local unit u = null local integer i = 1 - if TownThreatened() or towerrush or teleporting or not pathing_done or water_map or GetPlayerStructureCount(ai_player, true) < 8 then // town_threatened include ally so not check + if TownThreatened() or town_threatened or towerrush or teleporting or not pathing_done or water_map or GetPlayerStructureCount(ai_player, true) < 8 then // town_threatened include ally so not check if blockancient != null and UnitAlive(blockancient) then call RootAncient() // case townthreatened endif From 95120af1535bcb66d634be58e39239cc4ffa1870 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Sun, 16 Jun 2024 02:15:37 +0800 Subject: [PATCH 10/19] Update STRUCTURE_CONTROL.eai --- Jobs/STRUCTURE_CONTROL.eai | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Jobs/STRUCTURE_CONTROL.eai b/Jobs/STRUCTURE_CONTROL.eai index 1ae03040f..07c3586fe 100644 --- a/Jobs/STRUCTURE_CONTROL.eai +++ b/Jobs/STRUCTURE_CONTROL.eai @@ -80,13 +80,10 @@ endfunction function StructureControlJob takes nothing returns nothing if not town_threatened then call DisplayToAllJobDebug("STRUCTURE_CONTROL JOB START") - if rally_point == null then - if front_loc[0] != null and GetLocationX(front_loc[0]) !=0 and GetLocationY(front_loc[0]) !=0 then - set rally_point = AIGetProjectedLoc(front_loc[0], home_location, -1200, 0) - endif - else - call CheckRallyPoint(rally_point,1600) + if rally_point == null and front_loc[0] != null and GetLocationX(front_loc[0]) !=0 and GetLocationY(front_loc[0]) !=0 then + set rally_point = AIGetProjectedLoc(front_loc[0], home_location, -1200, 0) endif + call CheckRallyPoint(rally_point,1600) call CheckRallyPoint(home_location,1100) //avoid being blocked by front_loc build if racial_lumber == 0 or race_no_wood_harvest then //help fix ELF build blocking , ture is build may be dismantled after being attacked set homebuild = CheckBuildLoc(home_location,800) < 5 @@ -103,4 +100,4 @@ function StructureControlJob takes nothing returns nothing call TQAddJob(sleep_multiplier * 5, STRUCTURE_CONTROL, 0) endif endfunction -#ENDIF \ No newline at end of file +#ENDIF From a7fd7f2b99db1f7b8c0b981ba773ca8226f97eb9 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:45:27 +0800 Subject: [PATCH 11/19] Update FIX_BLOCK.eai --- Jobs/FIX_BLOCK.eai | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index e4d3ffacb..578195546 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -10,7 +10,7 @@ // ######################## Fix Block ############################### // Created by JZY 15/04/24. // blockstate : 0 check home block , 1 & 2 check altar and tavern block , 3 check other block -// fix mode : 0 and 2 move ancient or kill build and with compensation , 1 harvest or attack tree , 2 give path unit move aside or check other block +// fix mode : 0 move ancient or kill build and with compensation , 1 harvest or attack tree , 2 give path unit move aside or check other block // ################################################################## function TryAttackTree takes unit u, integer id, location l returns nothing if id == 'ebal' or id == 'hmtm' or id == 'ocat' or id == 'umtw' or id == 'ncat' then @@ -27,13 +27,13 @@ endfunction function MoveAncient takes unit u returns nothing local unit utemp = null if GetUnitCurrentOrder(u) != OrderId("root") then - set utemp = CreateUnitAtLoc(ai_player, GetUnitTypeId(u), front_loc[0], 270) - call IssueImmediateOrder(u, "cancel") - call IssueImmediateOrder(u, "unroot") call RemoveLocation(ancientrootloc) + set utemp = CreateUnitAtLoc(ai_player, GetUnitTypeId(u), front_loc[0], 270) set ancientrootloc = GetUnitLoc(utemp) call RemoveUnit(utemp) set utemp = null + call IssueImmediateOrder(u, "cancel") + call IssueImmediateOrder(u, "unroot") endif call CreateDebugTagLoc("fix block : root here", 10, GetLocationX(ancientrootloc), GetLocationY(ancientrootloc), 3.00, 1.50) call IssuePointOrderLoc(u, "root", ancientrootloc) // build no n need RESET GUARD POSITION @@ -60,19 +60,21 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta local unit utemp = null local player p = null local integer i = 0 + local boolean array allyhero call GroupEnumUnitsInRangeOfLoc(g, l, range, null) + call GroupRemoveUnit(g,expansion_peon) call GroupRemoveUnit(g, blockpathunit) if fixmode == 0 then loop set u = FirstOfGroup(g) exitwhen u == null or blockancient != null or (GetPlayerRace(ai_player) != RACE_NIGHTELF and utemp != null) // first move ancient - if GetOwningPlayer(u) == ai_player and IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_TOWNHALL) and UnitAlive(u) and not IsUnitHidden(u) then + if GetOwningPlayer(u) == ai_player and IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitGoldMine(u) and not IsUnitType(u, UNIT_TYPE_TOWNHALL) and UnitAlive(u) and not IsUnitHidden(u) then if IsUnitType(u, UNIT_TYPE_ANCIENT) then call MoveAncient(u) set blockancient = u endif set i = GetUnitTypeId(u) // Prevent kill mine , altar , lumber - if blockancient == null and utemp == null and i != old_id[racial_expansion] and i != old_id[racial_altar] and i != old_id[racial_lumber] then + if blockancient == null and utemp == null and GetUnitCount(i) > 1 and i != old_id[racial_expansion] and i != old_id[racial_altar] and i != old_id[racial_lumber] then set utemp = u endif endif @@ -82,7 +84,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta call CreateDebugTag("fix block : kill build", 10, utemp, 3.00, 1.50) call KillUnit(utemp) call SetPlayerGold(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_GOLD) + GetUnitGoldCost(GetUnitTypeId(utemp)) * 2) // Prevent training unit or research technology - call SetPlayerGold(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_LUMBER) + GetUnitWoodCost(GetUnitTypeId(utemp)) * 2) + call SetPlayerWood(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_LUMBER) + GetUnitWoodCost(GetUnitTypeId(utemp)) * 2) endif set utemp = null elseif fixmode == 1 then @@ -99,7 +101,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta loop set u = FirstOfGroup(g) exitwhen u == null or i > 2 - if GetOwningPlayer(u) == ai_player and UnitAlive(u) and not IsUnitHidden(u) and GetUnitCurrentOrder(u) == OrderId("harvest") and not IsUnitBuying(u) and not IsUnitLoaded(u) then + if GetOwningPlayer(u) == ai_player and IsUnitType(u, UNIT_TYPE_PEON) and UnitAlive(u) and not IsUnitHidden(u) and GetUnitCurrentOrder(u) == OrderId("harvest") and not IsUnitBuying(u) and not IsUnitLoaded(u) then call RemoveGuardPosition(u) call IssuePointOrderLoc(u, "move", l) // hope harvest near tree call TQAddUnitJob(4, RESET_GUARD_POSITION, 0, u) @@ -117,25 +119,27 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta if GetOwningPlayer(u) == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and not IsUnitLoaded(u) and not IsUnitInvisible(u, Player(PLAYER_NEUTRAL_AGGRESSIVE)) then if IsStandardUnit(u) then call AddAssault(10,GetUnitTypeId(u)) + call CreateDebugTagLoc("fix block : add assault", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) elseif GetUnitCurrentOrder(u) != OrderId("cannibalize") then call IssuePointOrderLoc(u, "move", front_loc[0]) // no need send to home_location + call CreateDebugTagLoc("fix block : move aside", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) endif - call CreateDebugTagLoc("move aside", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) endif call GroupRemoveUnit(g,u) endloop - else // check other block , once check one own unit + else // check other block , once check one own unit and ally hero loop set u = FirstOfGroup(g) exitwhen u == null set p = GetOwningPlayer(u) if blockunit == null and p == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_HERO) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and IsStandardUnit(u) and not IsUnitLoaded(u) then - call CreateDebugTagLoc("other block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + call CreateDebugTagLoc("fix block : other block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call AddAssault(1,GetUnitTypeId(u)) set blockunit = u - elseif p != ai_player and IsPlayerAlly(ai_player, p) and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and not town_threatened and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) then - call CreateDebugTagLoc("ally hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + elseif p != ai_player and not allyhero[GetPlayerId(p)] and IsPlayerAlly(ai_player, p) and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) and not IsUnitType(u, UNIT_TYPE_FLYING) then + call CreateDebugTagLoc("fix block : ally hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call TeleportFixBlock(u) + set allyhero[GetPlayerId(p)] = true // case one loop let hero teleport too much endif call GroupRemoveUnit(g,u) endloop @@ -148,7 +152,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta endfunction function RemoveBlockPathUnit takes nothing returns nothing - if blockpathunit != null and UnitAlive(blockpathunit) then + if blockpathunit != null then call RemoveUnit(blockpathunit) endif set blockpathunit = null @@ -185,7 +189,7 @@ function FixBlockJob takes nothing returns nothing return endif elseif blockunit != null and UnitAlive(blockunit) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockunit)) < front_base_distance then - call CreateDebugTag("hero block at here", 10, blockunit, 3.00, 1.50) + call CreateDebugTag("fix block : hero block at here", 10, blockunit, 3.00, 1.50) call FindTree(GetUnitX(blockunit), GetUnitY(blockunit)) set blockunit = null call TQAddJob(1, FIX_BLOCK, 0) // tree must close @@ -202,7 +206,7 @@ function FixBlockJob takes nothing returns nothing call RemoveLocation(l) set l = null else - call CreateDebugTag("unit block at here", 10, blockpathunit, 3.00, 1.50) + call CreateDebugTag("fix block : unit block at here", 10, blockpathunit, 3.00, 1.50) call FindTree(GetUnitX(blockpathunit), GetUnitY(blockpathunit)) endif call TQAddJob(1, FIX_BLOCK, 0) @@ -213,8 +217,7 @@ function FixBlockJob takes nothing returns nothing set blockunit = null set movetotal = 0 call DisplayToAllJobDebug("Fix_Block Job Start, state : " + Int2Str(blockstate)) - call CreateDebugTagLoc("Fix Block state : " + Int2Str(blockstate), 8, GetLocationX(home_location) - 300, GetLocationY(home_location) + 300, 60.00, 55.00) - call TryFixBlock(2, home_location, 1000, true, blockstate != 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern + call TryFixBlock(2, home_location, 1200, true, blockstate != 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern if blockstate == 0 then set l = GetPlayerStartLocationLoc(enemy_force[0]) set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive @@ -226,8 +229,8 @@ function FixBlockJob takes nothing returns nothing loop exitwhen i > 3 set u = hero_unit[i] - if hero_built[i] and UnitAlive(u) and not IsUnitLoaded(u) and not IsUnitBuying(u) and IsStandardUnit(u) and (DistanceBetweenPoints_kd(home_location, GetUnitLoc(u)) < front_base_distance or (nearest_neutral[NEUTRAL_TAVERN] != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(nearest_neutral[NEUTRAL_TAVERN])) < front_base_distance and DistanceBetweenUnits(u, nearest_neutral[NEUTRAL_TAVERN]) < 1000)) then - call CreateDebugTagLoc("hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + if u != null and UnitAlive(u) and not IsUnitLoaded(u) and not IsUnitBuying(u) and IsStandardUnit(u) and (DistanceBetweenPoints_kd(home_location, GetUnitLoc(u)) < front_base_distance or (nearest_neutral[NEUTRAL_TAVERN] != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(nearest_neutral[NEUTRAL_TAVERN])) < front_base_distance and DistanceBetweenUnits(u, nearest_neutral[NEUTRAL_TAVERN]) < 1000)) then + call CreateDebugTagLoc("fix block : hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call TeleportFixBlock(u) set i = 3 // once check one endif From f8108dfd5da517817a3c98f6e30ea3892e2a7344 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:45:42 +0800 Subject: [PATCH 12/19] Update STRUCTURE_CONTROL.eai --- Jobs/STRUCTURE_CONTROL.eai | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jobs/STRUCTURE_CONTROL.eai b/Jobs/STRUCTURE_CONTROL.eai index 07c3586fe..18b1e5d62 100644 --- a/Jobs/STRUCTURE_CONTROL.eai +++ b/Jobs/STRUCTURE_CONTROL.eai @@ -31,7 +31,7 @@ function CheckBuildLoc takes location l, real range returns integer endfunction function CheckShredderLoc takes nothing returns nothing - local real d = 0 + local integer d = 0 local location l = null local unit u = null local group g = CreateGroup() @@ -43,7 +43,7 @@ function CheckShredderLoc takes nothing returns nothing set d = GetUnitCurrentOrder(u) if d == OrderId("harvest") or d == OrderId("resumeharvesting") then set l = GetUnitLoc(u) - set d = DistanceBetweenPoints(home_location, l) + set d = R2I(DistanceBetweenPoints(home_location, l)) if d >= 1000 and d <= 2000 then //Ensure to be near home_location call GroupClear(g) call GroupEnumUnitsInRangeOfLoc(g, l, 800, null) @@ -80,7 +80,7 @@ endfunction function StructureControlJob takes nothing returns nothing if not town_threatened then call DisplayToAllJobDebug("STRUCTURE_CONTROL JOB START") - if rally_point == null and front_loc[0] != null and GetLocationX(front_loc[0]) !=0 and GetLocationY(front_loc[0]) !=0 then + if rally_point == null and front_loc[0] != null and GetLocationX(front_loc[0]) != 0 and GetLocationY(front_loc[0]) != 0 then set rally_point = AIGetProjectedLoc(front_loc[0], home_location, -1200, 0) endif call CheckRallyPoint(rally_point,1600) From 63574ec0a9ca49e563fe67302b45e0d8a55d7f97 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Thu, 12 Sep 2024 22:53:37 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A0=B5=E5=A1=9E?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A3=80=E6=9F=A5=E8=8C=83=E5=9B=B4=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=A4=E6=A0=91=E7=A7=BB=E5=8A=A8=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jobs/FIX_BLOCK.eai | 62 ++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 578195546..f0dabe347 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -41,9 +41,7 @@ function MoveAncient takes unit u returns nothing endfunction function RootAncient takes nothing returns nothing - call RemoveLocation(ancientrootloc) - set ancientrootloc = GetUnitLoc(blockancient) - call IssuePointOrderLoc(blockancient, "root", ancientrootloc) + call IssuePointOrder(blockancient, "root", GetUnitX(blockancient), GetUnitY(blockancient)) set blockancient = null endfunction @@ -54,7 +52,7 @@ function TeleportFixBlock takes unit u returns nothing call UnitUseItemPoint(u, UnitAddItemById(u, old_id[tp_item]), GetLocationX(home_location), GetLocationY(home_location)) endfunction -function TryFixBlock takes integer fixmode, location l, real range, boolean attacktree, boolean moveaside returns nothing +function TryFixBlock takes integer fixmode, location l, real range, boolean action returns nothing local group g = CreateGroup() local unit u = null local unit utemp = null @@ -88,7 +86,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta endif set utemp = null elseif fixmode == 1 then - if attacktree then + if action then loop set u = FirstOfGroup(g) exitwhen u == null @@ -112,31 +110,16 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta endloop endif else - if moveaside then - loop - set u = FirstOfGroup(g) - exitwhen u == null - if GetOwningPlayer(u) == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and not IsUnitLoaded(u) and not IsUnitInvisible(u, Player(PLAYER_NEUTRAL_AGGRESSIVE)) then - if IsStandardUnit(u) then - call AddAssault(10,GetUnitTypeId(u)) - call CreateDebugTagLoc("fix block : add assault", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) - elseif GetUnitCurrentOrder(u) != OrderId("cannibalize") then - call IssuePointOrderLoc(u, "move", front_loc[0]) // no need send to home_location - call CreateDebugTagLoc("fix block : move aside", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) - endif - endif - call GroupRemoveUnit(g,u) - endloop - else // check other block , once check one own unit and ally hero + if action then // check other block , once check one own unit and ally hero loop set u = FirstOfGroup(g) exitwhen u == null set p = GetOwningPlayer(u) if blockunit == null and p == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_HERO) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and IsStandardUnit(u) and not IsUnitLoaded(u) then - call CreateDebugTagLoc("fix block : other block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + call CreateDebugTagLoc("fix block : other unit block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call AddAssault(1,GetUnitTypeId(u)) set blockunit = u - elseif p != ai_player and not allyhero[GetPlayerId(p)] and IsPlayerAlly(ai_player, p) and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) and not IsUnitType(u, UNIT_TYPE_FLYING) then + elseif p != ai_player and IsPlayerAlly(ai_player, p) and not allyhero[GetPlayerId(p)] and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) and not IsUnitType(u, UNIT_TYPE_FLYING) then call CreateDebugTagLoc("fix block : ally hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) call TeleportFixBlock(u) set allyhero[GetPlayerId(p)] = true // case one loop let hero teleport too much @@ -144,6 +127,21 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean atta call GroupRemoveUnit(g,u) endloop set p = null + else + loop + set u = FirstOfGroup(g) + exitwhen u == null + if GetOwningPlayer(u) == ai_player and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_FLYING) and GetUnitTypeId(u) != 'ngir' and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitBuying(u) and not IsUnitLoaded(u) and not IsUnitInvisible(u, Player(PLAYER_NEUTRAL_AGGRESSIVE)) then + if IsStandardUnit(u) then + call AddAssault(10,GetUnitTypeId(u)) + call CreateDebugTagLoc("fix block : add assault", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + elseif GetUnitCurrentOrder(u) != OrderId("cannibalize") then + call IssuePointOrderLoc(u, "move", front_loc[0]) // no need send to home_location + call CreateDebugTagLoc("fix block : move aside", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) + endif + endif + call GroupRemoveUnit(g,u) + endloop endif endif call DestroyGroup(g) @@ -160,7 +158,7 @@ endfunction function FindTree takes real x, real y returns nothing call RemoveBlockPathUnit() - call TryFixBlock(2, home_location, 1000, true, true) //Move aside + call TryFixBlock(2, home_location, 1000, false) //Move aside set blockpathunit = CreatePathingUnitFull(blockpathunit, ai_player, 'ewsp', x, y) call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) call SetUnitMoveSpeed(blockpathunit, 300) // unable use fastest speed @@ -181,26 +179,26 @@ function FixBlockJob takes nothing returns nothing return endif if blockancient != null and UnitAlive(blockancient) then - if movetotal > 3 or DistanceBetweenPoints_kd(ancientrootloc, GetUnitLoc(blockancient)) < 300 then + if movetotal > 3 then call RootAncient() else call MoveAncient(blockancient) call TQAddJob(4, FIX_BLOCK, 0) return endif - elseif blockunit != null and UnitAlive(blockunit) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockunit)) < front_base_distance then + elseif blockunit != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockunit)) < front_base_distance then call CreateDebugTag("fix block : hero block at here", 10, blockunit, 3.00, 1.50) call FindTree(GetUnitX(blockunit), GetUnitY(blockunit)) set blockunit = null call TQAddJob(1, FIX_BLOCK, 0) // tree must close return - elseif blockpathunit != null and UnitAlive(blockpathunit) and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockpathunit)) < front_base_distance then + elseif blockpathunit != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(blockpathunit)) < front_base_distance then if GetUnitTypeId(blockpathunit) == 'ewsp' then set l = GetUnitLoc(blockpathunit) if GetUnitCurrentOrder(blockpathunit) == OrderId("harvest") then - call TryFixBlock(1, l, 1200, race_no_wood_harvest or GetPlayerRace(ai_player) == RACE_NIGHTELF, true) + call TryFixBlock(1, l, 1200, race_no_wood_harvest or GetPlayerRace(ai_player) == RACE_NIGHTELF) else - call TryFixBlock(0, l, 300, true, true) + call TryFixBlock(0, l, 550, true) endif call RemoveBlockPathUnit() call RemoveLocation(l) @@ -209,7 +207,7 @@ function FixBlockJob takes nothing returns nothing call CreateDebugTag("fix block : unit block at here", 10, blockpathunit, 3.00, 1.50) call FindTree(GetUnitX(blockpathunit), GetUnitY(blockpathunit)) endif - call TQAddJob(1, FIX_BLOCK, 0) + call TQAddJob(2, FIX_BLOCK, 0) return endif call RemoveBlockPathUnit() @@ -217,7 +215,7 @@ function FixBlockJob takes nothing returns nothing set blockunit = null set movetotal = 0 call DisplayToAllJobDebug("Fix_Block Job Start, state : " + Int2Str(blockstate)) - call TryFixBlock(2, home_location, 1200, true, blockstate != 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern + call TryFixBlock(2, home_location, 1200, blockstate == 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern if blockstate == 0 then set l = GetPlayerStartLocationLoc(enemy_force[0]) set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive @@ -244,4 +242,4 @@ function FixBlockJob takes nothing returns nothing endif call TQAddJob(240 - Min(blockstate, 1) * 230, FIX_BLOCK, 0) endfunction -#ENDIF +#ENDIF \ No newline at end of file From 372d83b96bd4bd5f9e8d6fb49ecc09a9ce4b2568 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:00:27 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jobs/FIX_BLOCK.eai | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index f0dabe347..07b4b58c3 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -218,9 +218,11 @@ function FixBlockJob takes nothing returns nothing call TryFixBlock(2, home_location, 1200, blockstate == 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern if blockstate == 0 then set l = GetPlayerStartLocationLoc(enemy_force[0]) - set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive - call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) // Prevent player defeat unit not remove or home too close then unit block pther palyer - call IssuePointOrderLoc(blockpathunit, "move", l) + if l != null and DistanceBetweenPoints(home_location, l) > front_base_distance then + set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive + call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) // Prevent player defeat unit not remove or home too close then unit block pther palyer + call IssuePointOrderLoc(blockpathunit, "move", l) + endif call RemoveLocation(l) set l = null elseif blockstate == 2 then // 1 wait hero move , 2 check hero - altar block or tavern to close maybe block , like map lastmanstanding From 28d80da6b507a5b2cef80aa163888378b96f60e3 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:52:08 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=9C=E5=BA=95?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jobs/FIX_BLOCK.eai | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 07b4b58c3..590779924 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -218,13 +218,27 @@ function FixBlockJob takes nothing returns nothing call TryFixBlock(2, home_location, 1200, blockstate == 3) // 3 check other block , maybe pathing sys will always led unit go one loc , but loc blind alley , this block unable to handle , like map lastmanstanding - when hero no block , but maybe new train unit wiil go tavern if blockstate == 0 then set l = GetPlayerStartLocationLoc(enemy_force[0]) - if l != null and DistanceBetweenPoints(home_location, l) > front_base_distance then + if l == null or DistanceBetweenPoints(home_location, l) < front_base_distance then + if l != null then + call RemoveLocation(l) + set l = null + endif + set i = GetRandomInt(0, NEUTRAL_COUNT - 1) + if nearest_neutral[i] != null then + set l = GetUnitLoc(nearest_neutral[i]) + if DistanceBetweenPoints(home_location, l) < front_base_distance then + call RemoveLocation(l) + set l = null + endif + endif + endif + if l != null then set blockpathunit = CreatePathingUnitFull(blockpathunit, Player(PLAYER_NEUTRAL_PASSIVE), 'hbew', GetLocationX(home_location), GetLocationY(home_location)) // must big unit and can not revive call UnitApplyTimedLife(blockpathunit, 'BTLF', 18) // Prevent player defeat unit not remove or home too close then unit block pther palyer call IssuePointOrderLoc(blockpathunit, "move", l) + call RemoveLocation(l) + set l = null endif - call RemoveLocation(l) - set l = null elseif blockstate == 2 then // 1 wait hero move , 2 check hero - altar block or tavern to close maybe block , like map lastmanstanding loop exitwhen i > 3 From e91b6e9e95c5f6f84d158d17bfe13daf51c272bc Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:56:29 +0800 Subject: [PATCH 16/19] let HealArmy runing --- Jobs/FIX_BLOCK.eai | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 590779924..137e1d0bd 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -169,7 +169,7 @@ function FixBlockJob takes nothing returns nothing local location l = null local unit u = null local integer i = 1 - if TownThreatened() or town_threatened or towerrush or teleporting or not pathing_done or water_map or GetPlayerStructureCount(ai_player, true) < 8 then // town_threatened include ally so not check + if TownThreatened() or town_threatened or not attack_running or towerrush or teleporting or not pathing_done or water_map or GetPlayerStructureCount(ai_player, true) < 8 then // town_threatened include ally so not check if blockancient != null and UnitAlive(blockancient) then call RootAncient() // case townthreatened endif @@ -258,4 +258,4 @@ function FixBlockJob takes nothing returns nothing endif call TQAddJob(240 - Min(blockstate, 1) * 230, FIX_BLOCK, 0) endfunction -#ENDIF \ No newline at end of file +#ENDIF From ad3ec5cef1512a638c553b8f875f007af1ab8036 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:18:22 +0800 Subject: [PATCH 17/19] first Teleport ally hero to ally Start Location --- Jobs/FIX_BLOCK.eai | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index 137e1d0bd..c2c3e3a19 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -45,11 +45,31 @@ function RootAncient takes nothing returns nothing set blockancient = null endfunction -function TeleportFixBlock takes unit u returns nothing +function TeleportFixBlock takes unit u, takes player p returns nothing + local group g = null + local location l = null + local real x = GetLocationX(home_location) + local real y = GetLocationY(home_location) + if p != ai_player then + set g = CreateGroup() + set l = GetPlayerStartLocationLoc(p) + call GroupEnumUnitsInRangeOfLoc(g, l, 850, null) + set g = SelectUnittype(g, UNIT_TYPE_TOWNHALL, true) + set g = SelectByHidden(g, false) + set g = SelectByAlive(g, true) + if FirstOfGroup(g) != null then + set x = GetLocationX(l) + set y = GetLocationY(l) + endif + call RemoveLocation(l) + set l = null + call DestroyGroup(g) + set g = null + endif if GetSlotsFreeOnUnit(u) == 0 then - call SetItemPosition(UnitItemInSlot(u, 0), GetLocationX(home_location), GetLocationY(home_location)) + call SetItemPosition(UnitItemInSlot(u, 0), x, y) endif - call UnitUseItemPoint(u, UnitAddItemById(u, old_id[tp_item]), GetLocationX(home_location), GetLocationY(home_location)) + call UnitUseItemPoint(u, UnitAddItemById(u, old_id[tp_item]), x, y) endfunction function TryFixBlock takes integer fixmode, location l, real range, boolean action returns nothing @@ -71,7 +91,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean acti call MoveAncient(u) set blockancient = u endif - set i = GetUnitTypeId(u) // Prevent kill mine , altar , lumber + set i = GetUnitTypeId(u) // Prevent kill mine , altar , lumber , but include shop if blockancient == null and utemp == null and GetUnitCount(i) > 1 and i != old_id[racial_expansion] and i != old_id[racial_altar] and i != old_id[racial_lumber] then set utemp = u endif @@ -80,9 +100,9 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean acti endloop if blockancient == null and utemp != null then call CreateDebugTag("fix block : kill build", 10, utemp, 3.00, 1.50) - call KillUnit(utemp) call SetPlayerGold(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_GOLD) + GetUnitGoldCost(GetUnitTypeId(utemp)) * 2) // Prevent training unit or research technology call SetPlayerWood(ai_player, GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_LUMBER) + GetUnitWoodCost(GetUnitTypeId(utemp)) * 2) + call KillUnit(utemp) endif set utemp = null elseif fixmode == 1 then @@ -121,7 +141,7 @@ function TryFixBlock takes integer fixmode, location l, real range, boolean acti set blockunit = u elseif p != ai_player and IsPlayerAlly(ai_player, p) and not allyhero[GetPlayerId(p)] and GetPlayerController(p) == MAP_CONTROL_COMPUTER and IsUnitType(u, UNIT_TYPE_HERO) and UnitAlive(u) and not IsUnitHidden(u) and not IsUnitLoaded(u) and not IsUnitType(u, UNIT_TYPE_FLYING) then call CreateDebugTagLoc("fix block : ally hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) - call TeleportFixBlock(u) + call TeleportFixBlock(u, p) set allyhero[GetPlayerId(p)] = true // case one loop let hero teleport too much endif call GroupRemoveUnit(g,u) @@ -245,7 +265,7 @@ function FixBlockJob takes nothing returns nothing set u = hero_unit[i] if u != null and UnitAlive(u) and not IsUnitLoaded(u) and not IsUnitBuying(u) and IsStandardUnit(u) and (DistanceBetweenPoints_kd(home_location, GetUnitLoc(u)) < front_base_distance or (nearest_neutral[NEUTRAL_TAVERN] != null and DistanceBetweenPoints_kd(home_location, GetUnitLoc(nearest_neutral[NEUTRAL_TAVERN])) < front_base_distance and DistanceBetweenUnits(u, nearest_neutral[NEUTRAL_TAVERN]) < 1000)) then call CreateDebugTagLoc("fix block : hero block", 10, GetUnitX(u), GetUnitY(u), 3.00, 1.50) - call TeleportFixBlock(u) + call TeleportFixBlock(u, ai_player) set i = 3 // once check one endif set i = i + 1 From 2a1e6c68c41cf45c109dbabc2200d45802a40e7b Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:21:18 +0800 Subject: [PATCH 18/19] Update FIX_BLOCK.eai --- Jobs/FIX_BLOCK.eai | 1 + 1 file changed, 1 insertion(+) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index c2c3e3a19..a83028660 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -55,6 +55,7 @@ function TeleportFixBlock takes unit u, takes player p returns nothing set l = GetPlayerStartLocationLoc(p) call GroupEnumUnitsInRangeOfLoc(g, l, 850, null) set g = SelectUnittype(g, UNIT_TYPE_TOWNHALL, true) + set g = SelectByPlayer(g, p, true) set g = SelectByHidden(g, false) set g = SelectByAlive(g, true) if FirstOfGroup(g) != null then From 27f86ecb792caddc144f41d0eda1aa0f5ffd7111 Mon Sep 17 00:00:00 2001 From: jzy-chitong56 <48715223+jzy-chitong56@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:53:56 +0800 Subject: [PATCH 19/19] fix --- Jobs/FIX_BLOCK.eai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jobs/FIX_BLOCK.eai b/Jobs/FIX_BLOCK.eai index a83028660..64ad2a288 100644 --- a/Jobs/FIX_BLOCK.eai +++ b/Jobs/FIX_BLOCK.eai @@ -45,7 +45,7 @@ function RootAncient takes nothing returns nothing set blockancient = null endfunction -function TeleportFixBlock takes unit u, takes player p returns nothing +function TeleportFixBlock takes unit u, player p returns nothing local group g = null local location l = null local real x = GetLocationX(home_location)