1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] General Unit Event

Discussion in 'Triggers & Scripts' started by creyzi4zb12, Feb 12, 2009.

  1. creyzi4zb12

    creyzi4zb12

    Joined:
    Oct 3, 2006
    Messages:
    300
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Hello, I'm trying to make this trigger
    Needed:
    -Any kind of unit's (meaning any of all the units in map) HP gets lower than 10%

    Effect:
    -Change the ownership of the "triggering unit" (the unit that has <10%hp) to player 5 (a neutral player)
    -Make "triggering unit" invulnerable
    -Issue order on "triggering unit" to hold position
    -Play "triggering unit's" death animation
     
  2. Livirus

    Livirus

    Joined:
    Feb 2, 2009
    Messages:
    71
    Resources:
    0
    Resources:
    0
    Hmm, I think there's no efficient way of doing this.

    This is me being lazy:
    Events:
    Every 1 sec

    conditions:
    niet/null/nada/nothing

    Actions:
    Pick every unit matching (percentage life of (matching unit) less then (10)%) <--- this is a 'real comparison'
    Do the shit with Picked Unit
     
  3. creyzi4zb12

    creyzi4zb12

    Joined:
    Oct 3, 2006
    Messages:
    300
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Tnx for that....I think I get the picture about your trigger.... +rep
    ANybody got other options about how to do it...just for future knowledge for me. :D

    EDIT:I can't find the appropriate triggers for it.
    It doesn't work at all...I've been looking for the triggers that says "Pick every unit matching (percentage life of (matching unit) less then (10)%)"

    EDIT: Ah,no wait...found it..."real comparison" tnx...
     
    Last edited: Feb 12, 2009
  4. Meticulous

    Meticulous

    Joined:
    Nov 15, 2007
    Messages:
    779
    Resources:
    0
    Resources:
    0
    There's no way in GUI to track non-specific units taking damage. They'd have to be preset. I'm sure someone could give you some JASS help with it if you're willing to experiment, otherwise the periodic event should work fine as long as the timer is low enough.
     
  5. creyzi4zb12

    creyzi4zb12

    Joined:
    Oct 3, 2006
    Messages:
    300
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Only problem with it is that every one second the death animation keeps activating...so it's like the guy is dancing instead of lying on the ground senseless. lol.

    Ah, I dunno how to use JASS, I think I'll stick with GUI.. :p
     
  6. shift4101

    shift4101

    Joined:
    Aug 8, 2008
    Messages:
    17
    Resources:
    0
    Resources:
    0
    It took some looking but you can always use this:

    Event: Unit is Attacked

    Condition: Percent Life of (Triggering Unit) is equal to or less than 10.00

    Events: Change Ownership of (Triggering Unit) to neutral and change color to color of (Triggering Unit)
    Events: Make (Triggering Unit) Invulnerable
    Events: Issue order on (Triggering Unit) to Hold Position
    Events: Play (Triggering Units) Death animation
     
  7. wolfman

    wolfman

    Joined:
    May 31, 2008
    Messages:
    696
    Resources:
    0
    Resources:
    0
    shift, that wont work if the unit loses hp via spell i think
     
  8. Justify

    Justify

    Joined:
    Mar 16, 2008
    Messages:
    935
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    3
    Resources:
    5
    To do this, you need to know the action "Trigger - Add event to xyz", duno the exact name. It adds an event to a trigger.
    a) On map init, pick all units on the map and to "Trigger - Add "picked unit takes damage" to "Mydamagedetection"
    b) a second trigger that fires when a unit enters map and to "Trigger - Add "triggering unit takes damage" to "Mydamagedetection"

    The damage detection trigger itself has no event, but conditions/actions :)
    Same works with hp gets lower then 10% (with any specific event).
     
  9. shift4101

    shift4101

    Joined:
    Aug 8, 2008
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Well its still the best way. I doubt anyone will figure it out thats playing the map anyways... :grin::grin::grin:
     
  10. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    No, it isn't the best way. Check the post above yours :p.

    Speaking of that post, http://www.hiveworkshop.com/forums/pastebin.php?id=jehavo

    Demo map for the trigger that he's talking about. Then you can make a trigger

    Code (Text):
    Events:
    N/A, added by trigger of course

    Conditions
    Life of (Triggering unit) Less than or Equal to (Max life of (Triggering unit)) / 10

    Actions
    <do stuff>
    Hope that helps