Jump to content


Photo

How to make a Switching CommandSet


  • Please log in to reply
11 replies to this topic

#1 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 19 August 2006 - 06:43 PM

Making a Working Switching Commandset (v 1.1)
A Fingulfin Tutorial

First off, 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_.

In this tutorial you will learn how to create a working Commandset Switch, compatable with BFME II.

Now on to the tutorial!

Switching Menu Tutorial

1: The Files

CommandButton.ini
Commandset.ini
lotr.STR

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

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

CommandSet MyUnitSet
End

Now we will add all the spots.

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

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 :dry:)

4: The Visible Buttons
Add this at the top of the list, right under the CommandButton name, and Right Under the //Main Menu.
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

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
CommandRangeStart	= 8
	CommandRangeCount	= 8

Now amend it to look like this:

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:

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:
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 :)) 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:
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:
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:
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:
CONTROLBAR:GoToMain
"&N"
End

Make yet one more button (another Shortcut) that looks like this:
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:
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:
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!

I hope this tutorial was helpful! If you beleive you can help me improve upon it, send me an e-mail at ulairemapping@yahoo.com, a PM on Revora, or simply post in the Topic where you found this!

Thanks in Advance,
-Fingulfin

Solinx: Corrected a numerical typo which led to some confusion.

Edited by Solinx, 23 October 2006 - 06:09 PM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#2 cahik_

cahik_

    Sage engine ruler

  • Project Team
  • 1,896 posts
  • Location:Czech Republic
  • Projects:Rhovanion Alliance
  •  T3A Team Chamber Member and Crazy animator

Posted 19 August 2006 - 09:42 PM

great work, usefull tutor :) i remember that i post something in your topic, didnt think it was usefull through :p

Posted Image

Posted Image
Posted Image


#3 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 19 August 2006 - 10:16 PM

I list anyone who bothers to reply to my topics :mellow:
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#4 Argolis

Argolis

    Big Crazy Modder.

  • Project Team
  • 337 posts
  • Location:London
  • Projects:The Wars of Arda
  •  The modding jack-of-all-trades

Posted 20 August 2006 - 02:11 PM

Im trying to do this on a porter, but whenever I click on the sub-menu buttons on the porter, the game crashes. Not even a gmae.dat, just gone.


[codebox]
CommandSet MenPorterCommandSet
//Gondor Porter Menu
InitialVisible = 8
//Root Menu
1 = Command_Stop
2 = Command_PorterExtinguishFire
3 = Command_SelectMinastirithBuildingsGondorPorter
4 = Command_SelectDolAmrothBuildingsGondorPorter
5 = Command_SelectIthilienBuildingsGondorPorter
6 = Command_SelectFiefdomsBuildingsGondorPorter
7 = Command_SelectDunedainBuildingsGondorPorter
8 = Command_SelectFortificationsGondorPorter


//Minas Tirith Menu
9 = Command_PorterConstructMenFarm
10 = Command_PorterConstructMenBarracks
11 = Command_PorterConstructMenArcheryRange
12 = Command_PorterConstructMenStable
13 = Command_PorterConstructMenWorkshop
14 = Command_PorterConstructMenWell
15 = Command_PorterConstructMenStatue
16 = Command_PorterConstructMenBlacksmith
17 = Command_PorterConstructMenMarketPlace
18 = Command_DozerConstructGondorStoneMaker
19 = Command_PorterConstructMenWell;will be houses of healing when done.

//Dol Amroth Menu
20 = Command_ConstructGondorDolAmrothBarracks

//Ithilien Menu
21 = Command_ConstructGondorForbiddenPool

//Southern Fiefdoms Menu
22 = Command_ConstructGondorFeifdomsBarracks

//Dunedain Menu
23 = Command_ConstructDunedainBarracks

//Fortifications Menu
24 = Command_PorterConstructMenFortress
25 = Command_PorterConstructMenWallHub;regular defensive walls
26 = Command_PorterConstructMenWallHub;Walkable Fortress Walls
27 = Command_PorterConstructMenSentryTower
End
[/codebox]

And heres the actual command buttons.

[codebox]

CommandButton Command_SelectMinastirithBuildingsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectMinastirithBuildingsGondorPorter
ButtonImage = mfMinasTirith
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipCommandSelectMinastirithBuildingsGondorPorter
Radial = Yes
CommandRangeStart = 8
CommandRangeCount = 11
End

CommandButton Command_SelectDolAmrothBuildingsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectDolAmrothBuildingsGondorPorter
ButtonImage = mfDolAmroth
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipCommandSelectDolAmrothBuildingsGondorPorter
Radial = Yes
CommandRangeStart = 19
CommandRangeCount = 1
End

CommandButton Command_SelectIthilienBuildingsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectIthilienBuildingsGondorPorter
ButtonImage = mfIthilien
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipCommandSelectIthilienBuildingsGondorPorter
Radial = Yes
CommandRangeStart = 20
CommandRangeCount = 1
End

CommandButton Command_SelectFiefdomsBuildingsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectFiefdomsBuildingsGondorPorter
ButtonImage = mfFiefdoms
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipSelectFiefdomsBuildingsGondorPorter
Radial = Yes
CommandRangeStart = 21
CommandRangeCount = 1
End

CommandButton Command_SelectDunedainBuildingsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectDunedainBuildingsGondorPorter
ButtonImage = mfDunedain
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipCommandSelectDunedainBuildingsGondorPorter
Radial = Yes
CommandRangeStart = 22
CommandRangeCount = 1
End

CommandButton Command_SelectFortificationsGondorPorter
Command = PUSH_VISIBLE_COMMAND_RANGE
TextLabel = CONTROLBAR:SelectFortificationsGondorPorter
ButtonImage = UCCommon_UpgradeStructureNew
ButtonBorderType = SYSTEM
; DescriptLabel = CONTROLBAR:ToolTipCommandSelectFortificationsGondorPorter
Radial = Yes
CommandRangeStart = 23
CommandRangeCount = 4
End

[/codebox]


Ive discovered a little more. Theres nothing wrong with my code. The porter menu simply cannot handle a commandset switch. I removed the dozer kindof from the porter, and the menu worked fine. But now the porter cant build.

Anyone know a way of making the buidler work without the dozer kind of?

Edited by Argolis, 20 August 2006 - 04:09 PM.

I do not kill with my hand.
He who kills with his hand has forgotten the face of his father.
I kill with my heart.
-The Gunslingers Catechism
Posted Image
NEEDED: Modeller/skinner and 2D artist for Wars of Arda. PM me. Please.

#5 GothmogtheOrc

GothmogtheOrc

    Ruler of the Morgul Vale

  • Hosted
  • 2,263 posts
  • Location:USA
  • Projects:Kings of the West Mod
  •  T3A Chamber Member - Retired

Posted 20 August 2006 - 06:48 PM

Good tutorial. I didn't look at it in depth but it seems to cover all the steps :huh:

Excellent idea for a tutorial. Opens so many doors for newer modders who want to make truely unique mods.

-GothmogtheOrc

Nine%20rings.jpg
Click on my Sig to go to my BFME Modding site where you can download my mods.
KotW%20Morgul%20In-game.jpg
Kings of the West Mod Leader
*Retired. PM me if you need to get a hold of me as I'll get an email notification and should reply within a day or so*


#6 Guest_Ungregistered_*

Guest_Ungregistered_*
  • Guests

Posted 09 October 2006 - 02:12 AM

Hey, great tutorials on this site -- I used the two hero tutorials to resurrect Isildur, and made a Summon Balrog hero power.

I just tried this one, and I'm getting the following error:

"MISSING CONTROLBAR:Menu2"
"MISSING CONTROLBAR:ToolTipMenu2" when I move my mouse over the non-clickable icon. Pressing "M" doesn't switch the commandset.

Is there a particular place in lotr.str the 6 strings need to go? From my survey of the file, it looks like things are pretty much placed anywhere -- I tried placing all 6 strings before the first and after the last CONTROLBAR in the file.

I'm using BFME II version 1.04, and used the FinalBig editor to extract, edit, and recompile lotr.str from englishpatch103.big.

Thoughts?

#7 Guest_Unregistered_*

Guest_Unregistered_*
  • Guests

Posted 23 October 2006 - 04:48 PM

Well, I got it working, sort of. I changed around the button settings to be In-Palantir and pressable. Now, it gets interesting in two places:

1) By making things in palintir-I can get to the second set of commands not by pressing "M", but "U". This has got to be because the switcher button is based on the fortress upgrades
2) The range of commandsets in the second set is from 8 to 13 instead of 9 to 14. This means I get the Attackmove from the first set, then the other buttons, and not the button to switch back. I've tried messing with the ranges, but no luck. What this means is the only way to switch back to the first commandset is to click on somebody else, then back on the hero.

Oh well, works for me. Thoroughly enjoying my one-man hero armies. . . .

#8 Solinx

Solinx

    .

  • Undead
  • 3,101 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 23 October 2006 - 06:06 PM

2) A small error on Fingulfin's side. It should be 8 8

The first number is the first button of the part of the menu you want to show, minus one.
In this case, your visible menu will start at 9, so 9 - 1 = 8 will be the number you need to put in CommandRangeStart

The second number states the amount of commandbuttons you want to have visible. You want to show button 9 to 16, that are 8 buttons, so for CommandRangeCount you will have to enter 8 too.

Edit:
1) Another small mixup from Fingulfin. He put the M shortcut on the nonpressable button that has no further use. For the shortcut letters to work, the strings with only the letters should be linked to the switcher buttons. For the two nonpressable buttons there should be another description added.

Solinx

Edited by Solinx, 23 October 2006 - 06:15 PM.

Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#9 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 23 October 2006 - 09:42 PM

Oops :lol: Its just odd, cause I used the EXACT same code and got it working just fine... Anywho, glad to see that my tutorial has helped someone ^_^
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#10 Solinx

Solinx

    .

  • Undead
  • 3,101 posts
  • Location:The Netherlands
  • Projects:Real Life
  • Division:Revora
  • Job:Retired Leader / Manager

Posted 23 October 2006 - 09:50 PM

Oops :lol: Its just odd, cause I used the EXACT same code and got it working just fine... Anywho, glad to see that my tutorial has helped someone :)

Odd indeed ^_^
It's always nice to see your work being appreciated :)

Solinx
Posted Image

"An expert is a man who has made all the mistakes which can be made in a very narrow field." - Niels Bohr


#11 Guest_I'll register one of these d_*

Guest_I'll register one of these d_*
  • Guests

Posted 10 November 2006 - 06:11 PM

Hey thanks guys, work's been a little busy and I haven't tried Solinx's suggestions yet. Appriciate the help, though.

#12 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 10 November 2006 - 09:10 PM

Ive put up a bug free version of this tutorial on my hosted website, located at:
http://fingulfin.the3rdage.net
The tutorial is here: [url="http://"http://fingulfin.the3rdage.net/tutorials/commandsetswitch.html"]Switching CommandSets[/url]
Posted Image
--------------------------------------
"You look like a ghost of your former self..."




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users