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

[General] Boss Regeneration

Status
Not open for further replies.
Level 13
Joined
May 10, 2009
Messages
868
Words from MyPad - Posted on another thread from Triggers & Scripts.
On map Initialization, mark all units with a flag that indicates that they are not in combat. They would have their own individual timers.

On an is unit attacked event or a spell cast event, you would start that timer instance, letting it expire after n seconds, where n is the attack cool down of the unit. Of course, that timer is refreshed on subsequent attacked events or spell events. This affects both the attacker and the target.

When the timer expires, if ever, enumerate nearby enemies within n units from the unit in question. If there are any, restart the timer. Otherwise, mark it as idle. (Not in combat)

You can check out Combat Systems in HIVE to see which one suits you best.

When the timer expires, give a Health Regeneration ability to the boss. Remove it when attacking or casting spells.
 
Level 13
Joined
May 10, 2009
Messages
868
The flag he's referring to is a boolean variable to indicate that the unit is in/out of combat. The hash table would make it easier for the system to support multiple units. An alternative way of making it be MUI without a hash table is using dynamic indexing. If you don't care about it being MUI, and want to do that for only one unit, then simply use a few variables: Boolean, timer, and unit.

Boss is attacked/attacks/casts a spell -> Set boolean var to true (in combat), remove regeneration ability, then start timer with X seconds; Timer expired? Check enemies around the boss: If true -> reset timer (start it again). Otherwise, set the boolean to false (out of combat), and give the ability back to the boss.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Some glitch persists. I set the boolean to false initially. If attacked, boolean is true, if true, remove reg and start timer. If it expires and no units in 600 range of the boss, boolean should be false and regeneration should be added. But nothing happens that related to timer.
 
Level 12
Joined
Jul 5, 2014
Messages
551
That part seem to work.

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • OrcBossInCombat Equal to True
      • Then - Actions
        • Unit - Unpause Rag'Thon <gen>
        • Unit - Remove Super heal (Boss) from Rag'Thon <gen>
        • Countdown Timer - Start BossTimer as a One-shot timer that will expire in 10.00 seconds
      • Else - Actions



That part doesn't


  • Events
  • Time - BossTimer expires
  • Conditions
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in (Units within 600.00 of (Position of Rag'Thon <gen>))) Equal to 0
    • Then - Actions
      • Set OrcBossInCombat = False
      • Unit - Add Super heal (Boss) to Rag'Thon <gen>
      • Unit - Pause Rag'Thon <gen>
    • Else - Actions
      • Countdown Timer - Start BossTimer as a One-shot timer that will expire in 10.00 second
 
Level 13
Joined
May 10, 2009
Messages
868
Well, your second trigger doesn't work, because the group in the condition is also counting Rag'Thon too. It'll also count dead units and allies.

  • Set noUnit = True
  • Set point = (Position of unit)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 600.00 of point) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) belongs to an enemy of (Owner of unit)) Equal to True
          • ((Picked unit) is dead) Equal to False
        • Then - Actions
          • Set noUnit = False
        • Else - Actions
  • Custom script: call RemoveLocation(udg_point)
If you change your condition to the code above, then you'll be able to filter out dead units, allies, etc...


  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Attacked unit) Equal to Rag'Thon <gen>
  • Actions
    • Set OrcBossInCombat = True
I'd also take into consideration when Rag'Thon attacks or casts spells.
 
Level 13
Joined
May 10, 2009
Messages
868
I'd rather use another if-statement out of the group enumeration, just to be sure that it checked if there's really no units around.

  • Events
    • Time - timer expires
  • Conditions
  • Actions
    • Set noUnit = True
    • Set point = (Position of unit)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 600.00 of point) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) belongs to an enemy of (Owner of unit)) Equal to True
            • ((Picked unit) is dead) Equal to False
          • Then - Actions
            • Set noUnit = False
          • Else - Actions
    • Custom script: call RemoveLocation(udg_point)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • noUnit Equal to True
      • Then - Actions
        • Unit - Add Item Life Regeneration to unit
      • Else - Actions
        • Countdown Timer - Start timer as a One-shot timer that will expire in 1.00 seconds
 
Level 12
Joined
Jul 5, 2014
Messages
551
But what's that noUnit variable? I get that it should identify if there are units around the boss, but what kind of variable is that? Unit or unit group? And should I specify somewhere what that variable means? (like the point being the position of unit)

Besides, I've beaten up the boss without losing anything and I ran away, but the boss didn't heal even when I set number of units to 1 in case the boss itself is counted. So, no allies, no dead enemies and it still didn't work.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Something's extremely odd here. I tried your map and it worked and I literally copied your triggers, replacing the appropriate variables and it doesn't recognize the out of combat part. Some error either eludes me or the map just trolling, because I have no clue why it still don't work. I attached my map, maybe you could take a look and see what I'm doing wrong. Don't mind the mess.

Edit: Nvm, I managed to find the error now.
 
Last edited:
Status
Not open for further replies.
Top