• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Techtree-system: Adding Knowledge

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
Finally I have reached the stage on my map where I can add a techtree system I have come up with. But I can not create the system by myself, so I shall describe it here in this post to let you hear what you think about it.



The resource lumber is renamed into Knowledge and it's icon replaced by a spellbook. The upper-bar now indicates Gold and Knowledge.

A player can build a building called Library.
When a Library is constructed 1 Knowledge (lumber) is added to your storage.
When a Library is destroyed 1 Knowledge is removed.

Knowledge is used as a techtree requierment.

For example, a Knight requires 3 Knowledge to be able to be built.
It does not cost 3 Knowledge to train the Knight, it just requires you to have 3 Knowledge to be able to train the unit.

When you have 3 Knowledge (3 Lumber) in your storage a dummy unit is created at a hidden spot on the map. That unit is simply called 3 Knowledge and it is the real techtree requirement for the Knight.

This means, if a player can have a maximum of 5 Knowledge, then 5 different dummy units named Knowledge 1 - 5 must be created.
This also means that when you lose 1 Knowledge due to a Library is destroyed, then the appropriate Knowledge dummy-unit must be removed.



An other example, just to make it all clear: (You can skip this if you want to)

A Riflemen requires 2 Knowledge and a Knight requires 3 Knowledge.
I have two Knowledge so I can train Riflemen.
I construct my third Library and 1 Knowledge is added to my storage, giving me a total of 3 Knowledge. Two dummy-units have already been created (1 Knowledge and 2 Knowledge) but now as my third Library is finished a third dummy unit is created, called 3 Knowledge.
The 3 Knowledge enables me to train Knights. Later in the game, I lose 1 Library and therefore I only have 2 Knowledge. The 3 Knowledge-Dummy-Unit is removed and I can no longer train Knights until I build a new Library.



The basic reason for this system is that players shall be able to interrupt each other tech by attacking and reducing each other Librarys.



Can this system be created with triggers?
 
Level 8
Joined
Nov 9, 2008
Messages
502
Hmm, yes although you don't need triggers to specify training requirements. You can use the dummy unit as the requirement for each level. Once the correct dummy is created the unit requiring that dummy will be trainable and the reverse when it is removed.

In the unit editor find the field 'Techtree - Requirements' and select the respective dummy for each unit. When a library is destroyed -1 lumber and remove the respective dummy through a trigger e.g.



  • Remove lumber and dummy of type x
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Library
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current lumber) Equal to 1
        • Then - Actions
          • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) - 1)
          • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Dummy 1) and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Triggering unit)) Current lumber) Equal to 2
            • Then - Actions
              • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) - 1)
              • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Dummy 2) and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • -------- Players lumber = 3 (add more if/then/else depending on "limit of knowledge") --------
              • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) - 1)
              • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of Dummy 3) and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
To add lumber and dummy just copy and reverse the actions (add instead of subtract lumber, create dummy instead of remove etc.). Correct the 'if players lumber = x' and change the event and condition to ...

  • Create lumber and Dummy of type x
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Library
    • Actions
      • -------- So on and so forth... --------
P.S. I don't know if those unit groups create leaks nor do I know if this is the best way to do it :grin:
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
As far as I know, a unit's build requirements are either a unit or an upgrade.

That trigger is pretty simple, just looks lengthy because of the lumber being a variable. It doesn't use any global variables and it's mostly copied lines with a unit or value changed. It will work for you if you choose to use it.
 
Level 10
Joined
Nov 5, 2008
Messages
536
I gave the triggering a try, building the triggers by your instructions. But it's to hard for me. I am really not good at triggering.

I'm wondering if you or someone at this site can make the trigger for me if I upload my map here?

I can tell more about my project if anyone wonders why this system is so important and what my map is all about etc, because at a first look my map may look a little empty. The basic concept is that it is a remake of a custom map I created a few years ago, who was really fun and compative to play among my friends. Now we wanna bring it back to life again, but with some better functions :)
 
Level 10
Joined
Nov 5, 2008
Messages
536
Here is the map.



Just some info:

It's gonna be a kind of custom race map, this means that there will be 3 playable races, Orc, NightElf and Human, each one will build their own Library-type of building.

If it is not to much work, a maximum of 4 Librarys per race would be great.

There is already a DummyFootman in the Human-category, created for a ressurection-spell. So you don't use the same dummyunit twice :)



It's very nice of you to help me with this.
 

Attachments

  • WCB2FixingTriggersAndGameData.w3x
    2.6 MB · Views: 72
Level 8
Joined
Nov 9, 2008
Messages
502
Here you go. Have a look at the triggers and read the comments in the section above them.

If there is a problem just message me.
 

Attachments

  • WCB2FixingTriggersAndGameDataEDIT.w3x
    2.6 MB · Views: 52
Status
Not open for further replies.
Top