Affiliates:





Want to affiliate with me? Here is my button:


Command Set Switching
A Tutorial by Fingulfin
For “The Battle for Middle Earth II”

In this tutorial you will learn how to create a working Commandset Switch, compatable with BFME II.
I am sorry, but all tabs were removed from code blocks during the conversion to HTML. I am trying as hard as possible to fix it, but with no luck.

KEY:
Anything in a table like this:
CODE:



Is a peice of Code.

KNOWLEDGE NEEDED:
You will need to have a medium level knowledge of coding, including at least an O.K. knowledge of CommandButtons.

TOOLS Needed:
FinalBIG - (If you don't have this, go to http://www.the3rdage.net. This tutorial is a bit advanced for someone new to modding)
Notepad ++ With Color INI – Not Required, but a useful tool.

CREDITS:

Thank you to all the good Folks at T3A who tried to help me get this working, including, but not limited to, Solinx, 2PlayGames, and Cahik_.
Now on to the tutorial!

1: The Files

CommandButton.ini
Commandset.ini
lotr.STR

2: The CommandSet

Open CommandSet.ini, and create your new commandset. It should look along the lines of this:

CODE:

CommandSet MyUnitSet
End


Now we will add all the spots.

CODE:

CommandSet MyUnitSet
; 1 =
; 2 =
; 3 =
; 4 =
; 5 =
; 6 =
; 7 =
; 8 =
; 9 =
; 10 =
; 11 =
; 12 =
; 13 =
; 14 =
; 15 =
; 16 =
; 17 =
; 18 =
; 19 =
; 20 =
; 21 =
; 22 =
; 23 =
; 24 =
; 25 =
; 26 =
; 30 =
End


For Starters, leave everything commented out.

3: More CommandSets

Now is where it starts to get logical :p

CODE:

CommandSet MyUnitSet
//Main Menu
1 = Command_ToggleStance
; 2 =
; 3 =
; 4 =
; 5 =
; 6 =
; 7 =
8 = Command_AttackMove
//Menu 2
; 9 =
; 10 =
; 11 =
; 12 =
; 13 =
; 14 =
; 15 =
16 = Command_AttackMove
//Extras
30 = Command_CaptureBuilding
31 = Command_Stop
End


You will see why it looks like this in a little bit. The Toggle Stance button is there so you can toggle Stances, Capture Building so you can Capture Stuff, Stop for the hell of it, and attack move at the bottom of every menu, so we can attack move no matter what menu we are on (I learned this the hard way ;))

4: The Visible Buttons

Add this at the top of the list, right under the CommandButton name, and Right Under the //Main Menu.
CODE:

InitialVisible = 8


This makes it so only the first 8 buttons are pressable (so our hotkeys don't get confused). This is also the reason for all the attack Moves. Don't worry, we can still capture buildings and stop!

5: The CommandButton

Now we will make 2 Buttons. Do a search for one of the Fortress Menu Switchers (Example: Command_SelectUpgradesMordorFortress) Copy and paste one to the bottom of CommandSet.ini

CODE:

CommandButton Command_SelectUpgradesMordorFortress
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectUpgradesMordorFortress
ButtonImage = UCCommon_UpgradeStructureNew
ButtonBorderType = SYSTEM
DescriptLabel = CONTROLBAR:ToolTipCommandSelectUpgradesMordorFortress
Radial = Yes
CommandRangeStart = 6
CommandRangeCount = 7
End


First, rename it 'Menu2Switcher', and tell it
CODE:

CommandRangeStart = 8
CommandRangeCount = 8


Now amend it to look like this:

CODE:

CommandButton Command_Menu2Switcher
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectUpgradesMordorFortress
ButtonImage = UCCommon_UpgradeStructureNew
ButtonBorderType = SYSTEM
DescriptLabel = CONTROLBAR:ToolTipCommandSelectUpgradesMordorFortress
Radial = No
InPalantir = No
CommandRangeStart = 8
CommandRangeCount = 8
End


Note how I made it so you will not see the button (Radial = No, InPalantir = No). The 'Button Image' does not matter, as this button is invisible!

6: Enter the STR!

Now comes the interesting part: Under 'Text Label' type in CONTROLBAR:SwitchMenu. Then in your STR Type the Following:

CODE:

CONTROLBAR:SwitchMenu
"&M"
End


This makes it so the HotKey for this button is 'M'.

However, the user will have no clue what it is, so we have to find a way to alert them!

7: The ShortCut Button

Make a new button. The Command doesn't matter, as you will not be able to click it. This is what I used:
CODE:

CommandButton Command_Menu2Shortcut
Command = CANCEL_UPGRADE
Options = NONPRESSABLE
TextLabel = CONTROLBAR:Menu2
DescriptLabel = CONTROLBAR:ToolTipMenu2
ButtonImage = UCCommon_EvilHeroes
ButtonBorderType = ACTION
InPalantir = Yes
End

Now a little bit about this button: It is Non-Pressable, which means the command Does not matter, It is 'InPalantir' so you can see it, it has an image (so you can see it :p) ant it has a 'TextLabel' and a 'DescriptLabel'. Now lets go fill those in.

8: More STRs and ComandSets

In your STR make 2 Strings:
CODE:

CONTROLBAR:Menu2
"Go to Second Menu"
End

CONTROLBAR:ToolTipMenu2
"Press 'M' to go to the second menu"
End


Now add these 2 buttons to your commandset. When you are done, it should look like this:
CODE:

CommandSet MyUnitSet
InitialVisible = 8
//Main Menu
1 = Command_ToggleStance
; 2 =
; 3 =
; 4 =
; 5 =
6 = Command_Menu2Shortcut
7 = Command_Menu2Switcher
8 = Command_AttackMove
//Menu 2
; 9 =
; 10 =
; 11 =
; 12 =
; 13 =
; 14 =
; 15 =
16 = Command_AttackMove
//Extras
30 = Command_CaptureBuilding
31 = Command_Stop
End

Notice how the Working Button Is in the '7' Slot. This makes it so you can't see it (in the palantir it would be an invisible slot) but it is still active! The 'Shortcut' IS visible, so the player can hover over it, and be able to see what button to push to activate it.
Our CommandSet will now Switch! But we are not finished yet!
9: How do we get back?

Make another button:
CODE:

CommandButton Command_MainMenuSwitcher
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:GoToMain
; ButtonImage = UCCommon_EvilHeroes
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipGoToMain
Radial = No
InPalantir = No
CommandRangeStart = 0
CommandRangeCount = 8
End

Then Fill in Your STR:
CODE:

CONTROLBAR:GoToMain
"&N"
End


Make yet one more button (another Shortcut) that looks like this:
CODE:

CommandButton Command_MainMenuShortcut
Command = CANCEL_UPGRADE
Options = NONPRESSABLE
TextLabel = CONTROLBAR:MainMenuShortCut
DescriptLabel = CONTROLBAR:ToolTipMainMenuShortCut
ButtonImage = UCCommon_BackArrow
ButtonBorderType = ACTION
InPalantir = Yes
End

And once again, fill in the STR:
CODE:

CONTROLBAR:MainMenuShortCut
"Go to Main Menu"
End
CONTROLBAR:ToolTipMainMenuShortCut
"Press 'N' to go back to the main Menu."
End


Add them to the commandSet and you are done!

10: Finished Work


You should, in total, have made 1 CommandSet, 4 CommandButtons, 6 STR Strings, and 1 Menu Switching System! Your Finished CommandSet should look like this:
CODE:

CommandSet MyUnitSet
InitialVisible = 8
//Main Menu
1 = Command_ToggleStance
; 2 =
; 3 =
; 4 =
; 5 =
6 = Command_Menu2Shortcut
7 = Command_Menu2Switcher
8 = Command_AttackMove
//Menu 2
; 9 =
; 10 =
; 11 =
; 12 =
; 13 =
14 = Command_MainMenuShortcut
15 = Command_MainMenuSwitcher
16 = Command_AttackMove
//Extras
30 = Command_CaptureBuilding
31 = Command_Stop
End

Just add your powers into the commented slots, and you have a hero with a HUGE Arsenal!


If you encounter any errors, go to The 3rd Age Forums and ask a question in the BFME II Modding Forums!

To contact me:
E-mail: ulairemapping@yahoo.com
MSN Messenger: ulairemapping@yahoo.com
PM me on Revora

-Fingulfin
BACK TO TUTORIALS



© 2006 by Fingulfin. All rights reserved. Hosted by: REVORA