The 3rd Age

The Elven LegacY MoD

The Elven LegacY MoD

This mod for bfme 1 Mod based on Elvestar 5.5

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

CommandButtons dependent on multiple upgrades

This tutorial is currently hidden from the public.

Tutorial for Battle for Middle-earth BFME, Battle for Middle-earth II BFME 2, Battle for Middle-earth II: Rise of the Witch-king ROTWK

Avatar of {AE}Manveru

{AE}Manveru

Category: Code
Level: Intermediate
Created: Sunday February 21, 2010 - 16:21
Updated: Friday August 27, 2010 - 19:15
Views: 802
Summary: A way to add multiple dependencies for a commandbutton if one of them is a required level.

Rating

Staff says

-

Members say

4.0

Average

4.0/5.0

1 vote

Page 1 2 3 4 5
At this point in the tutorial you have a working CommandButton with two prerequisites. The catch is that the CommandButton doesn't appear until you reach the required level. To fix this, we'll be making a fake CommandButton to display when the structure hasn't reached the required level yet.

First, make a copy of the CommandButton. I'll be calling it Command_ConstructRohanRohirrimHordeFakeButton.

              
Code
CommandButton Command_ConstructRohanRohirrimHordeFakeButton
Command = UNIT_BUILD
Object = RohanRohirrimHorde
Options = CANCELABLE NEED_UPGRADE
NeededUpgrade = Upgrade_RohanHorseLords
RequireLevel = 2
TextLabel = CONTROLBAR:ConstructRohanRohirrimHorde
ButtonImage = BRStables_RohirrimPike
ButtonBorderType = BUILD ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:ToolTipBuildRohanRohirrimHorde
Radial = Yes
InPalantir = Yes
ShowProductionCount = Yes
End

Then, remove the RequireLevel = 2 line and revert the NeededUpgrade = line to the old Upgrade_StructureLevel2. In essence, we just made a copy of the CommandButton and reverted to the original. Since this fake CommandButton is only going to show up when the structure hasn't reached the required level, we don't need to do anything about the other upgrade.

Next: CommandSet editing

Comments

Display order: Newest first

Rob38 (Team Chamber Member) - Friday August 27, 2010 - 19:17

Illuvatar is right. You made it way too complex. ;)

Marioverraeter - Friday July 2, 2010 - 2:59

Ah, I see what you mean. Well, in fact, in the meantime I figured out both this one and another option that add to each other in there use.

The solution you just explained is to simply bypass the actual (upgrade) commandbutton that was meant to have multiple dependencies, and rather just add multiple dependencies to the effects and outcomes the commandbutton should lead to.
While this technically works fine, it has two drawbacks:
1) the player does not get informed about such an upgrade, because it takes effect without being represented by a commandbutton and its tooltip. That means the mod gets less beginner friendly.
2) it is not possible to require an own actual buildcost and buildtime for that upgrade, as it is bypassed. At least, this can't be done without huge efforts and detours.

Fortunately, we therefore found another option to raise multiple dependencies on a commandbutton:
That is, to add a CommandSetUpgrade behavior block to the object.ini of the building whose commandset contains this commandbutton. You just need to add all the prequisite Upgrades into the TriggeredBy line, and add the RequiresAllTriggers line. Once the new commandset is defined, make sure to edit/add both the first(standard) commandset of that building not to contain the button, and the second (switched-to) commandset to contain it. To make it more beginnerfriendly, the button can be added to the first commandset as well, but with the additional Option UNPRESSABLE in its commandbutton block in the commandbutton.ini, so it actually is a FakeButton. In the tooltip of that fake button, all requirements can be explained.

So, I guess this topic should be clear now. Maybe I will post one or two own tutorials regarding this and related topics.

Illuvatar - Wednesday June 9, 2010 - 3:12

Marioverraeter: Well, in the case that I used it, I wanted a unit to reach a certain level as well as purchase a technology from a research building before it could attain a power I wanted it to have (you could think of it as purchasing an upgrade like Forged Blades but having to be level 2 or something). So in the power's unpause behavior block I put two upgrades in the TriggeredBy field: the level upgrade (object_level#) and the technology upgrade. Then you add the line I posted earlier so that it needs both triggers. See what I mean?

Marioverraeter - Sunday May 16, 2010 - 9:01

Interesting. In deed, this is exactly one problem I am bothering with at the time.

The method you present here is okay for only one upgrade + structure level requirement. However, it is not sufficient for commandbuttons dependent on multiple upgrades in general, with more than only one actual upgrade required.

When I was fiddling about with this, it seemed to work on adding NEED_UPGRADE multiple times in the Options line and then adding multiple NeededUpgrade lines. It "seemed" to work... but sometimes, it seemed to fail again. I am not sure about that.

Are there other experiences with this multiple dependencies issue? Would be great.

--------

P.S.: Illuvatar, could you explain this method further? I didn't actually get the point; a unit always has multiple behavior blocks. which one do you mean?

--------

Okay, so far... testing my own approach has resulted in a complete fail. It does not work either. Maybe it seemed to work because the last upgrade I got was randomly the one of those which was taken as *the* needed upgrade, I dont't know.

Anyway, it would be nice if someone has another idea or method to bring this to work. The inability to set dependencies on multiple upgrades just made my whole work of two weeks, an upgrade system for all factions, useless. Help appreciated.

Illuvatar - Sunday April 25, 2010 - 0:06

Uh... to shorten this tutorial up to about two sentences: You only need to put both upgrades in the TriggeredBy field in the behavior block (most likely in the unit ini file). Then just add the following field:

              
Code

RequiresAllTriggers = Yes

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
22:22:24