Adding Unit Ability or Player Power Buttons

Tutorial for Command & Conquer 3 C&C3

Avatar of Mastermind

Mastermind

Category: Code
Level: Intermediate
Created: Friday August 31, 2007 - 11:26
Updated: Friday August 31, 2007 - 11:33
Views: 5511
Summary: The steps to propely add a new Ability button for a unit, or a new Power button for a player.
Rating
  • Staff-
  • Members-
  • Average-

0 votes

There has been some confusion over adding new Unit Ability (upgrades, or other powers) or Player Power (support powers on the left hand side of the screen) buttons. The process is fairly straightforward, but with a couple of gotchas.

First, if you are adding a new button, but wish to include all of the existing buttons (as most non-TC mods would be) make sure that you grab a copy of either UnitAbilityButtonTemplates.xml or PlayerPowerButtonTemplates.xml from the CnC3Xml folder in your Mod SDK installation. Copy this file into your mod data directory and add it to your Mod.xml file.

After you have copied the file over, you can add your new buttons. Use the existing buttons in either file as a template. Once you have added your new buttons, there is one final step to complete. You must rename your store. An example of the change required for both files are below.
PlayerPowerButtonTemplates.xml Before
              
Code
<PlayerPowerButtonTemplateStore
        id="PlayerPowerButtonTemplateStore">

PlayerPowerButtonTemplates.xml After
              
Code
<PlayerPowerButtonTemplateStore
        id="PlayerPowerButtonTemplateStoreCustom">

UnitAbilityButtonTemplates.xml Before
              
Code
<UnitAbilityButtonTemplateStore
        id="UnitAbilityButtonTemplateStore">

UnitAbilityButtonTemplates.xml After
              
Code
<UnitAbilityButtonTemplateStore
        id="UnitAbilityButtonTemplateStoreCustom">

Note that you can choose whatever id you'd like for your new stores, appending custom is just an easy way to make sure it's unique.

Hopefully this should clear up how to go about adding new Unit Ability and Player Power buttons.

Return to top