Based on the custom AIs designed for the Blink Stalker, the enemy Warp Prisms and the heroes in the last LotV campaign mission (Salvation), I tried to do a custom AI function for the Roach, meant for him to burrow when half his health, pull back if he has burrowed movement researched and unburrow if there's no enemies close by, he regened enough health or if there's a melee unit for him to ambush. The big problem is that something in that code is freezing the test map altogether. Either a wait command or something, I can't tell, and I really could use someone used with Galaxy to help me point it out.
Here's the code.
void gf_AIRoach (int lp_owner, unit lp_roach, unitgroup lp_nearbyUnits) {
Variable Declarations
unitgroup lv_enemyGroup;
point lv_point;
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.
First problem, you need to remove the waits. Tactical AI functions run every second. Use a debug statement to see what I mean. This is why maps with AI and a TON of casters have lag issues sometimes.
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.
To post a comment, please login or register a new account.
Based on the custom AIs designed for the Blink Stalker, the enemy Warp Prisms and the heroes in the last LotV campaign mission (Salvation), I tried to do a custom AI function for the Roach, meant for him to burrow when half his health, pull back if he has burrowed movement researched and unburrow if there's no enemies close by, he regened enough health or if there's a melee unit for him to ambush. The big problem is that something in that code is freezing the test map altogether. Either a wait command or something, I can't tell, and I really could use someone used with Galaxy to help me point it out.
Here's the code.
void gf_AIRoach (int lp_owner, unit lp_roach, unitgroup lp_nearbyUnits) { Variable Declarations unitgroup lv_enemyGroup; point lv_point;
Variable Initialization lv_enemyGroup = UnitGroupEmpty();
Implementation lv_enemyGroup = libVCMI_gf_AITacticalEnemiesWithinRange(lp_roach, 8.0, UnitFilter(0, 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32)))); Wait(1.0, c_timeAI); if ((TechTreeUpgradeCount(UnitGetOwner(lp_roach), "Burrow", c_techCountCompleteOnly) == 1) && (UnitGetPropertyFixed(lp_roach, c_unitPropLifePercent, c_unitPropCurrent) < 50.0)) { libNtve_gf_AICast(lp_roach, Order(AbilityCommand("BurrowRoachDown", 0))); Wait(2.0, c_timeAI); if ((TechTreeUpgradeCount(UnitGetOwner(lp_roach), "TunnelingClaws", c_techCountCompleteOnly) == 1)) { lv_point = PointWithOffsetPolar(UnitGetPosition(lp_roach), -2.0, UnitGetFacing(lp_roach)); libNtve_gf_AICast(lp_roach, OrderTargetingPoint(AbilityCommand("move", 0), lv_point)); }
Wait(RandomFixed(5.0, 10.0), c_timeAI); while (!(((UnitGetPropertyFixed(lp_roach, c_unitPropLifePercent, c_unitPropCurrent) >= 80.0) || (UnitCountAlliance(UnitGetOwner(lp_roach), c_unitAllianceEnemy, RegionCircle(UnitGetPosition(lp_roach), 0.8), UnitFilter(0, 0, (1 << c_targetFilterPlayer) | (1 << c_targetFilterAlly) | (1 << c_targetFilterNeutral) | (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0) >= 1) || (UnitGroupCount(UnitGroupFilterAlliance(lv_enemyGroup, UnitGetOwner(lp_roach), c_unitAllianceEnemy, 0), c_unitCountAlive) <= 1)))) { Wait(1.0, c_timeGame); } libNtve_gf_AICast(lp_roach, Order(AbilityCommand("BurrowRoachUp", 0))); Wait(35.0, c_timeAI); }
Sorry if that's illegile, I don't know how to put in in XML text.
put that on a pastebin and link to it
Go play Antioch Chronicles Remastered!
Also, coming soon, Antioch Episode 3: Thoughts in Chaos!
Dont like mapster's ugly white? Try Mapster's Classic Skin!
@Alevice: Go
Attached a txt file for better read
Try accomplishing the same thing by modifying the roaches tactical ai, that should not freeze the map.
http://www.sc2mapster.com/assets/nolanstars-textures/
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.
@nolanstar: Go
No I want something I can trigger according to difficulty, not make it automatic for all difficulties.
First problem, you need to remove the waits. Tactical AI functions run every second. Use a debug statement to see what I mean. This is why maps with AI and a TON of casters have lag issues sometimes.
@DeltaCadimus: Go
You can attach difficulty to tactical AI
http://www.sc2mapster.com/assets/nolanstars-textures/
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.