Changing a unit's ranged combat strength with research

DoktorApplejuce

Champion of Kirkwall
Joined
Apr 9, 2015
Messages
582
Location
Canada
I'm trying to modify Lua from Leugi's Cuba mod, which increases the combat capability of his Great General replacement. His code is:

Spoiler :
Code:
local WGeneralPromotion = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL"].ID
local WGLevel0 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_0"].ID
local WGLevel1 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_1"].ID
local WGLevel2 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_2"].ID
local WGLevel3 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_3"].ID
local WGLevel4 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_4"].ID
local WGLevel5 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_5"].ID
local WGLevel6 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_6"].ID
local WGLevel7 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_7"].ID
local WGLevel8 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_8"].ID
local WGLevel9 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_9"].ID

local WGLevel1Prereq = GameInfo.Technologies["TECH_BRONZE_WORKING"].ID
local WGLevel2Prereq = GameInfo.Technologies["TECH_IRON_WORKING"].ID
local WGLevel3Prereq = GameInfo.Technologies["TECH_STEEL"].ID
local WGLevel4Prereq = GameInfo.Technologies["TECH_GUNPOWDER"].ID
local WGLevel5Prereq = GameInfo.Technologies["TECH_RIFLING"].ID
local WGLevel6Prereq = GameInfo.Technologies["TECH_REPLACEABLE_PARTS"].ID
local WGLevel7Prereq = GameInfo.Technologies["TECH_PLASTIC"].ID
local WGLevel8Prereq = GameInfo.Technologies["TECH_MOBILE_TACTICS"].ID
local WGLevel9Prereq = GameInfo.Technologies["TECH_NANOTECHNOLOGY"].ID

local WGLevel0Combat = 8
local WGLevel1Combat = 11
local WGLevel2Combat = 14
local WGLevel3Combat = 21
local WGLevel4Combat = 24
local WGLevel5Combat = 34
local WGLevel6Combat = 50
local WGLevel7Combat = 70
local WGLevel8Combat = 90
local WGLevel9Combat = 100


function WarGeneral(iPlayer)
	for _, pPlayer in pairs(Players) do
	local teamID = pPlayer:GetTeam();
	local pTeam = Teams[teamID];
	if (pPlayer:IsAlive()) then
		for bgunit in pPlayer:Units() do
			if (bgunit:IsHasPromotion(WGeneralPromotion)) then
				bgunit:SetHasPromotion(WGLevel0, true);
				bgunit:SetBaseCombatStrength(WGLevel0Combat)
				if (pTeam:IsHasTech(WGLevel1Prereq)) then
						bgunit:SetHasPromotion(WGLevel0, false);
						bgunit:SetHasPromotion(WGLevel1, true);
						bgunit:SetBaseCombatStrength(WGLevel1Combat)
						--print ("A War General Level 1 is here!");	
				end				
				if (pTeam:IsHasTech(WGLevel2Prereq)) then
						bgunit:SetHasPromotion(WGLevel1, false);
						bgunit:SetHasPromotion(WGLevel2, true);
						bgunit:SetBaseCombatStrength(WGLevel2Combat)
						--print ("A War General Level 2 is here!");
				end
				if (pTeam:IsHasTech(WGLevel3Prereq)) then		
						bgunit:SetHasPromotion(WGLevel2, false);
						bgunit:SetHasPromotion(WGLevel3, true);
						bgunit:SetBaseCombatStrength(WGLevel3Combat)
						--print ("A War General Level 3 is here!");
				end
				if (pTeam:IsHasTech(WGLevel4Prereq)) then		
						bgunit:SetHasPromotion(WGLevel3, false);
						bgunit:SetHasPromotion(WGLevel4, true);
						bgunit:SetBaseCombatStrength(WGLevel4Combat)
						--print ("A War General Level 4 is here!");
				end
				if (pTeam:IsHasTech(WGLevel5Prereq)) then		
						bgunit:SetHasPromotion(WGLevel4, false);
						bgunit:SetHasPromotion(WGLevel5, true);
						bgunit:SetBaseCombatStrength(WGLevel5Combat)
						--print ("A War General Level 5 is here!");
				end
				if (pTeam:IsHasTech(WGLevel6Prereq)) then		
						bgunit:SetHasPromotion(WGLevel5, false);
						bgunit:SetHasPromotion(WGLevel6, true);
						bgunit:SetBaseCombatStrength(WGLevel6Combat)
						--print ("A War General Level 6 is here!");
				end
				if (pTeam:IsHasTech(WGLevel7Prereq)) then		
						bgunit:SetHasPromotion(WGLevel6, false);
						bgunit:SetHasPromotion(WGLevel7, true);
						bgunit:SetBaseCombatStrength(WGLevel7Combat)
						--print ("A War General Level 7 is here!");
				end
				if (pTeam:IsHasTech(WGLevel8Prereq)) then		
						bgunit:SetHasPromotion(WGLevel7, false);
						bgunit:SetHasPromotion(WGLevel8, true);
						bgunit:SetBaseCombatStrength(WGLevel8Combat)
						--print ("A War General Level 8 is here!");
				end
				if (pTeam:IsHasTech(WGLevel9Prereq)) then		
						bgunit:SetHasPromotion(WGLevel8, false);
						bgunit:SetHasPromotion(WGLevel9, true);
						bgunit:SetBaseCombatStrength(WGLevel9Combat)
						--print ("A War General Level 9 is here!");
				end
			end
		end
	end
	end
end
Events.SerialEventUnitCreated.Add(WarGeneral);
GameEvents.PlayerAdoptPolicy.Add(WarGeneral);
GameEvents.PlayerDoTurn.Add(WarGeneral);


I've replicated what he has, however, the unit I'd like to use it for is a ranged unit. I'd like to know what needs to be modified so as to change the ranged combat as well as the base combat. I already have the following:


Spoiler :
Code:
local SSenshiPromotion = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT"].ID
local SSCombatLevel0 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_0"].ID
local SSCombatLevel1 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_1"].ID
local SSCombatLevel2 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_2"].ID
local SSCombatLevel3 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_3"].ID
local SSCombatLevel4 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_4"].ID
local SSCombatLevel5 = GameInfo.UnitPromotions["PROMOTION_SAILOR_SENSHI_COMBAT_5"].ID

local SSCombatLevel1Prereq = GameInfo.Technologies["TECH_CONSTRUCTION"].ID
local SSCombatLevel2Prereq = GameInfo.Technologies["TECH_MACHINERY"].ID
local SSCombatLevel3Prereq = GameInfo.Technologies["TECH_CHEMISTRY"].ID
local SSCombatLevel4Prereq = GameInfo.Technologies["TECH_DYNAMITE"].ID
local SSCombatLevel5Prereq = GameInfo.Technologies["TECH_ROCKETRY"].ID

local SSCombatLevel0Combat = 6
local SSCombatLevel1Combat = 8
local SSCombatLevel2Combat = 14
local SSCombatLevel3Combat = 15
local SSCombatLevel4Combat = 22
local SSCombatLevel5Combat = 48

local SSRangedCombatLevel0Combat = 8
local SSRangedCombatLevel1Combat = 12
local SSRangedCombatLevel2Combat = 19
local SSRangedCombatLevel3Combat = 22
local SSRangedCombatLevel4Combat = 35
local SSRangedCombatLevel5Combat = 70


function SailorSenshiCombat(iPlayer)
	for _, pPlayer in pairs(Players) do
	local teamID = pPlayer:GetTeam();
	local pTeam = Teams[teamID];
	if (pPlayer:IsAlive()) then
		for bgunit in pPlayer:Units() do
			if (bgunit:IsHasPromotion(SSenshiPromotion)) then
				bgunit:SetHasPromotion(SSCombatLevel0, true);
				bgunit:SetBaseCombatStrength(SSCombatLevel0Combat)
				if (pTeam:IsHasTech(SSCombatLevel1Prereq)) then
						bgunit:SetHasPromotion(SSCombatLevel0, false);
						bgunit:SetHasPromotion(SSCombatLevel1, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel1Combat)
						--print ("SailorSenshi Level 1 is here!");	
				end				
				if (pTeam:IsHasTech(SSCombatLevel2Prereq)) then
						bgunit:SetHasPromotion(SSCombatLevel1, false);
						bgunit:SetHasPromotion(SSCombatLevel2, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel2Combat)
						--print ("Sailor Senshi Level 2 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel3Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel2, false);
						bgunit:SetHasPromotion(SSCombatLevel3, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel3Combat)
						--print ("Sailor Senshi Level 3 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel4Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel3, false);
						bgunit:SetHasPromotion(SSCombatLevel4, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel4Combat)
						--print ("Sailor Senshi Level 4 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel5Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel4, false);
						bgunit:SetHasPromotion(SSCombatLevel5, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel5Combat)
						--print ("Sailor Senshi Level 5 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel6Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel5, false);
						bgunit:SetHasPromotion(SSCombatLevel6, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel6Combat)
						--print ("Sailor Senshi Level 6 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel7Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel6, false);
						bgunit:SetHasPromotion(SSCombatLevel7, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel7Combat)
						--print ("Sailor Senshi Level 7 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel8Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel7, false);
						bgunit:SetHasPromotion(SSCombatLevel8, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel8Combat)
						--print ("Sailor Senshi Level 8 is here!");
				end
				if (pTeam:IsHasTech(SSCombatLevel9Prereq)) then		
						bgunit:SetHasPromotion(SSCombatLevel8, false);
						bgunit:SetHasPromotion(SSCombatLevel9, true);
						bgunit:SetBaseCombatStrength(SSCombatLevel9Combat)
						--print ("Sailor Senshi Level 9 is here!");
				end
			end
		end
	end
	end
end
Events.SerialEventUnitCreated.Add(SailorSenshi);
GameEvents.PlayerAdoptPolicy.Add(SailorSenshi);
GameEvents.PlayerDoTurn.Add(SailorSenshi);

Thanks in advance to anyone who can offer help on this.
 
Unless you're using a modded DLL, there is no equivalent of SetBaseCombatStrength() for ranged combat ... so you'll need to take a different approach. Either by having X units and swapping one out for the next when they "level up" or by working out the percentage bonus needed for one level relative to the next and assigning promotions as appropriate
 
Unless you're using a modded DLL, there is no equivalent of SetBaseCombatStrength() for ranged combat ... so you'll need to take a different approach. Either by having X units and swapping one out for the next when they "level up" or by working out the percentage bonus needed for one level relative to the next and assigning promotions as appropriate


The percentage one sounds like it would be best, as it wouldn't screw up the tech tree or the unique components for the civ. Any advice on how to do that?
 
Also, as a general note for future reference, these are all equivalent to each other:
  1. Code:
    local WGLevel0 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_0"].ID
  2. Code:
    local WGLevel0 = GameInfoTypes["PROMOTION_WAR_GENERAL_0"]
  3. Code:
    local WGLevel0 = GameInfoTypes.PROMOTION_WAR_GENERAL_0
I don't remember if there is an actual access-speed benefit that makes the code more efficient one way or the other, but the third method is certainly easier to write. Doesn't make much difference for the "writing" part when using someone else's code as a template, but when adding stuff that 'template' did not have, it is sure easier to make less with the typing.

GameInfoTypes.XXXX and GameInfoTypes["XXXX"] will work for any game-table that has <Type> and <ID> as columns, but will not work for game-tables that do not use those two columns.

----------------------------------------------------------------------------------------------------------------------------------------------------

If original ranged combat "power" was "10", and the 1st level-up changed it to "11", that would be the same as a promotion that gave 10% additional strength.
So if we use the Accuracy 1 promotion as a guide, but substituting the column RangedAttackModifier where Accuracy 1 uses OpenRangedAttackMod:
Code:
<Row>
	<Type>PROMOTION_ACCURACY_1</Type>
	<Description>TXT_KEY_PROMOTION_ACCURACY_1</Description>
	<Help>TXT_KEY_PROMOTION_ACCURACY_1_HELP</Help>
	<Sound>AS2D_IF_LEVELUP</Sound>
	<OrderPriority>1</OrderPriority>
	<OpenRangedAttackMod>[color="blue"]15[/color]</OpenRangedAttackMod>
	<PortraitIndex>0</PortraitIndex>
	<IconAtlas>PROMOTION_ATLAS</IconAtlas>
	<PediaType>PEDIA_RANGED</PediaType>
	<PediaEntry>TXT_KEY_PROMOTION_ACCURACY_1</PediaEntry>
</Row>
We would want:
Code:
<Row>
	<Type>PROMOTION_10PERCENT_RANGE</Type>
	<Description>TXT_KEY_PROMOTION_10PERCENT_RANGE</Description>
	<Help>TXT_KEY_PROMOTION_10PERCENT_RANGE_HELP</Help>
	<Sound>AS2D_IF_LEVELUP</Sound>
	<OrderPriority>1</OrderPriority>
	<RangedAttackModifier>[color="blue"]10[/color]</RangedAttackModifier>
	<PortraitIndex>0</PortraitIndex>
	<IconAtlas>PROMOTION_ATLAS</IconAtlas>
	<PediaType>PEDIA_RANGED</PediaType>
	<PediaEntry>TXT_KEY_PROMOTION_10PERCENT_RANGE</PediaEntry>
</Row>
And in the lua, we'd have this to grab the promotion's ID#:
Code:
local iRangedExtra10 = GameInfoTypes.PROMOTION_10PERCENT_RANGE
and in the function that levels-up the ranged units, we'd have something like:
Code:
if (pTeam:IsHasTech(SSCombatLevel1Prereq)) then
	bgunit:SetHasPromotion(iRangedExtra10, true);
	--print ("SailorSenshi Level 1 is here!");	
end
Note I haven't tried to completely analyze Leugi's or your code as yet, so I might not be understanding the conditions that are going on within that code for when to add strength to a unit.
 
Also, as a general note for future reference, these are all equivalent to each other:
  1. Code:
    local WGLevel0 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_0"].ID
  2. Code:
    local WGLevel0 = GameInfoTypes["PROMOTION_WAR_GENERAL_0"]
  3. Code:
    local WGLevel0 = GameInfoTypes.PROMOTION_WAR_GENERAL_0
I don't remember if there is an actual access-speed benefit that makes the code more efficient one way or the other, but the third method is certainly easier to write. Doesn't make much difference for the "writing" part when using someone else's code as a template, but when adding stuff that 'template' did not have, it is sure easier to make less with the typing.

GameInfoTypes.XXXX and GameInfoTypes["XXXX"] will work for any game-table that has <Type> and <ID> as columns, but will not work for game-tables that do not use those two columns.

That is certainly handy knowledge for whenever I get proficient enough with Lua to start writing my own. Thanks, I'll definitely have to remember that.
 
Would including <RangedAttackModifier> within the XML file for each of the promotion levels work? Does that affect only units that have this promotion, or is it something like the great general promotion, and affects nearby units?
 
That is certainly handy knowledge ...

See also

You're already adding promotions per level, so just roll the bonuses into those

base = 8, level 1 = 12, that's a 50% increase, so you'll need to give the (4 IIRC) promotions that increase ranged strength (offense and defence for both flat and hilly land)
 
Would including <RangedAttackModifier> within the XML file for each of the promotion levels work? Does that affect only units that have this promotion, or is it something like the great general promotion, and affects nearby units?
See my edit to my previous. The three columns RangedAttackModifier, OpenRangedAttackMod, and RoughRangedAttackMod only affect the ranged unit they are given to, and effect the combat power of the unit when attacking. The Accuracy and Barrage promotion lines only affect when the units attack and have no effect when they defend.
 
Also, as a general note for future reference, these are all equivalent to each other:
  1. Code:
    local WGLevel0 = GameInfo.UnitPromotions["PROMOTION_WAR_GENERAL_0"].ID
  2. Code:
    local WGLevel0 = GameInfoTypes["PROMOTION_WAR_GENERAL_0"]
  3. Code:
    local WGLevel0 = GameInfoTypes.PROMOTION_WAR_GENERAL_0
I don't remember if there is an actual access-speed benefit that makes the code more efficient one way or the other, but the third method is certainly easier to write. Doesn't make much difference for the "writing" part when using someone else's code as a template, but when adding stuff that 'template' did not have, it is sure easier to make less with the typing.

GameInfoTypes.XXXX and GameInfoTypes["XXXX"] will work for any game-table that has <Type> and <ID> as columns, but will not work for game-tables that do not use those two columns.

----------------------------------------------------------------------------------------------------------------------------------------------------

If original ranged combat "power" was "10", and the 1st level-up changed it to "11", that would be the same as a promotion that gave 10% additional strength.
So if we use the Accuracy 1 promotion as a guide, but substituting the column RangedAttackModifier where Accuracy 1 uses OpenRangedAttackMod:
Code:
<Row>
	<Type>PROMOTION_ACCURACY_1</Type>
	<Description>TXT_KEY_PROMOTION_ACCURACY_1</Description>
	<Help>TXT_KEY_PROMOTION_ACCURACY_1_HELP</Help>
	<Sound>AS2D_IF_LEVELUP</Sound>
	<OrderPriority>1</OrderPriority>
	<OpenRangedAttackMod>[color="blue"]15[/color]</OpenRangedAttackMod>
	<PortraitIndex>0</PortraitIndex>
	<IconAtlas>PROMOTION_ATLAS</IconAtlas>
	<PediaType>PEDIA_RANGED</PediaType>
	<PediaEntry>TXT_KEY_PROMOTION_ACCURACY_1</PediaEntry>
</Row>
We would want:
Code:
<Row>
	<Type>PROMOTION_10PERCENT_RANGE</Type>
	<Description>TXT_KEY_PROMOTION_10PERCENT_RANGE</Description>
	<Help>TXT_KEY_PROMOTION_10PERCENT_RANGE_HELP</Help>
	<Sound>AS2D_IF_LEVELUP</Sound>
	<OrderPriority>1</OrderPriority>
	<RangedAttackModifier>[color="blue"]10[/color]</RangedAttackModifier>
	<PortraitIndex>0</PortraitIndex>
	<IconAtlas>PROMOTION_ATLAS</IconAtlas>
	<PediaType>PEDIA_RANGED</PediaType>
	<PediaEntry>TXT_KEY_PROMOTION_10PERCENT_RANGE</PediaEntry>
</Row>
And in the lua, we'd have this to grab the promotion's ID#:
Code:
local iRangedExtra10 = GameInfoTypes.PROMOTION_10PERCENT_RANGE
and in the function that levels-up the ranged units, we'd have something like:
Code:
if (pTeam:IsHasTech(SSCombatLevel1Prereq)) then
	bgunit:SetHasPromotion(iRangedExtra10, true);
	--print ("SailorSenshi Level 1 is here!");	
end
Note I haven't tried to completely analyze Leugi's or your code as yet, so I might not be understanding the conditions that are going on within that code for when to add strength to a unit.

Alright, I finally managed to test it out, however the units don't seem to be upgrading whenever the required tech is research.

Also, now that I've resolved an issue I was having earlier, where spawning in the UU caused my game to crash, I've finally gotten around to testing something you were helping me with here, which was meant to allow the UU to capture 100% of barbarians it killed, and 25% of AI enemy units. It's not capturing anything I've tested it on; barbarians or enemy units.

Error logging is picking up this:

[101398.484] Syntax Error: C:\Users\DrAppleJuice\Documents\My Games\Sid Meier's Civilization 5\MODS\Sailor Moon's Moon Kingdom (v 1)\Lua/SailorSenshiCapture.lua:25: unfinished string near '")'
[101398.484] Runtime Error: Error loading C:\Users\DrAppleJuice\Documents\My Games\Sid Meier's Civilization 5\MODS\Sailor Moon's Moon Kingdom (v 1)\Lua/SailorSenshiCapture.lua.

But I don't know how helpful that is, considering how many brackets and quotation marks there are in most Lua files (that I've seen), the one referenced included.

This is the mod:
http://www.mediafire.com/download/xlb68nh9p6q6xsm/Sailor_Moon's_Moon_Kingdom_(v_1).rar
There are a lot more moving parts in this than I'm used to, and I may have bitten off more than I can chew.
 
change:
Code:
local Message = "In function KeepCapturedUnits: Unit's Original Owner was " .. iOriginalOwner")
to this:
Code:
local Message = "In function KeepCapturedUnits: Unit's Original Owner was " .. iOriginalOwner
and change this:
Code:
local Message = "A Captured Unit whose original player owner # was " .. iOriginalOwner .. " has been removed from play")
to this:
Code:
local Message = "A Captured Unit whose original player owner # was " .. iOriginalOwner .. " has been removed from play"


-----------------------------------------------------------------------------------------------

I didn't realize you were going to apply the <CaptureDefeatedEnemy> in a promotion given to a ranged unit. As I recall, ranged units never capture anybody.
 
I didn't realize you were going to apply the <CaptureDefeatedEnemy> in a promotion given to a ranged unit. As I recall, ranged units never capture anybody.

Ah, damn. Well, in that case, since it's a Great General replacement, is there a way to make it so that units buffed by that unit's leadership also receive the <CaptureDefeatedEnemy> promotion?
 
Ah, damn. Well, in that case, since it's a Great General replacement, is there a way to make it so that units buffed by that unit's leadership also receive the <CaptureDefeatedEnemy> promotion?
  • Probably the best solution is to attach Promotion_X to units of melee, mounted, gunpowder, armor, recon combat-types when they start their turn 'near' the great general. Processing to give or take away the promotion is done during "NEXT TURN" processing, and any 'bog-down' from running the code is much less apparent to the player than the other method that would be possible to use.
    • I used this method in my Scipio mod, but you wouldn't be able to use the code directly as a template because I was also sorting which GG Replacer Unit had which 'ability-level' and whether it was the correct unit to use for giving a promotion to a nearby combat unit.
    • The great general replacement unit needs to have a promotion that contains
      Code:
      <GreatGeneral>true</GreatGeneral>
      because then it is possible in the needeed lua to use
      Code:
      Unit:IsNearGreatGeneral()
      to streamline the code quite a bit. Plus you need that to allow the unit to act as a Great General.
  • It is possible via GameEvents.UnitSetXY(PlayerID player, UnitID unit, int x, int y) to add or take away Promotion_X in real time as the units move into and out of the Great General's influence radius, but the problem is that GameEvents.UnitSetXY(PlayerID player, UnitID unit, int x, int y) can be a real processing hog because it fires whenever a unit moves, for any unit, and for every move the unit makes. Late-game this can be a real bog-down.
 
Back
Top Bottom