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

Mine Bomb

Status
Not open for further replies.
Level 5
Joined
Apr 22, 2011
Messages
152
You need three triggers. Like these:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Land mine
  • Actions
    • Unit - Add Detonate to (Casting unit)
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Detonate
  • Actions
    • Unit Group - Pick every unit in (Units of type Mine) and do (Actions)
      • Loop - Actions
        • Unit - Explode (Picked unit)
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Dying unit)) Equal to Mine
  • Actions
    • Unit - Cause (Dying unit) to damage circular area after 0.00 seconds of radius 550.00 at (Position of (Dying unit)), dealing 300.00 damage of attack type Chaos and damage type Demolition
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
In Warcraft III, everything is event-driven. Whether you've got a piece of code that is executed at initialization or when a unit dies, an item is bought, etc, there are events that dictate when specified actions are executed. If you've got a spell, there is an event that lets you execute code upon that spell being cast (or put into effect).

Once you've decided which events you need to keep track of (make triggers for) you can think about adding conditions to those events. For example, if you want to detect when any ability is cast then you can use the event Unit starts the effect of an ability. If you only want to detect a specific ability then you would need to specify which ability in the Conditions section.

Everything in the pretty GUI is fairly well labeled, and there are descriptions on many of the dialogs that provide information on what specific "actions" do. If you do not understand what they mean, then you can post here with your questions - but I do implore you to read through the drop-down dialogs carefully as many of your questions can be answered by simply reading the GUI.
 
Level 5
Joined
Apr 22, 2011
Messages
152
Use Triggering Unit instead of dying unit.

Could you please explain exactly why "Triggering unit" is better than "Dying unit"?
I always thought it's better not to use Triggering unit everywhere except such cases when there's no specific event-respond unit. Because "Triggering unit is too general and may not work properly sometimes. Maybe I'm just dumb, explain me where am I wrong?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Whenever you've got the opportunity to use Triggering unit, use it. It is the fastest response native for obtaining that specific unit, to the best of my knowledge. If so, then yes, you would be wrong.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Could you please explain exactly why "Triggering unit" is better than "Dying unit"?
I always thought it's better not to use Triggering unit everywhere except such cases when there's no specific event-respond unit. Because "Triggering unit is too general and may not work properly sometimes. Maybe I'm just dumb, explain me where am I wrong?

(Triggering unit) is on the first item on the list, and below it will follow like (Dying unit) and so on
So, using (Triggering unit) will be more efficient
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Though it isn't more efficient simply because it is closer to the top of the drop-down dialog. To my knowledge, the position of an action in the drop-down box has no significance in determining the efficiency of the action.
 
Level 5
Joined
Apr 22, 2011
Messages
152
it is closer to the top of the drop-down dialog
Are you kidding me? (Triggering Unit) is in the bottom of that dialog, nearly the last string in it. So why do I have to use it?
Some time ago I overused (triggering unit) in my triggers and it caused a bunch of really weird bugs which I was unable to fix. So I searched around the internet and eventually found an advice to use exact response to the event. I replaced all of my (triggering units) to such and it started to work. Since then I'm trying never to use (triggering unit) and never had such unfixable bugs.
Now you're saying I'm wrong and I'm trying to understand why. Again, to that drop-down dialog. As you can see it is in the very bottom of the list:
 

Attachments

  • Triggering_unit.png
    Triggering_unit.png
    7.1 KB · Views: 811
Level 19
Joined
Apr 10, 2010
Messages
2,789
You definitely dont get it.
Example, you wanna add an ability to a unit, you use the unit ability action. And it shows this line automatically:
  • Add Ability to (Triggering Unit)
And lets say the event is when a unit enters a region.
So triggering unit would also refer to the unit entering the region.
And when you choose the ability action, it automatically says triggering unit.
Heres a link to prove my point:
http://www.hiveworkshop.com/forums/...quick-tutorial-common-triggering-tips-190802/
Scroll down to conclusion.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@Elvendan
You want to compare between GUI efficiency and JASS efficiency ?
You made my day :')
GUI will show you (Triggering unit) is on the most bottom in the list BUT not in JASS

@Link
In case you missed this out, Elvendan:
Decrease your menu-scrolling time
Not only is (Triggering unit) <<faster>> than (Casting unit) or (Dying unit) in terms of execution time, it's actually faster to click because it is always the first option on the menu tree. Just use (Triggering unit) and, of course, set it to a variable if you use it more than 2-3 times.

Now that that's been mentioned, how about (Owner of (Triggering unit))? Ever notice that (Triggering player) is the first item on the menu-tree? That's because it's able to be used in more cases than you could imagine.

Every event which is selectable as "Any unit ---" is, in JASS, a "playerunitevent". This means that it has two triggering components, a unit, and a player.

Long story short, every "Any unit event" can use (Triggering player) instead of (Owner of (Triggering unit)) and get the same results.

This will cut down on your menu-scrolling time as well as game execution time, so it's faster in every sense of the word.

You can thank PurgeAndFire for showing me the (Triggering player) trick.
 
Status
Not open for further replies.
Top