Change Improvement build option with lua

SonofHades

Chieftain
Joined
Sep 17, 2010
Messages
29
I want to prevent a worker unit to build a specific Improvement next to the same Improvement.
Has someone an idea how to do that?
 
Unlike the city production queue, there are no Lua hooks to facilitate this, so you'll need to re-write bits of UnitPanel.lua, specifically one or both of the bits that disable available actions

Code:
-- test w/o visible flag (ie can train right now)
if not Game.CanHandleAction( iAction ) then
  bDisabled = true;
  instance.UnitActionButton:SetAlpha( 0.4 );                
  instance.UnitActionButton:SetDisabled( true );                
else
  instance.UnitActionButton:SetAlpha( 1.0 );
  instance.UnitActionButton:SetDisabled( false );                
end

and

Code:
-- Not able to perform action
if not Game.CanHandleAction( iAction ) then
  bDisabled = true;
end
 
Back
Top Bottom