1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Lumber/Food Clock

Discussion in 'Trigger (GUI) Editor Tutorials' started by Arowanna, Oct 25, 2009.

  1. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Instructions
    This tutorial shows you how to create two different clocks.
    The first one is based on Lumber and Food and the second one is based on Food.

    Requirements
    • Warcraft 3 The Frozen Throne - World Editor
    • A small knowledge of how to "Trigger" in the Trigger Editor


    Lumber/Food Clock Function
    This Clock works like the clock in DotA.
    Every second the player will gain 1 Food, representing 1 second and
    each 60 second, they will be removed and replaced with 1 Lumber, representing 1 minute.

    Disadvantages:
    - Can’t use Lumber or Food in your map
    - All units must have 0 Lumber- and Food cost.

    Difficulty
    Easy


    Food Clock Function
    Every second the player will gain 1 Max Capability, representing 1 second and each
    60 second, they will be removed and replaced with 1 Used Food, representing 1 minute.

    Advantages:
    - You can use Lumber without a problem
    Disadvantages:
    - Can’t use Food in your map
    - All units must have 0 Food cost.

    Difficulty
    Easy


    Lumber/Food Clock
    Now when we have an idea, let’s get started.
    Create a new Category and a new Trigger, name it “Clock”.

    Lumber/Food Clock Triggers
    Step I
    First we need an Event, which is repeated every second of the game.
    So let’s create a “Time – Periodic Event” that is repeated every second.
    • Time - Every 1.00 seconds of game time

    How to
    Press the button “New Event (CTRL+E)”.
    Find the Trigger “Time – Time Elapsed”.
    This text will be shown:
    ”Elapsed game time is 5:00 seconds”, change 5:00 to 1:00.

    Trigger Explanation:
    This Event, is triggered every second that passes by.


    Step II
    Now when we have an Event, we must choose who’s going to be affected by the Event.
    And we want everyone to “gain” 1 second in their Food Section. So create a
    ”Player Group - Pick every player in Player Group and do Multiple Actions” action.
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions

    How to
    Press the button “New Action (CTRL+R)”.
    Find the action “Player Group - Pick every player in Player Group and do Multiple Actions”
    This text will be shown:
    ”Pick every player in (All Players) and do Multiple Actions”
    Change nothing.

    Trigger Explanation:
    This action picks All Players and performs the following actions.


    Step III
    Now we have a loop that will be repeated each second of the game.
    We need an If/Then/Else action to check if we got more or less than
    59 Seconds in our stock, so create a If/Else/Then action.
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else – Actions

    How to
    Press the button “Action (CTRL+R)”.
    Find the action “If / Then / Else, Multiple Actions”.
    This text will be shown:
    ”If (All Conditions are True) then do (Then Actions) else do (Else Actions)

    Trigger Explanation:
    This action speaks for it self.
    If the Conditions are true, then the Then Actions will run, and
    if the Conditions are false, it will run the Else Actions.


    Step IV
    Now we need a Condition that checks if we got more
    or less than 59 seconds in stock. So create a Integer Comparison.
    • ((Picked player) Food used) Equal to 59

    How to
    Press the button “New Condition (CTRL+D)”.
    Find the Condition called: Interger Comparison.
    This text will be shown:
    (Number of units in (Units in (Playable map area))) Equal to 0
    Change “Number of Units in (Units in (Playable Map Area)))” into “Player – Player Property”.
    From there, change Player 1 (Red) into the Function “Picked Player”.
    Change “Current Gold” into “Food Used”.
    Let Equal to stay.
    Change the value “0” into”59”.

    Trigger Explanation:
    This trigger checks if Picker Player (All Players) uses 59 Food or not.
    If it’s true, then it will activate the “Then Actions” in the If / Then / Else actions,
    but if it’s false, it will activate the “Else Actions”.


    Step V
    Now we have a Condition that checks if we have 59 Seconds,
    but we need some Actions so something really happens.

    We want the Trigger to either add 1 Seconds or to remove the current
    seconds and replace it with 1 Minute. So let’s create some Then – Actions.
    Side Note
    Then = when the Condition is true
    • Then - Actions
      • Player - Set (Picked player) Food used to 0
      • Player - Add 1 to (Picked player) Current lumber

    Now the Trigger will remove the current Food and add one
    Lumber to the Lumber Stock, but only if the Condition is true.
    How to
    First Trigger:
    Press the button “New Action (CTRL+R)”.
    Find the action ”Player – Set Property”
    This text will be shown:
    ”Player - Set Player 1 (Red) Current gold to 750”
    Change “Player 1 (Red)” into “Picked Player”
    Change “Current Gold” into “Food used”
    Change the value “750” into “0”
    Now it should look like this:
    Player - Set (Picked player) Food used to 0

    Second Trigger:
    Press the button “New Action (CTRL+R)”.
    Find “Player – Add Property”
    This text will be shown:
    ”Player - Add 1000 to Player 1 (Red) Current gold”
    Change the value “1000” into “1”
    Change Player 1 (Red) into “Picked Player”
    Change “Current Gold” into “Current Lumber”
    Now it should look like this:
    Player - Add 1 to (Picked player) Current lumber

    Trigger Explanations:
    First:
    This trigger simply removes all Food in stock for all players.
    Second:
    This trigger adds one Lumber to the Lumber stock.


    Step Final
    Right now, nothing will happen if the Condition is False, so we need
    to create a Else - Action that adds one Food each time the Condition is False.
    • Else - Actions
      • Player - Add 1 to (Picked player) Food used

    How to
    Press the button “New Action (CTRL+R)”.
    Find “Player – Add Property”
    This text will be shown:
    ”Player - Add 1000 to Player 1 (Red) Current gold”
    Change the value “1000” into “1”
    Change Player 1 (Red) into “Picked Player”
    Change “Current Gold” into “Food Used”
    Now it should look like this:
    ”Player - Add 1 to (Picked player) Food Used”

    Now the Trigger will add one Food for each time the Condition is False,
    and now the Trigger is complete and should look like this:
    • Clock
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Player Group - Pick every player in (All players) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked player) Food used) Equal to 59
              • Then - Actions
                • Player - Set (Picked player) Food used to 0
                • Player - Add 1 to (Picked player) Current lumber
              • Else - Actions
                • Player - Add 1 to (Picked player) Food used




    Optional: Game Interface – For Lumber/Food Clock
    Right now there’s a problem with our clock.
    If you scroll over Food or Lumber, it will still say:
    “Food – The amount of food you are using over the total amount you can currently sustain.”
    FoodFail.GIF
    And that’s not really any “eye candy” now is it?
    So why not change the name of Lumber and Food in to something that fits?

    Step I
    Go to the Advanced and go to “Game Interface”.
    From here you go to “Text - General – Food” and change it to Seconds.
    Do the same with “Text - General – Lumber” and “Text General – Lumber:”
    but change them into Minutes and not seconds!

    Step II
    Now the “name” of Food and Lumber is renamed but it still shows the old
    information about Food and Lumber, so go to:
    “Text – General – Lumber is harvested from trees” and change it to something you like.
    I used: “The amount of minutes played.” After that, go to:
    “Text – General - The amount of food you are using over the total amount you can currently sustain.”
    and change it in to something you like as well.
    I used:
    “The amount of seconds played.”
    Now we have new information about Minutes and Seconds
    and the map looks much more serious than it did before.

    Step III
    But there’s still a few very annoying things left.
    Each time the clock reaches 51 seconds it will say:
    LOW UPKEEP
    And that’s not really something we want, so let’s remove it.

    Go to Advanced and go to “Game Constants”.
    Find “Upkeep – Food Levels” and change Low and Medium to 100.
    Now we have removed the annoying Upkeep message and our clock is
    nearly complete, but there’s still on thing that should be removed.

    Step Final
    We can still see the old icons for Wood and Food, and they are now
    minutes and seconds, so it still looks a bit weird. Let’s change that.

    Go to Advanced and go to “Game Interface”.
    Find “Icon – Food” and change it into:
    UI\Widgets\Console\Human\human-console-button-back-active.blp
    This will almost hide the Food button, but you will see a “blue” filter
    if you concentrate. To get a black space, download/make a plain black filter instead

    Find and Change “Icon – Lumber”, change it in to something you think fit.
    I used:
    ReplaceableTextures\Selection\SpellAreaOfEffect.blp
    because it almost looks like a “Blue Clock”.

    Now we have removed the ugly Lumber and Food icons and
    replaced them with two that fits better with our Clock System
    and should now look something like this:
    FoodGood.GIF

    For more info about the Game Interface and Constants, go here:
    http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/game-interface-basics-39401/

    Food Clock
    To do this Clock, do the Lumber/Food Clock first.
    It’s almost the exact same clock, so you won’t waste any time doing it,
    but do NOT fix the Game Interface just yet!
    When you’re done with the Lumber/Food Clock,
    you just need to change three triggers.
    • Clock
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Player Group - Pick every player in (All players) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked player) Food used) Equal to 59
              • Then - Actions
                • Player - Set (Picked player) Food used to 0
                • Player - Add 1 to (Picked player) Current lumber
              • Else - Actions
                • Player - Add 1 to (Picked player) Food used


    Step I
    Begin with the Then Actions in the If / Then / Else action.
    The first one currently removes the current Food and adds 1 Lumber.
    We need to change that into Used and Capability Food.
    So, change the
    “Player - Set (Picked player) Food used to 0”
    into
    ”Player - Set (Picked player) Food cap to 0” .
    and then change the
    ” Player - Add 1 to (Picked player) Current lumber”
    into
    ”Player - Add 1 to (Picked player) Food used”
    Now the Then system is done and should look like this:
    • Then - Actions
      • Player - Set (Picked player) Food cap to 0
      • Player - Add 1 to (Picked player) Food used


    Step Final
    Now we just need to change the Else part, so change
    ”Player - Add 1 to (Picked player) Food used”
    into
    “Player - Add 1 to (Picked player) Food cap”
    • Else - Actions
      • Player - Add 1 to (Picked player) Food cap

    Now the Clock is complete, but you can move on to the Eye Candy part
    to make it look better, and it should look like this:
    • Clock
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Player Group - Pick every player in (All players) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked player) Food cap) Equal to 59
              • Then - Actions
                • Player - Set (Picked player) Food cap to 0
                • Player - Add 1 to (Picked player) Food used
              • Else - Actions
                • Player - Add 1 to (Picked player) Food cap



    Optional: Game Interface – For Food Clock

    Right now there’s a problem with our clock.
    If you scroll over Food Section, it will still say:
    “Food – The amount of food you are using over the total amount you can currently sustain.”
    FoodFail.GIF
    And that’s not really any “eye candy” now is it?
    So why not change the name of Food in to something that fits?

    Step I
    Go to the Advanced and go to “Game Interface”.
    From here you go to “Text - General – Food” and change it to Time.

    Step II
    Now the “name” of Food is renamed but it still shows the old
    information about Food, so go to:
    “Text – General - The amount of food you are using over the total amount you can currently sustain.”
    and change it in to something you like as well.
    I used:
    “ The time passed; Minutes and Seconds.”
    Now we have new information about the time
    and the map looks much more serious than it did before.

    Step III
    But there’s still a few very annoying things left.
    Each time the clock reaches 51 “minutes” it will say:
    LOW UPKEEP
    And that’s not really something we want, so let’s remove it.

    Go to Advanced and go to “Game Constants”.
    Find “Upkeep – Food Levels” and change Low and Medium to 100.
    Now we have removed the annoying Upkeep message and our clock is
    nearly complete, but there’s still on thing that should be removed.

    Step Final
    We can still see the old icon for Food, and it’s suppose to look like minutes and seconds,
    so it still looks a bit weird. Let’s change that.

    Go to Advanced and go to “Game Interface”.
    Find “Icon – Food” and change it into:
    ReplaceableTextures\Selection\SpellAreaOfEffect.blp
    This icon almost looks like a “Blue Clock” and fits well, but
    you can download a icon if you think that fits better!

    Now we have removed the ugly Food icon and
    replaced it with one that fits better with our Clock System
    and should now look something like this:
    FoodGood2.GIF

    For more info about the Game Interface and Constants, go here:
    http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/game-interface-basics-39401/



    Updates and Extras

    Updates
    3 November – 21:00
    Made some major changes in the Tutorial.
    In general, the Tutorial should be easiler to understand.
    Change Notes
    - New Layout
    - Added a new Clock
    - A new "helper"; How-To boxes
    - Minor fixes; such as gramma.​




    Editor Notes
    I've done this from scratch and everything
    is done by me, but I had some help from Dr.Boom and
    I used DOTAs' clock as a reference to make it (Lumber/Food).

    This tutorial was written in a way so everyone should
    be able understand it, that's why it's so long.

    Regards
    Arowanna
     
    Last edited: Nov 4, 2009
  2. .Ragnaros

    .Ragnaros

    Joined:
    Aug 13, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    Pretty impressive tutorial... Very good quality and with a cute organization. I would rate it 10/10. Its rare to find quality tutorials like yours ;) +Rep
     
  3. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Thanks, and I'm glad that you like it.

    I just hope that it will get approved. ;)
     
  4. .Ragnaros

    .Ragnaros

    Joined:
    Aug 13, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    It'll took a while, or not... Everything depends on the moderators...
     
  5. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Would be glad if someone could review it >.<
     
  6. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Instead of showing the actions you are doing I think you should show the whole ITE function all the time, step by step so it will be easier to see what the fuck you are doing without reading badly ;)

    Also mentioning about that units or what you have in your map shouldn't use food nor lumber in-game as it will ruin this.

    Also what will happen if you do the "greedisgood" cheat. Then you will have limitless "minutes", you get my point, save the minut value into an integer instead to not interfeear this "cheat bug" ^^

    else it is great
     
  7. Gamecrafter_DK

    Gamecrafter_DK

    Joined:
    Sep 25, 2007
    Messages:
    1,235
    Resources:
    3
    Maps:
    1
    Tutorials:
    2
    Resources:
    3
    Very simple, and baassee did some good points there. What about cranking it up a noch? Go away from the premade DotA system, and fidget with some other stuff. What about making the entire system run in food, so you don't have to use lumber also?
     
  8. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Or make it in the multiboard as I do ;) HAHA but as many want the "Dota" system I think it is worth it to post this here.
     
  9. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Finally!
    And thanks baassee!

    I will add the Food Cost and Lumber as side notes in the second update.
    And I might change the whole tutorial, just need some time to do it.
    Right now I can't do anything, school is killing me agian >.<

    The BOLD marked:
    I explain what each Trigger does (not perfect, but I said: Some basic GUI skill is req.)
    Do you want me to take a Printscreen for each little thing I do?
    (I will do it, if you think that it will improve the Tutorial)
    Edit:
    Which part is "confusing"?
    The Triggers or the "Eye-Candy"?

    Just give me a minute :)
    • Clock
      • Events
        • Time - Every 1.00 seconds of game time
      • Conditions
      • Actions
        • Player Group - Pick every player in (All players) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked player) Food cap) Equal to 59
              • Then - Actions
                • Player - Set (Picked player) Food cap to 0
                • Player - Add 1 to (Picked player) Food used
              • Else - Actions
                • Player - Add 1 to (Picked player) Food cap

    Done.
    Just as simple, but you can use Lumber with it :p
    I guess it can come in handy for someone :p
    Updating the Tutorial soon, just gotta' do some homework...
     
    Last edited: Nov 3, 2009
  10. Gamecrafter_DK

    Gamecrafter_DK

    Joined:
    Sep 25, 2007
    Messages:
    1,235
    Resources:
    3
    Maps:
    1
    Tutorials:
    2
    Resources:
    3
    Yeah, uhh, i don't really needed the system. I can do way better, it was just something for you to possibly put in your tutorial ^^
     
  11. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Didn't mean it like that :p
    I just made it, going to add it soon, just need to fix some stuff.

    Edit:
    Currently updating the Tutorial, it will be up soon!

    Updated:
    I will update it again soon, fix screenshots and such, but schools calling :S
     
    Last edited: Nov 3, 2009
  12. Gamecrafter_DK

    Gamecrafter_DK

    Joined:
    Sep 25, 2007
    Messages:
    1,235
    Resources:
    3
    Maps:
    1
    Tutorials:
    2
    Resources:
    3
    Sounds great. ^^
     
  13. Darkness-4ever

    Darkness-4ever

    Joined:
    Nov 4, 2007
    Messages:
    763
    Resources:
    0
    Resources:
    0
    Just bringing up more 3 month old tut. submissions that have been neither graveyarded nor approved, and wondering if this should even be bothered with anymore (the tut. submission sub-forum, not my pestering whoever mods it.)
     
  14. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Hmm, yes, was a while ago.
    Maybe I should update it?
     
  15. Darkness-4ever

    Darkness-4ever

    Joined:
    Nov 4, 2007
    Messages:
    763
    Resources:
    0
    Resources:
    0
    You should probably wait, the person that mods tutorials appears to have fallen into a black hole.
     
  16. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Did the tutorial moderator die?
     
  17. Darkness-4ever

    Darkness-4ever

    Joined:
    Nov 4, 2007
    Messages:
    763
    Resources:
    0
    Resources:
    0
    Yes...
    I mean no...
    I mean yes!
     
  18. dOT145

    dOT145

    Joined:
    Jun 22, 2009
    Messages:
    16
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    This is a really good tutorial, comprehensive and helpful to both beginners and middle-level trigger-ers (experts just...do their own thing). I like how it shows how to get to each action/condition/etc., even though I don't need it. It looks like you spent a lot of time and effort making this.
     
  19. Arowanna

    Arowanna

    Joined:
    Dec 30, 2007
    Messages:
    1,310
    Resources:
    13
    Icons:
    4
    Skins:
    8
    Tutorials:
    1
    Resources:
    13
    Five months or something.
    Not that I care anymore, but someone should clean the Tutorial Section.

    And by the way, thanks dOT145.
     
  20. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Today is your lucky day. Anyway, amazing tutorial. It is very well formatted and neat as possible. I don't see any visible problems with it (except for the colors) but they are fine since they are similar to the theme anyway [and are at least appropriate].

    Definitely, ~Approved. Nice job.