Tutorial GUI Let's Break It Down.

Radiance

New Member
Reaction score
1
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.
Reaction score
164
there is already a tut that explains all this and more
 

Rainther

I guess I should write something of value here...
Reaction score
61
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.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
The green killed my eyes :(, now they don't stop to bleed!! You'll receive a letter from my lawyer! :thup:
 

Romek

Super Moderator
Reaction score
963
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.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top