Target unit within range matching condition?

Discussion in 'World Editor Help' started by Chaltier, Sep 26, 2018.

  1. Chaltier

    Chaltier Cool Member

    Ratings:
    +1 / 0 / -0
    Hey, been forever since I've posted here, but just picking up an old project and wondering if anyone could help me with a trigger.

    Basically, I want the ability to do the following:

    Summon a unit with 5 mana and a single-target, non-autocast ability based on Rejuvenation on a 2.99-second cooldown costing 1 mana per cast. What I want from the trigger is for the unit to automatically cast this ability every 3 seconds on the lowest-health ally without the Rejuvenation buff in range until it's out of mana, at which point it will be removed.

    When I thought up the ability, I thought for sure there'd be some way to pick a single unit out of the "pick units in range matching condition" function, because that seems like a pretty basic and essential functionality, but I can't find it. The problem with using an autocast heal and then triggering the Rejuvenation from another dummy unit is that it doesn't check the buff status of the unit it heals, and since I don't want the ability to heal anything immediately it would keep trying to heal the same lowest unit over and over again, overwriting itself.

    Anyway, I'd really appreciate it if someone could suggest a solution or tell me how to go about this. Thanks!
     
    Last edited: Sep 26, 2018
  2. Chaltier

    Chaltier Cool Member

    Ratings:
    +1 / 0 / -0
    Apologies for wasting forum space, I found a workable solution. Instead of just deleting my post I figure I'll post how I solved it (in GUI) just in case someone else has a similar problem. Feel free to delete this thread if it bothers.

    The following trigger is activated by another trigger as soon as RejuvUnit is created and set as a variable:

    Code:
    Rejuv Autocast
        Events
            Time - Every 3.10 seconds of game time
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                'IF'-Conditions
                    (Mana of RejuvUnit) greater than/equal to 1.00
                'THEN'-Actions
                    Unit Group - Pick every unit in (Units within 500.00 of (Position of RejuvUnit) matching ((((Matching unit) belongs to an ally of (Owner of RejuvUnit)) equals True) and (((Matching unit) has buff Rejuvenation ) equals False))) and do (Actions)
                        Loop - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                'IF'-Conditions
                                    Or - Any (Conditions) are true
                                        Conditions
                                            (RejuvTarget is alive) equals False
                                            (Percentage life of (Picked unit)) less than (Percentage life of RejuvTarget)
                                'THEN'-Actions
                                    Set RejuvTarget = (Picked unit)
                                'ELSE'-Actions
                    Unit - Order RejuvUnit to Night Elf Druid of the Claw - 'Rejuvenation' RejuvTarget
                'ELSE'-Actions
                    Unit - Remove RejuvUnit from the game
                    Trigger - Turn off (This trigger)
    (Edit: Formatting and translating German editor to English. Some terms may not be exactly as they appear in the English editor.)
     
    Last edited: Oct 3, 2018
    • Informative Informative x 1
  3. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    is it possible to give it to the unit you want it cast on and tell it to cast it on self?, and then take it away?

    or perhaps change the ability to a false summons, it would summon a dummy unit that would just cast the ability on the summoner?( after you trigger issuing the order)
     

Share This Page