• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] How can i make the boolean works for 3 seconds?

Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello everyone. I am trying to create item like this
When you cast spells on enemy, it protects the caster for 3 seconds. The problem it, i want to add cooldown to it. I want to make it work for 1 time in 10 seconds.
Here is the trigger and i am confused.This item must be works 1 times in 10 seconds period.

  • Robe of Protection Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) has an item of type Robe of Protection |cff87cefa(Intelligence Unique)|r) Equal to True
      • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
      • ((Casting unit) is in CapeGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to CapeGroup
      • Set CapeBoolean[(Player number of (Owner of (Casting unit)))] = True
      • Wait 10.00 seconds
      • Unit Group - Remove (Triggering unit) from CapeGroup
  • Robe of Protection Cast2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) has an item of type Robe of Protection |cff87cefa(Intelligence Unique)|r) Equal to True
      • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
      • CapeBoolean[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = True
      • Game - Display to (All players) for 1.00 seconds the text: |cff00ff00True|r
      • Wait 3.00 seconds
      • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = False
      • Game - Display to (All players) for 1.00 seconds the text: |cffff0000False|r
  • Robe of Protection Resist
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • CapeBoolean[(Player number of (Owner of DamageEventTarget))] Equal to True
    • Actions
      • Set DamageEventAmount = (DamageEventAmount x 0.40)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
  • Robe of Protection Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Robe of Protection |cff87cefa(Intelligence Unique)|r) Equal to True
      • ((Triggering unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
      • ((Triggering unit) is in CapeGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to CapeGroup
      • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = True
      • Wait 3.00 seconds
      • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = False
      • Wait 7.00 seconds
      • Unit Group - Remove (Triggering unit) from CapeGroup
Keep in mind this trigger will only work for 1 Unit per Player (MPI). To make it MUI you could use a Unit Indexer and switch Player Number to Custom Value.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
I have a unit indexer but changing owner of triggering unit to custom value of triggering unit will solve my issues?
My trigger will solve your issues.

BUT if you want the trigger to work for any number of Units then you will have to use something like Unit Indexing.

Each Player has a number that you can get. This is their Player Number:

Player 1 (Red) = 1
Player 2 (Blue) = 2
Player 3 (Teal) = 3

A Unit Indexer is a system that gives each Unit a number very similar to Player Number:

First unit = 1
Second unit = 2
Third unit = 3

The Unit Indexer system does this using this action:
  • Unit - Set the custom value of (some unit) to X
So if you understand how to use Player Numbers in your Variable Arrays then it shouldn't be too hard to figure out how to use a Unit Indexer. It's basically the same exact idea. This tells you everything you need to know: GUI Unit Indexer 1.4.0.0
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
No it is ok because player have a 1 hero.
I did some corrections but it seems i have failed again.
Boolean never sets True when i cast spells on enemy.

  • Robe of Protection Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) has an item of type Robe of Protection |cff87cefa(Intelligence Unique)|r) Equal to True
      • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
      • ((Casting unit) is in CapeGroup) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to CapeGroup
      • Set CapeBoolean[(Custom value of (Triggering unit))] = True
      • Wait 3.00 seconds
      • Set CapeBoolean[(Custom value of (Triggering unit))] = False
      • Wait 7.00 seconds
      • Unit Group - Remove (Triggering unit) from CapeGroup
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Hold on. You said it is for only 1 unit.
Is it means it works for all player slots? (every player have 1 hero)

Update: I did some experiment and it is working for 1 player (i don't know is it works for other players) but this time i have realized this aura stays more than 3 seconds and i don't know why. I am destroying RobeofGuardianEffect but still it stays more than 3 seconds i am sure about it.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • ((Casting unit) has an item of type Robe of Protection |cff87cefa(Intelligence Unique)|r) Equal to True
    • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
    • ((Casting unit) is in CapeGroup) Equal to False
    • (Target unit of ability being cast) Not equal to No unit
  • Actions
    • Unit Group - Add (Triggering unit) to CapeGroup
    • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = True
    • Special Effect - Create a special effect attached to the origin of (Triggering unit) using war3mapImported\RobeOfGuardian.mdx
    • Set RobeofGuardianEffect[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
    • Wait 3.00 seconds
    • Set CapeBoolean[(Player number of (Owner of (Triggering unit)))] = False
    • Special Effect - Destroy RobeofGuardianEffect[(Player number of (Owner of (Triggering unit)))]
    • Wait 7.00 seconds
    • Unit Group - Remove (Triggering unit) from CapeGroup
 
Last edited:
Top