Replicating TS Component Tower Weapon Logic

Avatar of Nighthawk

Nighthawk

Category: Code
Level: Intermediate
Created: Saturday December 1, 2007 - 15:50
Updated: Saturday July 11, 2009 - 16:29
Views: 4411
Summary: Tutorial on replicating the upgrade weapon logic of the TS Component Tower.
Rating
  • Staff-
  • Members-
  • Average-

0 votes

Page 1 2 3 4 5 6
Creating the CommandButtons / Sets:
Now shift on over to your LogicCommand.xml file. Here we will define the buttons themselves and their function.
              
Code
    <LogicCommand
        Type="OBJECT_UPGRADE"
        id="Command_UpgradeVulcanCannon">
        <Upgrade>Upgrade_VulcanCannon</Upgrade>
    </LogicCommand>


Here is another template for you all to understand.
The OBJECT_UPGRADE is essential - it tells the game we are upgrading this object only. The id must be the same as what you called the Id of your ObjectUpgradeButton. The Upgrade must have the same property as what you called the id of your upgrade itself in NewUpgrades.xml.

Create one for each of your upgrades (i.e. Command_UpgradeRPG and Command_UpgradeSAM as well.)

One last command must be created here - a construction command for your Component Tower. It is basically the same as other Construction commands.
              
Code
    <LogicCommand
        Type="CONSTRUCTION_YARD_CONSTRUCT"
        id="Command_ConstructGDIComponentTower">
        <Object>GDIComponentTower</Object>
    </LogicCommand>



Finally, skip on over to LogicCommandSet.xml. Here we will define the CommandSet of your Component Tower, and define it in the CommandSets for the Construction Yard and/or Crane.

Firstly, since we're using a new file, we need to redefine the CommandSets of the Conyard and/or Crane. If you are not giving the Crane the ability to build defenses (i.e. you are retaining Patch 1.09 behaviour), then ignore the stuff on the Crane's CommandSet.

Here is the Construction Yard's CommandSet:
              
Code
    <LogicCommandSet
        id="GDIConstructionYardCommandSet">
        <Cmd>Command_ConstructGDIPowerPlant</Cmd>
        <Cmd>Command_ConstructGDIRefinery</Cmd>
        <Cmd>Command_ConstructGDIBarracks</Cmd>
        <Cmd>Command_ConstructGDIWarfactory</Cmd>
        <Cmd>Command_ConstructGDICommandPost</Cmd>
        <Cmd>Command_ConstructGDIAirTower</Cmd>
        <Cmd>Command_ConstructGDIMedicalCenter</Cmd>
        <Cmd>Command_ConstructGDIArmory</Cmd>
        <Cmd>Command_ConstructGDISpaceCommandUplink</Cmd>
        <Cmd>Command_ConstructGDIWatchTower</Cmd>
        <Cmd>Command_ConstructGDIGolumCannon</Cmd>
        <Cmd>Command_ConstructGDIAABattery</Cmd>
        <Cmd>Command_ConstructGDITiberiumSilo</Cmd>
        <Cmd>Command_ConstructGDITerraformingStation</Cmd>
        <Cmd>Command_ConstructGDIIonCannonControl</Cmd>
        <Cmd>Command_ConstructGDICrane</Cmd>
        <Cmd>Command_ConstructGDISurveyor</Cmd>
        <Cmd>Command_PackGDIMCV</Cmd>
        <Cmd>Command_SelfRepair</Cmd>
        <Cmd>Command_Sell</Cmd>
    </LogicCommandSet>

Put your Component Tower wherever you want it to appear on the sidebar. You should place it somewhere before Command_PackGDIMCV and after the SpaceCommandUplink command.

If you want to place it in the Crane's CommandSet, here is the pre-1.09 CommandSet (i.e. with defenses):
              
Code
<LogicCommandSet
        id="GDICraneCommandSet">
        <Cmd>Command_ConstructGDIPowerPlant</Cmd>
        <Cmd>Command_ConstructGDIRefinery</Cmd>
        <Cmd>Command_ConstructGDIBarracks</Cmd>
        <Cmd>Command_ConstructGDIWarfactory</Cmd>
        <Cmd>Command_ConstructGDICommandPost</Cmd>
        <Cmd>Command_ConstructGDIAirTower</Cmd>
        <Cmd>Command_ConstructGDIMedicalCenter</Cmd>
        <Cmd>Command_ConstructGDIArmory</Cmd>
        <Cmd>Command_ConstructGDISpaceCommandUplink</Cmd>
        <Cmd>Command_ConstructGDIWatchTower</Cmd>
        <Cmd>Command_ConstructGDIGolumCannon</Cmd>
        <Cmd>Command_ConstructGDIAABattery</Cmd>
        <Cmd>Command_ConstructGDITiberiumSilo</Cmd>
        <Cmd>Command_ConstructGDITerraformingStation</Cmd>
        <Cmd>Command_ConstructGDIIonCannonControl</Cmd>
        <Cmd>Command_TogglePower</Cmd>
        <Cmd>Command_SelfRepair</Cmd>
        <Cmd>Command_Sell</Cmd>
    </LogicCommandSet>


And without defenses:
              
Code
<LogicCommandSet
        id="GDICraneCommandSet">
        <Cmd>Command_ConstructGDIPowerPlant</Cmd>
        <Cmd>Command_ConstructGDIRefinery</Cmd>
        <Cmd>Command_ConstructGDIBarracks</Cmd>
        <Cmd>Command_ConstructGDIWarfactory</Cmd>
        <Cmd>Command_ConstructGDICommandPost</Cmd>
        <Cmd>Command_ConstructGDIAirTower</Cmd>
        <Cmd>Command_ConstructGDIMedicalCenter</Cmd>
        <Cmd>Command_ConstructGDIArmory</Cmd>
        <Cmd>Command_ConstructGDISpaceCommandUplink</Cmd>
        <Cmd>Command_ConstructGDITiberiumSilo</Cmd>
        <Cmd>Command_ConstructGDIIonCannonControl</Cmd>
        <Cmd>Command_TogglePower</Cmd>
        <Cmd>Command_SelfRepair</Cmd>
        <Cmd>Command_Sell</Cmd>
    </LogicCommandSet>


Now, one last pivotal thing, the CommandSet for the Component Tower itself.
              
Code
    <LogicCommandSet
        id="GDIComponentTowerCommandSet">
        <Cmd>Command_UpgradeVulcanCannon</Cmd>
        <Cmd>Command_UpgradeRPG</Cmd>
        <Cmd>Command_UpgradeSAM</Cmd>
        <Cmd>Command_TogglePower</Cmd>
        <Cmd>Command_SelfRepair</Cmd>
        <Cmd>Command_Sell</Cmd>
    </LogicCommandSet>


The first three slots should be your three upgrades, followed by the three standard structure commands.

Return to top