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

Life % Event

Status
Not open for further replies.
Level 6
Joined
Feb 18, 2010
Messages
153
ok it been awhile since i made maps, ect was wondering, i wanna set a unit to jsut say spawn adds when its health reaches 50% jsut say

but the unit isnt on map at the start of the map, so i can use

UNITS life becomes less than 100000 just say as unit isnt on map at start so i cant select which unit.

i have set up a setunit 1 to entering uni for when he spawns like u do heros on hero survival, but in the option to units life becomes less than 100000 it doesnt let you chose the variables only lets me chose units thats on the map


  • TRigger
    • Events
      • Unit - HERO'S life becomes Less than 100000.00
    • Conditions
    • Actions
      • Unit - Create 1 UNIT for Player 9 (Gray) at (Random point in Region <gen>) facing Default building facing degrees
      • Trigger - Turn off (This trigger)

this one works but in the Hero's part it wont select me select variable only units on map

i wanna set to something like

  • Trigger
    • Events
      • Unit - SetUnit[1] life becomes Less than 100000.00
    • Conditions
    • Actions
      • Unit - Create 1 UNIT for Player 9 (Gray) at (Random point in Region <gen>) facing Default building facing degrees
      • Trigger - Turn off (This trigger)
i got this to set unit when it spawns


  • SetUnit
    • Events
      • Unit - A unit enters Region <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set SetUnit[1] = (Entering unit)
          • Wait 0.01 seconds
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
it will still not work, because the way how events work they will not keep reference the variable, only unit stored in it. This is because events are registered to triggers when the map loads, but you set the variable only when the game runs, but the events dont keep track of your variables(like with region enter event) So you must do something like this:

  • SetUnit
    • Events
      • Unit - A unit enters Region <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set SetUnit[1] = (Entering unit)
          • Trigger - Add (SetUnit[1]'s life becomes less than ...) to Trigger
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
The event may be a little bit differently spelled because I wrote it from top of my head, but this is the way you have to do it. Also from the trigger that should have this event you could remove the already preplaced event
 
Level 6
Joined
Feb 18, 2010
Messages
153
yeah non of its helping there isnt a option to add setunit life event and i dunno how to set trigger to check units health
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
here is example since I have editor opened:

  • aegawer
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Trigger - Add to rrrrr <gen> the event (Unit - (Triggering unit)'s life becomes Less than ((Max life of (Triggering unit)) x 0.50))
  • rrrrr
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: ((Name of (Triggering unit)) + entered map!)
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
yeah non of its helping there isnt a option to add setunit life event and i dunno how to set trigger to check units health
You do know the option. You already did show it in the first trigger. The action "Trigger - Add new event to trigger" allows you to add events to any trigger. The cool thing about this is that you can use variable in there or unit calls like (triggering unit), etc.

On the other hand, I would actually just use DDS. If the unit, which you want to add to the event, is a hero, his health will most likely change.
So when the even is registered, 50% health may mean e.g. 725 health, but later on, as the hero levels up that will no longer be the case, as 50% can later be e.g. 1200 health.

Doing it through DDS, you can check if the health of the unit is less than 50%, if yes, you turn off trigger and do some actions.
 
Status
Not open for further replies.
Top