Out Of Combat Healing

So I want a set of rules to have it so that around five seconds after dealing damage, or taking damage, you regain 10 hp per second, until you deal or take damage again. I already saw a topic like this, but when I copy pasted it, it didn’t work for me. Any help would be appreciated.

I imagine a way you could attempt this is that you can have a rule like such:

If (Conditions)
Receiving Damage (Event Player) == False

Then (Actions)
Wait (5 (Abort if Condition is True))
Start Heal Over Time((Event Player)[time limit][heal amount]).

I am not that experienced with the Workshop as well, so I am unsure is this would work.

Ok, thanks, I’ll try this asap

You can do it more precisely using 2 player variables or an array with 2 index. First variable A. You make a rule, when player taking damage, Action set varable A to true for 2 second, than set it back to false. Rule 2 When player dealt damage, set variable B to true, wait for 2 sec, than set it back to false. The 3rd rule is ongoing each player, condition set to when player variable A and B is true, also event player is alive, start heal overtime, 9999sec. The last rule is when player variable A or B is not true, stop heal over time.

Sorry, I think my tiny brain is overloaded, is there any chance you could send the script please?

Also, I have a Kill To Heal rule, just wondering if that will effect anything.

Okay, so from what I gather:

Rule 1: player took damage
Action: Set player variable, A, true
Action: Wait 2sec
Action: Set player variable, A, false

Rule 2: player dealt damage
Action: set player variable, B, True
Action: Wait 2sec
Action: set player variable, B, False

Rule 3: ongoing each player
Condition: player variable A and B == True
Action: start heal overtime, 9999sec

Rule 4: ongoing each player
Condition: player variable A and B == False
Action: stop heal overtime

If you were trying to emulate shield health or Mercy’s passive, something simple like this would suffice:

Rule: Player Took Damage
Action: Stop All Healing Over Time (Event Player)
Action: Wait (5 sec, Restart When True)
Action: Start Healing Over Time, 9999sec

The key is the Restart When True. If the conditions trigger again while waiting, the whole event will reset, canceling any existing heal over time and resetting the heal timer.

If you want the event to also trigger when the player deals damage, as far as I can tell you’re very close. Variable A represents “just took damage” and B represents “just dealt damage”. So,

  • Rule 3 should start healing if both A and B are False; i.e. if the player hasn’t recently taken or dealt damage.
    • Condition: player variable A == False
    • Condition: player variable B == False
  • Rule 4 should stop healing if either A or B become True; i.e. if the player has just recently taken or dealt damage.
    • Condition: Or(player variable A, player variable B) == True
  • “Wait” should Restart When True so it resets the timer if the player takes or deals damage again.

What I do for my out of combat regen is set a variable to 5 when the player gives/takes damage, and have another rule that if variable > 5
stop healing over time;
wait 0.9;
modify variable -1;
wait 0.1;
loop if true;
start healing over time

Thanks to all of you I figured it out!

Here’s the code:

Rule 1 (Player Took Damage, Stop Healing)
Event: Player Took Damage;
Condition:
Actions: Stop All Heal Over Time(Event Player); Event Player.ISTAKINGDAMAGE = True; Wait(5, Restart When True); Event Player.ISTAKINGDAMAGE = False;

Rule 2 (Heal Over Time)
Event: Ongoing – Each Player;
Condition: Health(Event Player) != 100; Event Player.ISTAKINGDAMAGE == False;
Actions: Start Heal Over Time(Event Player, Null, 9999, 100);

Here is a run-through of the code I made. You have to make a player variable called Player Variable.ISTAKINGDAMAGE and set it to “False”. After that, you make TWO rules. The first rule is when you take damage, and the other rule heals you when ALL CONDITIONS ARE MET.
On the first Rule, when you take damage, it stops all healing then sets your .ISTAKINGDAMAGE to True, then it waits 5 seconds with a “Restart When True” rule (the most important part of the code). after it sets your .ISTAKINGDAMAGE to False
On the Second Rule, it heals you automatically when 1) .ISTAKINGDAMAGE == False 2) Your health “is not” == 100.

As a heads up, when posting code on the forums it usually makes it more usable when placed inside ~~~

variables 
{
    player:
        26: HoTID
}
rule ("Heal Over Time")
{

    event
   {
        Player Took Damage;
        All;
        All;
    }

    actions
   {
        Stop Heal Over Time((Event Player).HoTID);
        Wait(5, Restart When True);
        Start Heal Over Time(Event Player, Null, 99999, 100);
        Set Player Variable(Event Player, HoTID, Last Heal Over Time ID);
    }
}

Also allows others to immediately import that rule into their scripts, assuming the Workshop UI is available…

1 Like

Thanks! I’ll try that