• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help, no player units in region so a boss enemy regenerates health

Status
Not open for further replies.
Level 2
Joined
May 4, 2010
Messages
7
Yeah, i have had problems with this one, even years ago when i was using the editor a lot. Now i simply need to know how to do this step by step, i have seen people on this site explaining it with how the triggers should look like but i can't even seem to find the specific triggers

How do i do this, couldn't get it to work 6 years ago, still can't. Need a good explanation, not just the total triggers without any explanation how to get them.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
There are numerous ways to do this, but probably one of the easiest ways would be something to the effect of...

Checking for units around the boss every (how often you want) and then adding/removing/increasing/decreasing lvl of a regen ability.

So it would be:

Every X seconds of gametime (something like 1 second is probably good enough, but it's up to you)

TempUnit = Boss
TempPoint = Position of Boss

TempGroup = Units within X range of TempPoint

Pick every unit in TempGroup
Set TempUnit2 = Picked Unit
If TempUnit2 = Hero, Alive, enemy of Boss etc // Whatever your conditions are
Then
Remove the Unit from TempGroup
Else
--

Then check
If the number of Units in TempGroup is < 1.
Then
Set regen ability to Lvl 1
Else
Set regen ability to Lvl 2

call RemoveLocation(udg_TempPoint)
call DestroyGroup(udg_TempGroup)

If the Group has less than 1 unit in it, it is empty, meaning that no one is near the boss and the boss should get the regen.

You then set the regen ability to Level 1, meaning the regen will be turned on.

Remember in the object editor you'll need to define level 1 as having X amount of regen (however much you want)

You also need to define the regen ability for Level 2 but for this one you will want to put it at 0 so that the boss's regen is turned off. (Although do not forget the boss still may have innate regen that this will not toggle off).

Sorry about the formatting, working off phone.
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
if you want the boss to return to full hp right away just set life of unit to max life of unit. if the boss is pre-placed you can just select it through the trigger editor. if you want the boss to just regenerate you could add an ability and remove it if the unit is attacked.(or you could use unit enters region). event needs to be unit leaves region. you could try it out and then respond. i should be able to help you better.
 
Level 15
Joined
Sep 6, 2015
Messages
576
Here's another solution that works illustrated:

First you'll need to create an ability based on "Unholy Aura (Neutral Hostile)" ability, and tweak it to your liking, so it has regen. Remove the icon, buff and "Art - Target", remove the additional speed it provides, set targets allowed to only Self and regen to anything you want, if you want it to look like normal life regen without a spell. You can also change anything else you want for that spell and remove the icon from the "Unholy Aura" buff also, so it doesn't show a small icon in the interface in-game when the aura is active. After that, add that spell to the spells of your regenerating boss.

Next, suppose this is your boss (Phoenix), your region where units shouldn't be for him to regen (the big one), and the small region to where corpses are relocated from the big region (I will explain the need for this one later):
sl3OkIv.jpg

You need these triggers:
This one removes the regen when a unit enters the region:

  • Untitled Trigger 002
    • Events
    • Unit - A unit enters Region 000 <gen>
    • Conditions
    • ((Owner of (Entering unit)) controller) Equal to User
    • Actions
    • Unit - Remove Unholy Aura (Neutral Hostile) from Phoenix 0000 <gen>
This one adds the regen when there are no units in the region after a unit has left it:

  • Untitled Trigger 001
    • Events
    • Unit - A unit leaves Region 000 <gen>
    • Conditions
    • ((Owner of (Triggering unit)) controller) Equal to User
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in (Units in Region 000 <gen> owned by Player 1 (Red))) Equal to 0
    • (Number of units in (Units in Region 000 <gen> owned by Player 2 (Blue))) Equal to 0
    • Then - Actions
    • Unit - Add Unholy Aura (Neutral Hostile) to Phoenix 0000 <gen>
    • Else - Actions
This trigger adds the regen to the boss when there are no units in the region after a unit has died in it:

  • Untitled Trigger 001 Copy
    • Events
    • Unit - A unit Dies
    • Conditions
    • ((Owner of (Triggering unit)) controller) Equal to User
    • (Region 000 <gen> contains (Position of (Dying unit))) Equal to True
    • Actions
    • Set point = (Center of Region 001 <gen>)
    • Unit - Move (Dying unit) instantly to point, facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_point)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in (Units in Region 000 <gen> owned by Player 1 (Red))) Equal to 0
    • (Number of units in (Units in Region 000 <gen> owned by Player 2 (Blue))) Equal to 0
    • Then - Actions
    • Unit - Add Unholy Aura (Neutral Hostile) to Phoenix 0000 <gen>
    • Else - Actions
The only drawback of this system is that corpses of the units dying in the boss regen area have to be relocated to another region in this previous trigger for it to work properly.

I'm putting the test map in the attachment so you can test and copy all this from it.
 

Attachments

  • BossRegen.w3x
    18.7 KB · Views: 42

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
You want a little state machine such as the following...
Code:
Wait for unit to enter boss -> poll units and boss -(if all friendly units dead)> heal boss and go back to start
                                                \---(if boss dead)> wait for respawn and go back to start
Although polling is generally bad for performance, it will only poll when appropriate and with a poll period of 1-2 seconds there is no concern at all.
 
Level 2
Joined
May 4, 2010
Messages
7
Ok, this is a lot of response, to clarify what is the situation, you can do this map with multiple people, so if everyone either leaves the certain area and/or is dead, the boss will regen health. What would be the best solution for the problem. Will try tomorrow cause i'm rather busy today :) Thanks for all your help allready.
 
Status
Not open for further replies.
Top