Using a Hero constant as a condition

Does a Hero constant not actually equal a value? Or does the value TRUE equal anything/everything?

So i have a Rule:
Condition:
Var X = True

Action:
IF Var X = Hero: Sombra
(do stuff)
Else
(do something different)

TLDR;
So I made a rule that IF Sombra hacks someone, they become ‘infected’ for a short while. While ‘infected’, IF they get close to another team mate, they too become Hacked/Infected and so on… This make a chain effect.
Anyways, the 1st person to be hacked By Sombra receives a ‘special’ penalty, which disables Primary/Secondary Fire for a few secs.

The problem is, the 1st half of the rule is ONLY supposed to execute IF the Variable specifically = the hero constant Sombra (which is only set IF that person is hacked by Sombra) else that part is skipped and the rest of the rule exicutes. Well the If = Sombra always executes. Even if the Var x = True (the value TRUE)

Why is this?

EDIT:
So I changed it slightly. Instead of setting Var x = hero Sombra, I set it to a String “Sombra”. Sure enough, the works the way i intended it…Just seem weird why the Value TRUE satisfied the IF statement (IF = Hero Sombra)

Depends in which way you may type cast the Hero constant to, the hero constant can be a class,struct an enum or a macro constant, if its an enum it can be representated as an numeric integer typewhich is by default an underlying type of the Hero enum, Sombra’s enumeration might have the value of 23 as an example, 23 would be an integer and can be compared in a logical expression with any boolean type either True or False, True is everything not equal to 0 and False would just be equal to 0. So in your example you would compare True against 23 which would evaluate as true since 23 is not equal to 0 but equal to 1.

2 Likes