Scripted Stuns & Victim Knockdowns

The goal here is to create as simple as possible script that can check for enemies being hit and “Wall Smashed” by Doomfist’s Rocket Punch, then apply a status effect.

The flow should look something like this:

Rule 1: Doomfist Rocket Punch = Successful
Condition: Rocket Punch Wall Smash = True

Actions: (Applied to Victim)
-If Player would have died, set HP to 10% (of full)
-Set Status: Knocked Down, Time: 5 sec
-Set Status: Unkillable, Time: 5 sec
-Wait: 5 sec
-Set Move Speed: 75%
-Wait: 3 sec
-Restore Previous Move Speed

I realize this is a bit unconventional, but the goal is to create a more ‘Knockout’ style feel to the Rocket Punch; restoring Doomfist to his canonical Power Level.

Any help you can offer will be greatly appreciated, I know I’m literally miles away from the actual code with this one…

The closest rule set I can think of to achieve this would be:

Rule 1: OnGoing - Each Player
Conditions:
Hero Of(Event Player) = Hero(Doomfist)
Is Using Ability2 = True
Actions:
Abort If Condition Is False
Set Player Variable(Event Player, Punching, True)

Rule 2: Player Dealt Damage
Conditions:
Player Variable(Event Player, Punching) = True
Actions:
Set Status(Victim, Knocked Down, 5)
//this is where you’d do all your other stuff to the Victim
//don’t forget to set the Punching variable to false afterwards

You could even save the victim in a variable and use it later for something else.

Why not put this into one rule?

rule - player dealt damage - all teams - doomfist

condition:
- is firing secondary(event player) == true

action:
- set status(victim, unkillable, 5)
- set status(victim, knocked down, 5)
- etc.

Also, can you explain this:

Why would the condition become false within the next frame?

Yuup, that looks about right. I completely forgot that you can put heroes in the player field for the event. The first rule was just to gather the information needed, this completely avoids that. Abort If Condition Is False stops execution if one of the conditions is false, I’m pretty sure the action lost runs if just one of the conditions is true, I use that instead of an ‘and’ in the conditions because it gets confusing. Does it not work like that, is that not needed?

1 Like

It is not needed. Because all the conditions in a rule are automatically connected with “and”. A rule only gets executed once all of its conditions are true.

1 Like

Question. Conditions don’t get checked constantly, correct? Is Button Held == true for example, a rule with that condition would only be executed once until it changes to false and then back to true. I have not been able to find a case where a rule is executed constantly every frame.

If you want a rule to be executed repeatedly use the “loop” commands at the end. example:

condition:

  • is button held == true

action:

  • x = x + y
  • wait(0.016, ignore condition)
  • loop if condition is true

0.016 is the highest rate you can loop at. But keep in mind, if the “x = x + y” part is something resource-heavy you should better use a longer time interval than 0.016, because it will lower your modes performance.

1 Like

I just want to reiterate what Shanalotte said and add on a little bit to it. It is important that you know the difference between an AND and an OR condition. An AND condition executes ONLY if ALL conditions are true within the statement, it returns false otherwise, even if one condition is false. An OR condition only requires one condition within the statement to return true, if none are true it returns false. Just wanted to add that because it is important and can be mixed up.

Problem with this rule is that OP wanted to detect if the player was smashed into a wall.

I am aware. But maybe its enough for the OP. If not, the OP will probably say so himself.

Lol, actually I was going to come back with that fact right away… but only after I got your initial script working to start with, which surprisingly it hasn’t. It’s almost as if the wall damage is overriding the invincibility granted by “Set Status = Unkillable”.

Despite this being extremely late, in case anyone finds this and has a similar question but the thread as is doesn’t have what they’re looking for, I’ll post this bodge anyways.
If you resurrect the victim, then apply effects (including reapplying damage), then it will kill someone, but, in the case of a team deathmatch setting where revives undo points, it should get rid of the point and then the effects should go off as long as they are after it in the action chain. I’d recommend having a wait after the rez as well so that the victim is definitively alive.