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

[Trigger] Rect Regeneration?

Status
Not open for further replies.
Level 5
Joined
Jul 18, 2007
Messages
110
  • Essence of Darkness
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (|c00FFFF00Moria 0391 <gen> is alive) Equal to True
    • Actions
      • Set temp_group = (Units in Essence of Darkness <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Set varUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of varUnit) Less than (Max life of varUnit)
              • (varUnit belongs to an ally of Player 8 (Pink)) Equal to True
            • Then - Actions
              • Set tempInteger = (Integer((Life of varUnit)))
              • Unit - Set life of varUnit to ((Real(tempInteger)) + 4.00)
              • Custom script: call UnitAddAbility(udg_varUnit,'B02A')
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup (udg_temp_group)
Thanks to CokeMonkey for it.

Point was to make a rect targeted regeneration, i.e. units in a rect get a certain life regeneration ability, but I was having trouble removing it if they're not in it. This would also have to add a sorta dummy buff. Well, got it to work, except it doesn't show the buff, and need to find a way to put a timer on it maybe. Any ideas?
 
Level 8
Joined
Mar 12, 2008
Messages
437
Perhaps, if a unit enters an area, you add the buff/ability, and when it leaves, you remove the buff/ability.

Alternatively, you can check every 0,1 seconds or so for units who are in the rectangle but don't have the buff/ability, or units who're not in the rect but still have the buff/ability.
 
Level 5
Joined
Jul 18, 2007
Messages
110
I assumed you meant try making two different triggers to turn the other off/on as the units leave and enter?

  • Sands of Healing Copy
    • Events
      • Unit - A unit enters Sands of Healing <gen>
    • Conditions
      • (|c00FFFF00Umbar 0275 <gen> is alive) Equal to True
      • ((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
    • Actions
      • Set temp_group = (Units in Sands of Healing <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Add Sands of Healing (Umbar) to (Picked unit)
      • Trigger - Turn on Sands of Healing Copy Copy <gen>
  • Sands of Healing Copy Copy
    • Events
      • Unit - A unit leaves Sands of Healing <gen>
    • Conditions
      • (|c00FFFF00Umbar 0275 <gen> is alive) Equal to True
      • ((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
    • Actions
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Remove Sands of Healing (Umbar) from (Picked unit)
Didn't work.
 
Level 8
Joined
Mar 12, 2008
Messages
437
I assumed you meant try making two different triggers to turn the other off/on as the units leave and enter?

  • Sands of Healing Copy
    • Events
      • Unit - A unit enters Sands of Healing <gen>
    • Conditions
      • (|c00FFFF00Umbar 0275 <gen> is alive) Equal to True
      • ((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
    • Actions
      • Set temp_group = (Units in Sands of Healing <gen>)
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Add Sands of Healing (Umbar) to (Picked unit)
      • Trigger - Turn on Sands of Healing Copy Copy <gen>
  • Sands of Healing Copy Copy
    • Events
      • Unit - A unit leaves Sands of Healing <gen>
    • Conditions
      • (|c00FFFF00Umbar 0275 <gen> is alive) Equal to True
      • ((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to True
    • Actions
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Remove Sands of Healing (Umbar) from (Picked unit)
Didn't work.

Here's an alternative

  • Trigger
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching CONDITION and do (Actions)
        • Loop - Actions
          • Set P[1] = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • P[1] is in Rect Equal to true
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Sands of Healing) Equal to True
                • Then - Actions
                • Else - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at P[1] facing Default building facing degrees
                  • Unit - Add Sands of Healing Buff Placer to (Last created unit)
                  • Unit - Order (Last created unit) to Place Buff on (Picked unit)
                  • Unit - Remove (Last created unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Sands of Healing) Equal to True
                • Then - Actions
                  • Unit - Remove Sands of Healing buff from (Picked unit)
                • Else - Actions
      • Custom script: call RemoveLocation(udg_P[1])
Sands of Healing is a buff.
Sands of Healing Buff Placer is an ability that places the buff on a unit.
P is a point variable.

You also need a second trigger that heals all units with the buff.
 
Level 5
Joined
Jul 18, 2007
Messages
110
Would't the easiest thing be to change the rect into a circle and use the life regeneration aura?
Easier, but much less precise. =(

Ok, I'm trying this but I have a few questions. Could the time be changed to every 1.00 second of game time, would it matter? What does the script, Custom script: set bj_wantDestroyGroup = true, do? I'm not quite understanding this part: "P[1] is in Rect Equal to true," wasn't the P[1] the position, not the unit, so shouldn't this be Picked unit? For "((Picked unit) has buff Sands of Healing) Equal to True," how is the unit suppose to have the buff when we haven't added it yet..? I don't seem to the see the option to do "Unit - Order (Last created unit) to Place Buff on (Picked unit)" from the function =/. Also, why don't we set a variable for picked unit, since we are using it so frequently?

On the second trigger, would my previous healing setup work?
Code:
 (Life of varUnit) Less than (Max life of varUnit)
 (varUnit belongs to an ally of Player 8 (Pink)) Equal to True

 Then - Actions

 Set tempInteger = (Integer((Life of varUnit)))
 Unit - Set life of varUnit to ((Real(tempInteger)) + 4.00

Couldn't I just add this to the end of the initial trigger instead?

Thanks.
 
Last edited:
Level 8
Joined
Mar 12, 2008
Messages
437
1.Could the time be changed to every 1.00 second of game time, would it matter?
2. What does the script, Custom script: set bj_wantDestroyGroup = true, do? 3. I'm not quite understanding this part: "P[1] is in Rect Equal to true," wasn't the P[1] the position, not the unit, so shouldn't this be Picked unit?
4. For "((Picked unit) has buff Sands of Healing) Equal to True," how is the unit suppose to have the buff when we haven't added it yet..?
5. I don't seem to the see the option to do "Unit - Order (Last created unit) to Place Buff on (Picked unit)" from the function =/.
6. Also, why don't we set a variable for picked unit, since we are using it so frequently?

1. It doesn't really matter, no. It will just make a slight delay when removing the buff at some times.
2. Prevents the unit group from leaking.
3. I think you can use either.
4. It first checks if the unit has the buff. If the unit already has the buff, nothing happens. If the unit doesn't have the buff, a dummy unit will add it.
5. That's correct; there is no "Place Buff" ability itself. It's supposed to be whatever ability you based the buff placing ability.
6. You can do that, variables just aren't my cup of tea ^^

Hope this made things a bit clearer.
 
Status
Not open for further replies.
Top