• 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] Hiding Units during channeling abilities

Status
Not open for further replies.
Level 2
Joined
Aug 9, 2012
Messages
19
I'm trying to make a unit invisible and untargetable while channeling an ability, I've been using the hide unit trigger and got it to work, but I can't get the unit to reappear.
 
Level 2
Joined
Aug 9, 2012
Messages
19
  • Here's my trigger
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Heaven's Wrath
    • Actions
      • Unit - Hide (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Countdown Timer - Start Heavens_Wrath_Timer as a One-shot timer that will expire in 5.00 seconds
        • Else - Actions
          • Unit - Unhide (Triggering unit)
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
You have no idea what you're doing, do you? :D

The If/Then/Else structure can be divided into three obvious blocks. The "If" block is a place for various conditions. The "Then" block is for actions that take place if all conditions of the "If" block are true/correct. The "Else" block is for actions that take place when any condition of the "If" block fails.

Basically this statement: "If the sky is cloudy it rains, else it's sunny day." would be written in GUI as this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • The sky is cloudy equals to True
    • Then - Actions
      • It rains
    • Else - Actions
      • It's sunny day
So you have no condition and in that case it will always be true. So your ITE will always use the "Then" block - so it starts a 5 second timer.

Also, I'm not sure what you are trying to achieve here, but if you think the count down timer will serve as a 5-second wait, then you are mistaken.
 
Level 2
Joined
Aug 9, 2012
Messages
19
You're right about I don't know what I'm doing, I'm still kinda learning this. :p
So what you're saying is the ITE isn't necessary and instead of the timer i should use wait?

Edit: Figured it out now, I didn't think it was that simple I feel so dumb now. XD
But thanks anyways.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
There are 3 delaying types :
Countdown timers , they aren't MPI
Waits aren't MPI
Trigger with periodic event and increasing integer ( Absolutely MPI )

You may use TWPAII ( Trigger with periodic event and an increasing integer - Don't clap plz - ) to make custom MPI-MUI spells and MPI systems and triggers like the one you're trying to make now
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Waits are actually MUI if used right with or even without simple indexing.
Countdown timers, if used right, can be used and re-used and will absolutely be MUI, however to use them correctly requires to save their handles into hashtable afaik and the process after that is quite similar to the 3rd option - to periodic event.
 
Level 18
Joined
Jul 3, 2010
Messages
536
Add a global named Heavens_Wrath_Unit and replace your trigger with these two:
  • Events
    • Unit - A unit Begins channeling an ability
  • Conditions
    • (Ability being cast) Equal to Heaven's Wrath
  • Actions
    • Set Heavens_Wrath_Unit = (Triggering unit)
    • Unit - Hide (Triggering unit)
    • Countdown Timer - Start Heavens_Wrath_Timer as a One-shot timer that will expire in 5.00 seconds
  • Events
    • Time - Heavens_Wrath_Timer expires
  • Conditions
  • Actions
    • Unit - Unhide Heavens_Wrath_Unit
    • Set Heavens_Wrath_Unit = No unit
However, this will result in this spell not being MUI: if unit (1) uses it and then unit (2) uses it while unit (1) is still hidden, only unit (2) will reappear.
You will need some sort of GUI indexing for it to work for multiple units. If you're interested in those, I will post an example of that too.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
If you do it with waits, it will look like this:
  • Events
    • Unit - A Unit Begins channeling an ability
  • Conditions
    • (Ability being cast) Equal to Heaven's Wrath
  • Actions
    • Unit - Hide (Triggering unit)
    • Wait 5.00 second game time
    • Unit - Unhide (Triggering unit)
The trigger above is fully MUI.
While simple, you still need to consider if cons are greater than pros with waits
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Using arrayed variable can make your trigger to become MPI.
Using indexing technique can make your trigger to become MUI.

What's the deal with MPI and MUI ?

MPI (Multi-player Instanceability)
You can have at max 16 (if you want to include Neutral Players too) units (each own by a player) casting/using the trigger at once.
More than that, it will bug.
Also, ONE player can only interact with the trigger using ONE unit only.
Player 1, 1 unit.
Player 2, 1 unit.
...
Player 16, 1 unit.

If a player have 2 units using the trigger, the first unit will get overwritten by the second one.

Example:

  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set PlayerNumber = (Player number of (Triggering player))
      • Set PlayerUnit[PlayerNumber] = (Triggering unit)
      • Set PlayerDuration[PlayerNumber] = 5.00
      • Unit Group - Add PlayerUnit[PlayerNumber] to UnitGroup
      • Trigger - Turn on Loop <gen>
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Set PlayerNumber = (Player number of (Owner of TempUnit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PlayerDuration[PlayerNumber] Greater than 0.00
                  • (TempUnit is alive) Equal to True
                • Then - Actions
                  • Set PlayerDuration[PlayerNumber] = (PlayerDuration[PlayerNumber] - 0.03)
                  • Set TempLoc = (Position of TempUnit)
                  • Set TempLoc2 = (TempLoc offset by 10.00 towards (Facing of TempUnit) degrees)
                  • Unit - Move TempUnit instantly to TempLoc2
                  • Custom script: call RemoveLocation(udg_TempLoc)
                  • Custom script: call RemoveLocation(udg_TempLoc2)
                • Else - Actions
                  • Unit Group - Remove TempUnit from UnitGroup
MUI (Multi-unit Instanceability)
You can have at most 8192 units using this trigger at a time (it will be almost impossible to create 1,000 units at a time in a map, right?) so this limit will be more than enough.
This is why MUI > MPI.

Example:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set MaxIndex = (MaxIndex + 1)
      • Set Unit[MaxIndex] = (Triggering unit)
      • Set Duration[MaxIndex] = 5.00
      • Trigger - Turn on Loop <gen>
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • For each (Integer CurrentIndex) from 1 to MaxIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Duration[CurrentIndex] Greater than 0.00
                  • (Unit[CurrentIndex] is alive) Equal to True
                • Then - Actions
                  • Set Duration[CurrentIndex] = (Duration[CurrentIndex] - 0.03)
                  • Set TempLoc = (Position of Unit[CurrentIndex])
                  • Set TempLoc2 = (TempLoc offset by 10.00 towards (Facing of Unit[CurrentIndex]) degrees)
                  • Unit - Move Unit[CurrentIndex] instantly to TempLoc2
                  • Custom script: call RemoveLocation(udg_TempLoc)
                  • Custom script: call RemoveLocation(udg_TempLoc2)
                • Else - Actions
                  • Set Duration[CurrentIndex] = Duration[MaxIndex]
                  • Set Unit[CurrentIndex] = Unit[MaxIndex]
                  • Set MaxIndex = (MaxIndex - 1)
 
Status
Not open for further replies.
Top