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

Working around World Edit incompatibilities.

Level 3
Joined
May 3, 2009
Messages
37
GUI has several problems that I find funnily existing. Such as:
1. Events, Conditions, and Actions that will make your life easier missing
2. Annoying As Hell Stuff (Fine) (having to make a Event or Action for playing players such as 1-10 and having 11-12 a bot)
3. Memory Leaks (Guides already Existing)

Contents:
Part 1 - Eventless Problems.
All in all, Part one explains how to work around in making triggered passives.
Part 2 - The Magic of Variables.
To make it so you only have to do it ONCE!
Part 3 - More Parts coming...

*NOTE: Ignore memory leaks.

PART 1

First off, when you want to make a triggered passive, have you ever encountered a problem such as:
  • Stun Chance
    • Events
      • Unit - OMG NO EVENT
And dont you wish there was
  • Stun Chance
    • Events
      • Unit - Unit has ability (Stun Chance)
    • Conditions
    • Actions
      • If (Random Interger between 1 and 100 Equal to or Less than 10) then (Bla bla stun target) else (Do Nothing)
This is a problem that I often had. But eventually I figured it out. You have to work around it. Lets say we want to give this unit a chance to stun a target every time it hits. Note how there is NO condition for if a unit has a ability. First I will give you the complete code. Then I'll break it down.
  • Stun Chance
    • Events
      • Unit - A unit is attacked
    • Conditions
      • ((Attacking Unit) has buff Stun Chance) Equal to True
    • Actions
      • If (All conditons are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random Interger between 1 and 10) Equal to 1
        • Then - Actions
          • -------- Note How the Add Buff action also does not exist. And how a ability has to be added to have the buff. --------
          • Unit - Add StunAbility to (Triggering Unit)
          • -------- Just in case you use a custom buff --------
          • Unit - Pause (Triggering Unit)
          • Wait X Seconds
          • Unit - Remove StunAbility from (Triggering Unit)
          • -------- Just in case you use a custom buff --------
          • Unit - Unpause (Triggering unit)
        • Else - Actions
Ok. So lets say you wanted to creat ANY passive like this (having a negative effect on the attacked unit). The best way you can start is with:
  • Stun Chance
    • Events
      • Unit - A unit is attacked
N.Q.A. (No questions asked)
The first problem forms here. For you see, there is no condition where
  • Stun Chance
    • Events
    • Conditions
      • ((Attacking Unit) has ability StunAbility) Equal to True
    • Actions
WHICH therefor means you have to give the attacking unit a buff to work with. This has to be done by creating a new ability (Passive/Aura) which gives the unit a buff.

Once you have your ability, Give it to your unit of choice. The condition you have to use for the ability to work is:
  • Stun Chance
    • Events
      • Unit - A unit is Attacked
    • Conditions
      • ((Attacking Unit) has buff Stun Chance) Equal to True
    • Actions
Please note that if you are going to give the buff by using a aura, set the AOE of the aura to 0.01. Therefor making yourself the only one who has the buff.

Now all you have to do is add in your own actions. For me, It is to stun the attacked unit.

Part 2
If you read the memory leak fixing guides in the Hive, you understand that you assign the leaks to a variable so you can destroy it later. However, if you been to High School, You will also know that a variable something that can represent any number. It Varies, thats why its called a variable.

In worldedit I find the variable system amazing. Because, here, defining variables is as easy as A.B.C. Literally.

When defining these variables, you should most of the time place them in your initialization trigger. Ok, Lets say you want to creat a hero defence map where P1-10 plays and P11-12 are bots. In a map like this, you'll be faced with a bunch of Inconviences. Here. Let me show you...
  • Hero Selector Spawn
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Unit - Create 1 Hero Selector for Player 1 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 2 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 3 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 4 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 5 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 6 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 7 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 8 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 9 (Color) at (center of Region <gen>) facing Default building facing Degrees
      • Unit - Create 1 Hero Selector for Player 10 (Color) at (center of Region <gen>) facing Default building facing Degrees
and MOST LIKELY, you will be forced to do things like this over and over again. So, what if... we assign player 1-10 into a single player group as a variable?
  • Initialization
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • If ((Player 1 (Color)) Slot Status) Equal to Is Playing) then do (Set PlayersPlaying = (All players matching (((Matching Player) Slot Status) Equal to Is playing) else do (Do Nothing)
Boom Boom done. Once again we have used a variable to our advantage.
More coming soon...
 
Last edited by a moderator:
Level 40
Joined
Dec 14, 2005
Messages
10,532
1. No event where a unit uses/has a ability
That makes no sense as an event. A state cannot be an event because it is not any definite point in time,
2. Inefficiency (having to make a Event or Action for playing players such as 1-10 and having 11-12 a bot)
That isn't inefficient, it's just annoying to write.
 
Top