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

[Spell] Make invunerable until unit is alive

Status
Not open for further replies.
Level 5
Joined
Jan 22, 2023
Messages
51
Hey! I've been around for some time but it's time I decided to make my own post, because I need help! I'm just starting so don't eat me pleaase :cry:


I don't know what event response I should use or maybe I have to change everything to make it work?

  • Faze 1
    • Events
      • Unit - Hell Emperor 0372 <gen>'s life becomes Less than or Equal to 4000
    • Conditions
    • Actions
      • Unit - Add Faze 1 to HE_Unit
      • Unit - Order HE_Unit to Undead: Dreadlord Inferno (Position of (Triggering unit))
      • Unit - Make HE_Unit Invulnerable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Summoned Unit) is alive) Equal to False
        • Then - Actions
          • Unit - Make HE_Unit Vulnerable
        • Else - Actions
Trying to achieve that HE_Unit will be invulnerable until the summoned unit is alive, but can't get it to work :( Also the trigger is not making HE_Unit invulnerable (??)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You appear to have a slight misunderstanding of how triggers work, but don't worry, it's not all that complicated once you get the hang of it.

So your trigger is doing these 5 steps in sequential order:
1) Add Faze 1 to the unit
2) Order unit to cast Faze 1
3) Make unit invulnerable
4) Check if the last created summoned unit is dead
5) If it's dead, make the unit vulnerable again

The problem lies in steps 4/5.

For starters, (Summoned unit) is an Event Response that gets set when a unit is summoned into the game. It's meant to be used with the summon Event.
Here's an example:
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
  • Actions
    • Unit - Kill (Summoned unit)
This trigger will kill a summoned unit the moment it is created. This should work for pretty much all of the summon abilities in the game.

Additionally, your If Then Else which checks the status of the (Summoned unit) is not doing what I think you think it does. The big issue here is that there is no (Summoned unit) since no unit has been created by the Inferno spell yet. The unit has been given an order to cast Inferno but that's just the order, it still hasn't actually finished casting the ability yet. It also appears as though you're under the impression that the Condition is somehow tracking the (Summoned unit) and keeping tabs on it to find out whether it's alive or not. This is not the case, the question your Condition asks -> "Is the summoned unit alive?" is only asked once, and it happens basically at the same exact time as the other Actions.

Fortunately, the solution here is simple, create a new trigger and use that Event I showed you in my example trigger. Then in the Actions make HE_Unit Vulnerable. You don't have to check if the (Summoned unit) is alive here since we know that for a fact.
 
Last edited:
Level 5
Joined
Jan 22, 2023
Messages
51
You appear to have a slight misunderstanding of how triggers work, but don't worry, it's not all that complicated once you get the hang of it.

So your trigger is doing these 5 steps in sequential order:
1) Add Faze 1 to the unit
2) Order unit to cast Faze 1
3) Make unit invulnerable
4) Check if the last created summoned unit is dead
5) If it's dead, make the unit vulnerable again

The problem lies in steps 4/5.

For starters, (Summoned unit) is an Event Response that gets set when a unit is summoned into the game. It's meant to be used with the summon Event.
Here's an example:
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
  • Actions
    • Unit - Kill (Summoned unit)
This trigger will kill a summoned unit the moment it is created. This should work for pretty much all of the summon abilities in the game.

Additionally, your If Then Else which checks the status of the (Summoned unit) is not doing what I think you think it does. The big issue here is that there is no (Summoned unit) since no unit has been created by the Inferno spell yet. The unit has been given an order to cast Inferno but that's just the order, it still hasn't actually finished casting the ability yet. It also appears as though you're under the impression that the Condition is somehow tracking the (Summoned unit) and keeping tabs on it to find out whether it's alive or not. This is not the case, the question your Condition asks -> "Is the summoned unit alive?" is only asked once, and it happens basically at the same exact time as the other Actions.

Fortunately, the solution here is simple, create a new trigger and use that Event I showed you in my example trigger. Then in the Actions make HE_Unit Vulnerable. You don't have to check if the (Summoned unit) is alive here since we know that for a fact.
Hmm now that I deleted "If" Action from the first trigger it actually does make the Unit Invulnerable but still can't get to work making an Unit Vulnerable again after the summoned Unit is dead

  • Faze Vuln
    • Events
      • Unit - A unit Spawns a summoned unit
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Summoning unit) Equal to HE_Unit
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Summoned unit) is alive) Equal to False
        • Then - Actions
          • Unit - Make HE_Unit Vulnerable
        • Else - Actions
Now, thereotically it should check every second if the summoned unit is alive... I think but probably I'm blundering it again
Also, did you specifiy in another trigger that HE_Unit = your Hell Emperor? Otherwise it might just be blank
Yes I did in another trigger
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
Try with dedicated triggers if stuffing everyting in a single one doesn't work :D

  • Summon
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (Your custom unit)
    • Actions
      • Set Summon = (Triggering unit)
  • Vulnerable
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to Summon
    • Actions
      • Unit - Make HE_Unit Vulnerable
This should do the trick I believe
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hmm now that I deleted "If" Action from the first trigger it actually does make the Unit Invulnerable but still can't get to work making an Unit Vulnerable again after the summoned Unit is dead

  • Faze Vuln
    • Events
      • Unit - A unit Spawns a summoned unit
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Summoning unit) Equal to HE_Unit
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Summoned unit) is alive) Equal to False
        • Then - Actions
          • Unit - Make HE_Unit Vulnerable
        • Else - Actions
Now, thereotically it should check every second if the summoned unit is alive... I think but probably I'm blundering it again

Yes I did in another trigger
Edit: I think I misread your first post, I thought you said you wanted HE_Unit to be Invulnerable while casting the spell, and then Vulnerable again once the Infernal is created. Do what Chaosium said above.


But if that is actually what you wanted then you can do this:
  • Faze 1
    • Events
      • Unit - Hell Emperor 0372 <gen>'s life becomes Less than or Equal to 4000
    • Conditions
    • Actions
      • Unit - Add Faze 1 to HE_Unit
      • Unit - Order HE_Unit to Undead: Dreadlord Inferno (Position of HE_Unit)
      • Unit - Make HE_Unit Invulnerable
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
    • (Unit-type of (Summoned unit) Equal to Infernal)
    • ((Summoning unit) Equal to HE_Unit
  • Actions
    • Unit - Make HE_Unit Vulnerable
The Unit-type check is optional, it's just useful if your HE_Unit can make other types of summons so that they don't interfere.

Now when the Infernal is summoned the summoner (HE_Unit) will become Vulnerable.
 
Level 5
Joined
Jan 22, 2023
Messages
51
Try with dedicated triggers if stuffing everyting in a single one doesn't work :D

  • Summon
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (Your custom unit)
    • Actions
      • Set Summon = (Triggering unit)
  • Vulnerable
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to Summon
    • Actions
      • Unit - Make HE_Unit Vulnerable
This should do the trick I believe
Actually that's exactly what I needed! Thank you!
Also Your, Uncle, trigger will surely be usable aswell, maybe not now but in the future! :grin:
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Now, thereotically it should check every second if the summoned unit is alive... I think but probably I'm blundering it again
Doesn't work that way. Summoned Unit and Summoning Unit only exist as event responses when the trigger is actually triggered by a relevant event. When the timer event fires, those event responses have a value of null. Well, most of them do; there are a few that work sort of like global variables that you can reference after-the-fact but it's not relevant here.

It fails the condition check every time the timer event goes off (because HE_Unit isn't null like Summoning Unit is), and even if it didn't fail that the If/Then/Else block would always evaluate to True (because a feeding a null unit variable into "is unit alive?" returns "false") and instantly remove the invulnerability.
 
Status
Not open for further replies.
Top