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

Leaving an area question

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, how do i make this even work only one way? Like, if you enter, you lose HP, but if you leave later on, you dont lose HP.

  • Shallow Entrence
    • Events
      • Unit - A unit enters Forest Entrence Bot <gen>
      • Unit - A unit enters Forest Entrence Left <gen>
      • Unit - A unit enters Forest Entrence Top <gen>
      • Unit - A unit enters Forest Entrence Top2 <gen>
      • Unit - A unit enters Forest Entrence Right <gen>
      • Unit - A unit enters Forest Entrence Right top <gen>
    • Conditions
      • (Owner of (Entering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Game - Display to (Player group((Owner of (Entering unit)))) for 10.00 seconds the text: You're entering sha...
      • Set VariableSet ShallowPoint[1] = (Position of (Entering unit))
      • Unit - Set life of (Entering unit) to ((Life of (Entering unit)) - 500.00)
      • Special Effect - Create a special effect at ShallowPoint[1] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Set VariableSet ShallowSPX = (Last created special effect)
      • Special Effect - Destroy ShallowSPX
      • Custom script: call RemoveLocation(udg_ShallowPoint[1])
 
Level 7
Joined
Feb 23, 2020
Messages
253
Why would the trigger reduce HP when a unit leaves region? It's only fired with when a unit enters region.
Maybe i explained myself poorly. I want it work just the way it does in the trigger. BUT when you return, you should not lose HP (Like when you step into this region again you wont take dmg). You should only take damage when you want to enter this area, not leave it.
 
Level 13
Joined
Feb 5, 2018
Messages
567
Maybe i explained myself poorly. I want it work just the way it does in the trigger. BUT when you return, you should not lose HP (Like when you step into this region again you wont take dmg). You should only take damage when you want to enter this area, not leave it.

You could make an boolean variable that is set to either true or false. And mess around with that.
Or an integer counter that is 0. And when entered set it to 1.
This works like a check thing, if the unit has already entered the region.

Then add whatever conditions.
 
Maybe i explained myself poorly. I want it work just the way it does in the trigger. BUT when you return, you should not lose HP (Like when you step into this region again you wont take dmg).
Ok.
You should only take damage when you want to enter this area, not leave it.
Then you describe it wrong again. As entering again != leaving.

An alternative to DoomBlade's way would to use a unit group, and in the trigger you add units to this group when they enter. Furthermore there needs to be a conditon, that you only damage units that are not in said unit group, yet.
 
Level 14
Joined
Nov 17, 2010
Messages
1,266
If you no longer want the region to trigger anything you could remove the region.
You will have to set the regions to a variable and then use:

Custom script: call RemoveRect (udg_YourRect)
 
Level 7
Joined
Feb 23, 2020
Messages
253
I manage to make it work, altough, this could cause a few bugs with more players. How do i make this trigger work for each individual player? :)

  • Shallow Entrence
    • Events
      • Unit - A unit enters Forest Entrence Bot Shallow <gen>
      • Unit - A unit enters Forest Entrence Left Shallow <gen>
      • Unit - A unit enters Forest Entrence Top Shallow <gen>
      • Unit - A unit enters Forest Entrence Top2 Shallow <gen>
      • Unit - A unit enters Forest Entrence Right Shallow <gen>
      • Unit - A unit enters Forest Entrence Right top Shallow <gen>
    • Conditions
      • (Owner of (Entering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Set VariableSet ForestEntrence = (ForestEntrence + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ForestEntrence Equal to 1
        • Then - Actions
          • Game - Display to (Player group((Owner of (Entering unit)))) for 10.00 seconds the text: You're entering sha...
          • Set VariableSet ShallowPoint[1] = (Position of (Entering unit))
          • Unit - Set life of (Entering unit) to ((Life of (Entering unit)) - 500.00)
          • Special Effect - Create a special effect at ShallowPoint[1] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Set VariableSet ShallowSPX = (Last created special effect)
          • Special Effect - Destroy ShallowSPX
          • Custom script: call RemoveLocation(udg_ShallowPoint[1])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ForestEntrence Equal to 2
            • Then - Actions
              • Game - Display to (Player group((Owner of (Entering unit)))) for 10.00 seconds the text: You're leaving shal...
              • Unit - Set life of (Entering unit) to (Life of (Entering unit))
              • Set VariableSet ForestEntrence = 0
            • Else - Actions
Could i use an array and put player number in it?
 
Last edited:
Status
Not open for further replies.
Top