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

Learning GUI Basicly to Advancly - [Reviewed: PurplePoot]

Level 9
Joined
Jul 24, 2007
Messages
308
Hello, in this toturial you will start as a beginner with GUI (even if you just start now), and in the end you will be an expert with it

First, open your world editor at your warcraft 3 directory, then create a new map (of your choice), then hit F4 or open the trigger editor from "Triggers".

Now you will see a new window opened, and you will see a "Trigger" looks like this
:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create starting units (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Melee Game - Enforce victory/defeat conditions (for all players)
This trigger is made for a melee game, which you propably dont need when making a custom map, so just delete it.

Now create a new trigger (Press CTRL+T)
You will see something looks like this:
  • [COLOR="red"]Untitled Trigger 001
    • Events
    • Conditions
    • Actions[/COLOR]
Now lets describe what you have just seen:
"Untitled Trigger 001" : this is the name of the trigger, you can edit it by right-clicking it then renaming it.
We will start from actions, just a matter of understanding the other functions.
"Actions" : Those are what a trigger is supposed to do, they are alot, they can be effects, creating(or moving) units, animations, AI, camera, cinematic, window, dialog, hero, sound, and so on..
You will wonder now, when and how do the actions happen?
"Events" : when an event happen, it runs the action(s) if the conditions happen
"Conditions" : Those are the event conditions for the action to happen, if they dont happen the action wont affect or work.

Below is an example of some triggers:
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is [COLOR="red"]4.00 [/COLOR]seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: [COLOR="red"]Welcome to this map![/COLOR]
What happens with this trigger is that after 4 seconds after game starts, the chosen text will display to the players chosen by the action, you can test this.


now lets see this trigger
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Player - Set ([COLOR="red"]Owner of (Dying unit[/COLOR])) [COLOR="red"]Current gold[/COLOR] to ((([COLOR="red"]Owner of (Dying unit[/COLOR])) [COLOR="red"]Current gold) - 5[/COLOR])
This trigger happens when ANY unit dies, its actions will be reducing the owner of the unit which got killed by 5!

If you understand that trigger, know you are getting much better!


Now lets use a trigger with conditions
  • Untitled Trigger 001
    • Events
      • Unit - A unit [COLOR="red"]Dies[/COLOR]
    • Conditions
      • ((Dying unit) is A [COLOR="red"]Hero[/COLOR]) [COLOR="red"]Equal to True[/COLOR]
    • Actions
      • Game - Display to (All players) the text: [COLOR="red"]((Name of (Owner of (Dying unit))) + Has been killed!)[/COLOR]
Lets talk about this trigger, when ANY unit dies, the events will configure, but conditions required the unit must be a hero! if the conditions happen, the actions will happen, and what action does is to display a text to all players "xXCRIMINALXx has been killed" know that xXCRIMINALXx refers to the owner of the unit which got killed.
hint : put a space before "Has been killed", just so it display correctly and not stick to the player's name.

now thats enough of examples, but dont stop here! never! there are two very dangeroes points that you should, you must know!


1-Varibales :These are just variables which are used to refer to a number/unit or any other thing.
Variables are very important to any map, without them any map goes very bad!
now lets get you started with the "Variables"
Hit CTRL+B then a new small window will appear, you will propably see a blank if you use a new map, anyway to create a new variable press CTRL+N!

Now you will see three fields that MUST be written:
Variable Name : The name of the variable which you will use.
Variable Type : This refers to the variable type which you will use, like you cant make a unit and a region refered of same variable, thats the use of the variable type.
[Checkable]Array : An arrayed trigger is useful for multiplayer maps. how?
it will reduce lag, save time, gives more functions to be used by you!
How do they look like? a non-array variable will just have name when referring to it, but an arrayed one will have the name AND a number which must be written behind it.
what the number? the number is the variable number of the one you will use, i will show you examples of variables with or without arrays below.

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Unit_Variable[(Player number of (Picked player))] = (Random unit from Unit_Group_Variable)
What you will say is "Omg how can i understand this!!"!
believe it or not, its very, very easy!
Lets explain this trigger:
When the game time is 5 seconds, the actions will excute instantly because there are no conditions!
actions: what those actions will do is they pick (take) all player (even if not playing), and make a variable of random unit which is created in a unit group.
Now you may see some use for arrays, the array of the variable unit in the last trigger will refer to the player's number. Cool if you understand it

Now lets get into something yet more important and harder (still its easy)
2-Leaks!
Leaks are what ruins ~80% of maps! they can be called "Lagness"
hmm if name is not enough, i will explain more.
this is an example of a leak
  • Untitled Trigger 001
    • Events
      • Time - Every [COLOR="red"]2.00 [/COLOR]seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ([COLOR="red"]Units owned by Player 1 (Red) of type Footman[/COLOR]) and do (Actions)
        • Loop - Actions
          • Unit - Kill ([COLOR="red"]Picked unit[/COLOR])
Lets explain this trigger:
Every 2 seconds, any unit owned by player 1 (red) will be killed!
whats the leak?
The leak is the unit group which is "Units owned by player 1(Red) of type footman)", heres the way to fix them:
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set Unit_Group_Variable = (Units owned by Player 1 (Red) of type Footman)
      • Unit Group - Pick every unit in Unit_Group_Variable and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup(udg_Unit_Group_Variable)
A couple of leaks will cause the game to lag permanently!

To know much more about leaks (which you must do), please refer to this link: http://www.hiveworkshop.com/forums/showthread.php?t=35124

Now you are advanced in GUI triggers if you fully understanded all above
Now i will give you useful tips which help you making triggers
-Always remove melee initialization trigger for any map
-Always avoid leaks! they will cause the game permanently lag!
-Try to compress actions with loops
-Try to use the If/Then/Else function, which is useful and looks alike mini trigger, it will check if the "IF" condition happens, it will run "Then" actions, but if the "IF" condition fails, it will run "Else" functions.
-Try to always use custom and cool stuffs, like effects, animations, systems and so on..
-Variables must be used in any map that is supposed to be "good"
-Try to learn JASS after long time of map making with GUI, JASS has more functions and more map optimizing, know your brain in future will automatically lead you to JASS if you be expert in GUI.
-Try to use triggered-spells in your map, with them many maps succeeded

If you have any comment post it, and if the tutorial has helped you please tell

sorry for some grammar mistakes )
 
Level 8
Joined
Nov 29, 2007
Messages
371
Color tags don't work within [TRIGGER][/TRIGGER] tags.
I would also contest that this tutorial makes you an 'expert' at GUI triggers. Perhaps you could call it 'An introduction to GUI triggers' You have also fallen into the trap of using to many 'color' tags. The black text is just hard to read.
I think the problem with your tutorial is that everything you have covered, has already been covered in better detail and more succintly by other members of the community.

[EDIT] Sorry for pseudo necro-post, but I thought the author would like some kind of feedback.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
After skimming this tutorial, I noticed three main things;

  • The spelling and grammar desperately need an overhaul for this to be passable.
  • You consistently try to use [color] tags within
    • tags, which does not work.
    • [*]It tries to cover too much too fast, and thus often does a bad job of actually explaining what's going on, and instead just lists triggers.[/list]
 
Top