Tutorial GUI Let's Break It Down.

Radiance

New Member
Okay so today I'm going to explain the basics of GUI. This tutorial is very basic and if you know what events actions and conditions are then this is not the tutorial for you. I know lots of people out there won't need this tutorial but when I started out boy was I confused, so lets hope this helps those who are beginning. Lets begin...

1. Basic Structure Of A GUI Trigger.

2. Diving Into Conditions


1. GUI The Basic Structure:
A GUI trigger consists of three types of lines. An event, a condition, and an action.

Events: An event is an action, or event that must occur before running the action. An example would be the one i listed below. All it says is 'a unit dies'.
So the event is 'a unit dies'. Simple enough? I hope so.

Trigger:
  • Events
    • Unit - A unit Dies


Conditions: A condition is the requirement that must be met before the action is ran. That may or may not sound complicated but let me explain. Our event is 'A unit Dies'. But we ask what unit? If you want to specify the type of unit you use the condition. (Don't worry I will go more into detail about why we are specifying the unit later.)

Adding The Condition:
So now lets right click Condition. And choose add condition. Now scroll down to Unit-Type Comparison.
Now change the triggering unit in Unit Type Of Triggering Unit. Change it to dying unit, because our event is 'A unit dies'. Now just click ok because we are using footman as our unit today.

Review:
Okay so right now our trigger should currently look like this.

Trigger:
  • Events
    • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Footman
    • Actions


All this means is 'A unit dies'. The type of dying unit is a footman, and only a footman. Read it over until you understand what this means so far. Now to the toughest part of a trigger.

Sidenote: You can specify one specific unit with Unit Comparison. Because the unit type comparison, is specifying all units of the type footmen instead of one specific footmen.

Actions:
What are actions? Actions are the actions that will occur after the event has occured and the conditions are met. An example would be

Trigger:
  • Events
    • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Footman
    • Actions
      • Game - Display to (All players) the text: A footman has been slain.


So here, A unit has died. Hey look it's a footman, it matches the condition. And now the action will run, which is to Display a text to all players. The text will be A footmen has been slain.

That is pretty much it for the basic structure of a GUI trigger, and I have posted up 2 other simple GUI triggers so you can use them as examples.
*Rememeber, Events is what is to happen, conditions is a requirement that the event must meet, and the action is what happens after all is met. Explore the Events , Conditions, and Actions and get familiar with what you can do.

------------------------------------------------------------------------------------------------------------------------------------

Trigger:
  • Events
    • Unit - A unit enters Region 000 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Knight
    • Actions
      • Unit - Move (Entering unit) instantly to (Center of (Playable map area))


All this says is that a unit enters a region. Then the unit type of the entering unit has to be a knight or else it won't run the action. And the action is to Move the knight that has entered to the center of the map.

I will explain what a Region is, and they're uses later on in this tutorial.

*These triggers all leak, and I'm not covering leaks today but if you want to learn more a good tutorial would be emijrl's. I'll post it at the end of the tutorial.

----------------------------------------------------------------------------------------------


Diving Into Conditions: As i was starting out I never realized how many type of conditions there were and what they all did. So in this tutorial I also going to go a little deeper into conditions. I won't go over all the conditions just the more common ones.

Conditions And What They Do:
Boolean Comparison: The boolean comparison is used often because of it's large arrays of conditions. It is usually used to detect stuff. Like buffs, whether a unit is alive or dead, or the level of an ability for a unit.

Ability Comparison: This condition is one of the easiest, all it does is detect the spell that is being cast or channeled. Useful for trigger enhancing spells.

Integer Comparison: This one is an important one. You use it when you want to compare in integers or numbers. For example. Pay attention to the event, and conditions.
Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Level of (Ability being cast) for (Casting unit)) Equal to 3
    • Actions
      • Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl


A unit casts an ability. Simple. Now the level of the ability has to be 3 in order to run the action. So if it has to do numbers go for the integer comparison.

Unit Type Comparison: As you have learned about earlier in this tutorial the Unit type condition is useful for several things. It specifies a group of units of the same type. Like footmen, or wolves.

Multiple Conditions/Rules and Uses:

Sometimes you will have to use several conditions or an 'or condition.' Here I will explain how to use multiple conditions.

Now right click conditions in a new trigger. Then select add condition. Scroll all the way down till you see Or,Multiple Conditions. This is used when you the action can be ran when one of the conditions have been met.

Trigger:
  • Wrong:
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_6">
    • <li class="lastopen"><span class="events">Events</span>
    • <ul>
    • <li class="tree"><span class="unit">Unit - A unit Dies</span></li>
    • <li class="open"><span class="conditions">Conditions</span>
    • <ul>
    • <li class="tree"><span class="default">(Unit-type of (Dying unit)) Equal to Mountain King</span></li>
    • <li class="lasttree"><span class="default">(Unit-type of (Dying unit)) Equal to Archmage</span></li>
    • </ul>
    • </li>
    • <li class="lastopen"><span class="actions">Actions</span>
    • <ul>
    • <li class="lasttree"><span class="hero">Hero - Instantly revive (Dying unit) at (Center of (Playable map area)), Show revival graphics</span></li>
    • </ul>
    • </li>
    • </ul>
    • </li>
    • </ul>
    • </div></div>


What the conditions are saying is that both the heroes have to die at the same time in order for the Actions to be run.

Correct:
Trigger:
  • Events
    • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Archmage
          • (Unit-type of (Dying unit)) Equal to Mountain King
    • Actions
      • Hero - Instantly revive (Dying unit) at (Center of (Playable map area)), Show revival graphics



Now this is correct because the Or-Any(Conditions) are true makes the trigger says: If an archmage dies he will be revived , or if a mountain king dies he will be revived. The actions will run as long as one of the conditions are met.




------------------------------------------------------------------------------------------------------------------------------------

Thank You For Those Who Read. I hoped I helped all those beginners out there who needed help and was lost, confused, yet fascinated when you first opened World Editor. Remember explore the trigger editor and get familiar

The best way is to create some sample triggers, basic ones. You can use the triggers I have used in this tutorial and change them a little bit. I advise you not to start a map until you completely understand this tutorial and more because this is a very basic tutorial.

(If you are having trouble with a GUI trigger then I ask here then I may be able to help you)

Leak Tutorial: http://www.thehelper.net/forums/showthread.php?t=27219&highlight=Leaks

*Srry If I spelled your name wrong above.

I would appreciate feedback and constuctive criticism on how to make this tutorial better. Comments would be appreciated as well.

~Radiance
 

Gtam

Lerning how to write and read!! Yeah.
there is already a tut that explains all this and more
 

Rainther

I guess I should write something of value here...
It's the work of the devil! :D

Nah, kidding. GUI is a good thingie to start with I guess.
As you mentioned it's basic, you haven't mentioned stuff like Last Created and Loop, but it seems good at first look.
 

Romek

Super Moderator
Staff member
Start off by removing the Lime colour, and replacing it with ordinary Green.

I don't have anything against having multiple GUI starter tutorials. In fact, we already have multiple JASS tutorials, all written slightly differently from different angles.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    You need to buy a laptop that supports external GPUs for this.
  • tom_mai78101 tom_mai78101:
    I'm pretty lucky to get myself an Alienware 15 with RTX 2070.
  • Varine Varine:
    I think I'm moving back up north for the summer, I got offered my job as the tournant chef back and I'm tired of struggling down here, it pays like twice as much too
  • Varine Varine:
    I think imma give four or five weeks of notice today to my boss, and see how much that backfires on me. I know he's struggling to hire anyone though, so it's like, do a couple weeks of interviews with me and then we'll have two or three weeks to train someone to take over for me. Hopefully he doesn't fucking let me go in like two weeks cuz that would really fuck me up right now
  • tom_mai78101 tom_mai78101:
    Wouldn't it be better if you give 3 to 4 weeks of notice? So that, at least you are guaranteed for 1 more week of paycheck to hold you over?
  • tom_mai78101 tom_mai78101:
    By the way, where are you moving to?
  • Varine Varine:
    Back to Idaho for the summer, then maybe Houston in August or so, my girlfriend or whatever we are loved it there
  • Varine Varine:
    I'm not sure yet, but my parents need some help cuz they're getting older and my mom has MS so can't do much anymore, so I'll be able to get their property fixed up so they can sell their other house. And the resort is stoked to have me back for the summer, cuz they always struggle with staff.
  • Varine Varine:
    I think it'll be alright, even if they cut me loose a bit early I do have some money and I know plenty of people that will lend me the few hundred bucks to get up there. I'm just catching up after last year still, if I have to kite some bills for a couple weeks it'll be fine.
  • Varine Varine:
    I hate my job but I do like one of my bosses, he does try really hard to get me what I need, and I want to make sure I leave with them comfortable with a new manager
  • Varine Varine:
    I like my coworkers for the most part too as much as I bitch about them, they just aren't reliable. As kids tend to be, I was a shithead at 19 and 20 too I'm sure, so
  • tom_mai78101 tom_mai78101:
    Good luck on getting things going.
  • Varine Varine:
    Eh, it'll be fine, I got it mostly planned out already. Roommates know, boss will know in about an hour when I go to work, I'll have a plane booked once we decide my last day, and I have a place to stay up there lined up for two or three months
  • Varine Varine:
    That all came together surprisingly easily
  • Varine Varine:
    I think I'm going to give 4 weeks, so that'll give me 2 more full checks probably, and then one more coming after I leave.
    +1
  • Varine Varine:
    All that shit came together really well suprisingly. My boss was upset cuz I am really good at my job suprisingly, but he's stoked that he got 4 weeks, plus one or two if he needs it, my flight's book in mid June, but I start my new job almost immediately so it'll be nice to have some time to chill and pack and get my rooms cleaned out. He actually gave me a dollar raise right after I gave notice to thank me for not being short or just leaving and making sure I can help interview and train someone to replace me. He is really cool, his food truck has just been a nightmare to run. I get my vaccine next week finally, allegedly Idaho will let me have my license back when I get there, and I have all my bills up to date so it should be an easy move this time around.
  • Varine Varine:
    Is anyone else getting server timeouts in the chat? I think it's on my end, my wifi adapter has been acting up recently
  • Varine Varine:
    100% my end, idk what it is though.
  • tom_mai78101 tom_mai78101:
    Just woke up. No idea.
  • jonas jonas:
    sounds great :) have fun in Idaho
  • The Helper The Helper:
    freaking Idaho
  • Varine Varine:
    Yeah it sucks up there, but it'll be a bit easier for the summer probably.
  • The Helper The Helper:
    When you get to Houston you will have your pick there is a huge shortage of good people to work in your field here. They are hiring everywhere and Texas is pretty much fully open.
  • The Helper The Helper:
    for anyone else following this yes I am in Houston so Varine and I will RL meet gotta love it! Looking forward to it!
  • jonas jonas:
    awesome

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top