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

[Trigger] Passive variables to triggers w/o Wait MUI?

Status
Not open for further replies.
Level 5
Joined
Jun 24, 2012
Messages
112
If I have a trigger like this:

Trigger 1
Event - Unit Casts Spell
Actions - Pick all units of type Footman
- Set MyVar = Picked Unit
- Damage picked unit

Trigger 2
Event - Unit takes Damage
Actions - Kill MyVar

Basically, I'm just reusing a variable that was set in one trigger and passing it on to another, but there are no waits within any of the triggers, would this still be MUI?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
What you are asking makes no sense...

In Trigger 1, add the picked unit to a unit group. Then in Trigger 2 you kill all units by iterating through that group when a unit takes damage.

Be aware that event objects only get destroyed when the trigger they were created for is. This means that a unit takes damage event attached to a trigger will still exist even if the unit it was bound for was removed. Unless the trigger is destroyed at some stage this becomes and event leak.
 
Level 5
Joined
Jun 24, 2012
Messages
112
What you are asking makes no sense...

In Trigger 1, add the picked unit to a unit group. Then in Trigger 2 you kill all units by iterating through that group when a unit takes damage.

Be aware that event objects only get destroyed when the trigger they were created for is. This means that a unit takes damage event attached to a trigger will still exist even if the unit it was bound for was removed. Unless the trigger is destroyed at some stage this becomes and event leak.

OK let me try to rephrase:

It's for a spell: it throws a fireball at a unit, and if the unit has Buff X, then it runs a certain trigger. In my fireball trigger, it picks all units around the fireball, and if that picked unit has Buff X, then it runs a trigger B that will do some actions. Trigger B needs to know the location of the picked unit & who the picked unit is (that information is set in the Fireball trigger). I just use 2 simple variables with no arrays. Will this cause MUI problems?

Keep in mind it's for a spell and no waits are used.

I can post the entire triggers if needed but they are kinda long.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Short Answer: Yes, it's MUI.
Because Warcraft III is a single-thread where triggers run one after another, it would be MUI IF there is no wait involve.

But I maybe wrong, because what you're doing now is not direct actions.

This is an example of "direct actions" which is MUI no matter what;
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Kill (Triggering unit)
No matter how much unit cast this spell at a time, it will still be MUI.
 
Level 5
Joined
Jun 24, 2012
Messages
112
Short Answer: Yes, it's MUI.
Because Warcraft III is a single-thread where triggers run one after another, it would be MUI IF there is no wait involve.

But I maybe wrong, because what you're doing now is not direct actions.

Yes this is what I'm looking for. It's not a problem for me anyway, just something I am wondering about but I need to make sure. I hope someone can confirm this.

Also @ mckill, i can't do that because my Trigger B has no events, therefore no triggering units so I need to set that variable in a trigger in which there is a triggering unit.

But like I said above, it's not a problem for me, just something I am wondering about.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Which ?
Oh, if you don't believe me, you should run a test ?
Create a 3 triggers that has separate event (3 trigger detects 3 casting ability) like this;
  • Ability 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability 1
    • Actions
      • Set Caster = (Triggering unit)
      • Unit - Set life of Caster to ((Life of Caster) + 100.00)
  • Ability 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability 2
    • Actions
      • Set Caster = (Triggering unit)
      • Unit - Kill Caster
  • Ability 3
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability 3
    • Actions
      • Set Caster = (Triggering unit)
      • Unit - Remove Caster from the game
To order those units to cast those spells at the same time, simply pick them in Unit Group and order them to cast each spell order string.

You will notice in those 3 triggers, they shared the same variable but since Warcraft III is single-threaded, it will run one after another (it can never run at the same time), making the spell MUI (no Wait/Delay is involved, just direct actions)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I used Timer as prepare duration and when Timer expires, order those units to simultaneously cast the spell (each with 3 separate events)
Each cast I set Caster = (Triggering unit)

Prove is, all 3 units died.
 

Attachments

  • Direct Action Simultaneous Cast.w3x
    13.1 KB · Views: 30
I cant view your sample map yet coz I dont have WE now, but if you did like this;
  • Event
    • Timer - Expires
  • Conditions
    • Unit - Issue With No Target(abil 1)
    • Unit - Issue With No Target(abil 2)
    • Unit - Issue With No Target(abil 3)
its still the same as looping through unit groups, but if you do it in multiplayer, it can cause desyncs,
although it's very very rare that 2 players can cast it at the same time as 99.99% of the time, the upper thread casts first...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Melee Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 5.00 seconds
      • Set Timer = (Last started timer)
  • Untitled Trigger 001
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Blood Mage 0000 <gen> to Night Elf Druid Of The Claw - Roar
  • Untitled Trigger 001 Copy
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Blood Mage 0001 <gen> to Night Elf Druid Of The Claw - Roar
  • Untitled Trigger 001 Copy 2
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Blood Mage 0002 <gen> to Night Elf Druid Of The Claw - Roar
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Caster = (Triggering unit)
      • Unit - Kill Caster
although it's very very rare that 2 players can cast it at the same time as 99.99% of the time, the upper thread casts first...
Believe me, Warcraft III uses single-threaded mechanics, it can never runs at the same time.
 
Status
Not open for further replies.
Top