The 3rd Age

BFME II: Deluxe Edition

BFME II: Deluxe Edition

Fixing problems with BFME 2 and giving it more depth.

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
Recently I was working on my mod and I needed to make a unit dependent on multiple upgrades. In other words, I wanted to be able to prevent the user from purchasing the unit unless both conditions were met. I tried various ways to achieve this without success, and eventually found out how to do it. There may be a much simpler way of doing this; if so, let me know. However, the method I am about to show you only works of one of the upgrades you need is a rank upgrade (Upgrade_StructureLevel2, Upgrade_StructureLevel3, etc.), but as far as I know it will work on heroes, units and buildings.

This tutorial assumes you have a working knowledge of INI files, CommandButtons, and CommandSets.

Table of Contents
Page 1: Introduction (This Page)
Page 2: Editing the CommandButton
Page 3: Adding a fake CommandButton
Page 4: CommandSet editing
Page 5: CommandSet update behavior

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."

 
9:28:13