Grurf's World Editor Thread

Grurf

Ultra Cool Member
Reaction score
30
Nothing really special, just a list of things I have found to come in handy when mapping and especially triggering. I will edit this to add things when I want to share them. Feel free to post if something is wrong or hard to understand.

- Wait actions

Normal Wait Actions will keep running when somebody is lagging, which is very inconvenient if for example a shop appears for a certain amount of time, then somebody starts lagging. When he/she is finished, the wait action has had it's time and the shop disappeared. Nobody will have been able to buy anything. You can use game-time seconds instead, they are lag-resistant. But remember that you can't fully count on them, because the game-time get's synchronized with the host every now and then. You can't fully count on wait actions anyway. If a lot of triggers are running at the same time (actually warcraft doesn't run them at the same time, but keeps a queue for actions to be ran) then a wait action will just take the trigger out of the queue for the time it takes, and place it back in. Then warcraft still has to finish the queue before the actions after the wait action are being executed. The best way to implement a wait is using a countdown timer without showing it. This is the most precise timer and it is lag-resistant, but does only synchronize on start.​

- Unit Group - Pick every Unit in [anything] and do Action(s)

This action is a little weird. Remember that it is a loop. All the actions in the loop will be run once for every picked unit. Also, if no units are picked the actions will not be executed. If you want to count the units in a unit group do it like this:
Code:
Set [UnitGroupVariable] = Pick every unit in [anything]
If Number of Units in [UnitGroupVariable] Is Equal to 0
This will work, even if the unit group is empty. Because the variable is of the Unit Group type, it will always be a unit group. Even if there is nothing to pick, then it will just be an empty unit group, with 0 units. Another advantage of this way is that it doesn't leak the unit group but stores it in a variable, which can be destroyed afterwards.​

- Debugging your triggers

Strange that I have never seen this method being mentioned on the internet before. I many times create triggers that do not work as they should. What I do then is putting it full with text messages saying what it is doing and, if any variables are set, the value of those variables. When something doesn't run or a variable isn't set correctly, the messages will report this, so you know where to seek the error. This way I can fix deep errors in very short times, because I don't have to check every step of the trigger, just the ones that are reported to be wrong.​

- Unit - Damage Target

This action is not a normal attack. No animations are played, range doesn't matter. I personally use it for my triggered spells. The strange thing about it is: it does attack invulnerable units. It doesn't do any damage, but makes the AI think the invulnerable unit is attacked, and if it has no attack, and has no orders, it will start running away. This was very inconvenient in my map, because you could make an invulnerable dude run to a place, and if you did it good enough he would block off a lane. Solutions: Make all your spells unable to target invulnerable units or make the invulnerable unit unable to move.​

- General Programming Knowledge

If you ever wonder why some people create triggers in a very efficient way that you would have never thought of, it is because of this: General Programming Knowledge. This is the kind of logic a prgrammer uses. Triggering actually is a kind of programming, with crappy functions that leak and without a hard-to-learn syntax. If you know how to trigger well, it is easier to learn a programming language, and vice-versa. If you want to be able to write perfect, efficient triggers, you might want to follow one of those programming tutorials to teach yourself that logic. But, if you start learning to program anyway, why don't you learn jass? That way you can write even more efficient triggers, while you have more possibilities and great tools (like vexorian's caster system) to help you. Another advantage of jass triggers: local variables. Those variables allow you to make triggers multi-instanceable: If you make a spell in jass with local variables, an unlimited amount of units can cast it at the same time (even from the same player) and the variables won't be a problem. Yes, it is possible to integrate local variables into normal triggers, but to do that you need WEU with advanced triggers that increase your map's size with about 200kb and are very unstable if you don't use them right. They are also known to suddenly corrupt your map in certain cases. And that brings me to the next subject:​

- Backupping!

This is very important for the mapmaker. After every major change, and after every big piece of work, you should save under a new name. Personally I use numbers. For example, my map is at number 36 now. Version 1 only had 2 spell triggers and the terrain, 2 heroes and some creeps, while number 36 is a fully playable alpha version. I have also backed up some of the version to the server here, so if something happens to this computer (if I manage to mess the MBR up again) I will just reinstall it, take the backup and go on with my map. Losing your map is quite frustrating, trust me. Backing up isn't that hard to do, and it can save you months of work. Make multiple versions so that if one gets corrupted, you just switch to the one before that and make sure you don't do again what corrupted it. And if you don't have a server, back it up to a cd-rw, webspace, an usb-stick, your pda/mp3player etc. Anything that isn't inside your computer.​
 
H

Heptameron

Guest
Grurf said:
- Unit Group - Pick every Unit in [anything] and do Action(s)

<snip>

But, this doesn't work, too:
Code:
Unit Group - Pick every Unit in [anything] and do Action(s)
	Loop - Actions
If Number of Units in Last Created Unit Group Is Equal to 0
...
Why? Because there are no units to pick. The last created unit group won't be the shown one, because it isn't a unit group.​

<snip>
While your conclusion is right here, your reasoning is slightly off. Last Created Unit Group, as the hint says, points to the last unit(s) created with a Unit - Create Units Facing Angle/Point action. The reason your second example doesn't work is because none of the Units In.../Units Owned.../Units Of Type/Units Selected functions count as "last created" unit groups.
 

Grurf

Ultra Cool Member
Reaction score
30
Heptameron said:
While your conclusion is right here, your reasoning is slightly off. Last Created Unit Group, as the hint says, points to the last unit(s) created with a Unit - Create Units Facing Angle/Point action. The reason your second example doesn't work is because none of the Units In.../Units Owned.../Units Of Type/Units Selected functions count as "last created" unit groups.

Ok, thank you for pointing me at that. So Last Created Unit Group should be read as Last "Created Unit" Group and not as Last Created "Unit Group". Not that it matters that much, the final solution works =). But still thanks, I will edit it now.
 
H

Heptameron

Guest
Grurf said:
So Last Created Unit Group should be read as Last "Created Unit" Group and not as Last Created "Unit Group".
Exactly. ;)

By the way, if you haven't already, you should learn Jass. Then you can check these kinds of things for yourself. :)
 

Grurf

Ultra Cool Member
Reaction score
30
Well, I promised the community (yes, my map already has a community! It is quite popular on Lordaeron) that the map will be finished in october, and if I have to learn JASS and finish the map before that time, I won't have enough time for school =).
 
H

Heptameron

Guest
Grurf said:
Well, I promised the community (yes, my map already has a community! It is quite popular on Lordaeron) that the map will be finished in october, and if I have to learn JASS and finish the map before that time, I won't have enough time for school =).
Oh well. After October, then. ;)
 

Sud

"[If life=Dota] I'd have quit long ago" -- Acehart
Reaction score
64
I seriously discourage the use of wait triggers in general, because they seize focus of the trigger and will not give it up.

What this can potentially mean, if your map has a lot of real time triggering going on, is actual trigger lag going between one trigger to the next.

Delays should be coded with variables or on a timer.
 

Grurf

Ultra Cool Member
Reaction score
30
Hmmm... Maybe. I was also planning to start learning C++ this year (this dude is quite ambitious for a 15 years old geek). But what is so good about jass that I should learn it? Doesn't it cost more time than just triggering? I know that it is easier to avoid memory leaks with jass, and that you can do more with it, but so far I can do more than enough with normal WEU triggers, and if even that isn't enough, WEU also has advanced triggers.
 
H

Heptameron

Guest
Grurf said:
Hmmm... Maybe. I was also planning to start learning C++ this year (this dude is quite ambitious for a 15 years old geek). But what is so good about jass that I should learn it? Doesn't it cost more time than just triggering? I know that it is easier to avoid memory leaks with jass, and that you can do more with it, but so far I can do more than enough with normal WEU triggers, and if even that isn't enough, WEU also has advanced triggers.
Advanced triggers are just more restricted Jass with a simpler name. ;)

Anyway, Jass is so useful because you can do stuff you couldn't dream of in GUI... example: using the item tables in Advanced > Item Tables for dynamically created units. I just figured that out. ;)
 

AgentPaper

From the depths, I come.
Reaction score
107
Not everyone has to learn JASS, just get a basic understanding of it (if you know GUI well then your close enough) and then when you need something done in JASS, just come here and ask for it. Of course if you end up using a lot of JASS then learning it more will help you integrate and polish it up more.
 

Grurf

Ultra Cool Member
Reaction score
30
@Sud, first of all, I don't really like your avatar. Because I say this as the first thing it will probably be clear that, well... Ok, second thing: I don't really get what you mean. Like this:

Sud said:
What this can potentially mean, if your map has a lot of real time triggering going on, is actual trigger lag going between one trigger to the next.

Do you mean that warcraft takes the whole trigger in the queue, and completes it fully including the wait actions before moving on to the next trigger?

@Heptameron, as I said, I don't think I will need more possibilities soon.

@AgentPaper, well there you have it: if I need it.

Ok I think I get it. Learn JASS if you need it much, otherwise, well, just trigger.
 

Vexorian

Why no custom sig?
Reaction score
187
You mean don't use the BLP option or Don't use the map optimizer?

Anyway, Jass is so useful because you can do stuff you couldn't dream of in GUI... example: using the item tables in Advanced > Item Tables for dynamically created units. I just figured that out.
Although in JASS you can make a better item table system anyways
 

Sud

"[If life=Dota] I'd have quit long ago" -- Acehart
Reaction score
64
Unfortunately, not liking loldog is not an option. He will eventually devour your soul and soon all you will know is his ever dominant presence in the stupor that remains of your consciousness.

What I mean with the wait triggering is that triggers work on a "queueing" system. Simply put, one trigger is processed at a time, first in first out.

Wait triggers cause a halt to this process, and force triggers to hold for one that waits. What this means is, if you have made two lovely triggered spells, and go to cast one, and it has waits, you will notice a delay before the second one even comes out.

In CoD, if you ever played it, this would mean that Stinky Steven would sometimes have to wait times of up to 3 seconds before he could use his jump ability, after the person cast it.

I've heavily modified and optimized the map since then (as I originally made the mistake of wait triggers myself), and in its current form you can literally see dozens of custom spells all flying around in real time with no delays. It's one of the reasons I've had such success with my proccing items.

Just a stumbling block that you're better off evading now than later when you have to go and change like 100 triggers, like I did.
 

Rad

...
Reaction score
228
Example: using the item tables in Advanced > Item Tables for dynamically created units. I just figured that out.
How do you do this?? I asked in a post about 3 days ago.. and nobody came up with a good solution except triggers (And someone suggested adding the item dropped to the unit in the editor... :rolleyes: )
 

Vexorian

Why no custom sig?
Reaction score
187
Export the map script, find the item tables (Which are actually functions) and register unit dead event triggers on those functions as actions

Wait triggers cause a halt to this process, and force triggers to hold for one that waits. What this means is, if you have made two lovely triggered spells, and go to cast one, and it has waits, you will notice a delay before the second one even comes out.
That isn't true...
 

AgentPaper

From the depths, I come.
Reaction score
107
I keep hearing lots of bad about wait actions and real time triggers, but what do we use instead? are we supposed to just do without waits? :banghead:
 

Grurf

Ultra Cool Member
Reaction score
30
Vexorian:

I only mean the option, will edit that. I will send you the skins, too, btw.
 

Sud

"[If life=Dota] I'd have quit long ago" -- Acehart
Reaction score
64
Well in my case I "engined" all the stuff that requires processing in the background (such as removing spellcaster units, and etc.)

I use variables and timed interval triggers to process the delays. For example, if you create a DelayVar variable as an integer, and decrement it with a trigger that occurs every, say 0.25 seconds, you could assign it a value of 4 to have a "wait" of 1 second.

How you want to code your triggers is such a way that they complete, from start to finish, without any hitches or pauses, to allow the next queued trigger to take place. This means that, if they need to be rerun because you need a delay (say half the trigger is before the wait and half after) or additional triggers created then so be it.

So as an algorithm, you could make a trigger in this structure:

[Timer trigger]
- Decrements a wait variable by 1 every 0.25 seconds if it is >= 1 [always active]

[Custom Spell Trigger]
Detect whether or not spell trigger call is pre or post-delay
...[First Half]
...Check if spell is not in the second half phase
...Begin casting of spell, animations, etc. etc.
...Set variable to identify the spell is in the first phase
...Set variable to wait for 3 seconds (Variable = 12)
...[Second Half (or second trigger)]
...Check if spell is not in the first half phase (by checking if spell is in first phase AND wait variable is >= 1), run second half if the wait variable is 0
...Run secondary effects of spell
...Reset spell variables to complete the spell and prep it to be casted again

So for example, in CoD, Steven Slam cannot be done properly with wait triggers because of 1. sync issues and 2. delay issues. So it is structured in this manner:

[First Trigger]
...Steven Casts Steven Slam
...Do farting sound effect and create jumping steven effect
...Make conditions for when Steven lands (done by detecting a "hit" on an invisible unit by an artillery attack that is Steven)
[Second Trigger]
...Waits for hit confirmation as per first trigger
...Does all the damage and effects of the spell
...Set timer variable to do "Steven getting up" animation
[Third Trigger]
...Waits for timer variable to equal 0
...Returns Steven to play
 

AgentPaper

From the depths, I come.
Reaction score
107
so you just use countdown timers?
 

Grurf

Ultra Cool Member
Reaction score
30
Update!

Changelog:

-Removed the note about map optimizer, it works perfectly now
-Added a bit to the wait stuff
-Added stuff about programming and backupping

If you have any feedback, feel free to post!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top