• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 25
Joined
Sep 26, 2009
Messages
2,390
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