Critical script problem

please help everything that the projectile hits getting damage. even friendly unit. how can i fix that only hostile units get damage?

1 Like

So, your problem is that when a bullet hits a friendly unit, it will take crit damage even though it shouldn’t?
Then, now you have no script that tells hostile players from friendly ones, so let’s add an addtional layer of if statement.

if ((owner of triggering unit) is hostile against (owner of source unit of triggering projectile)) {
 //  Crit rate calc and do damage to a unit
}

You should insert it just inside the 4th if statement, or “if (triggering unit != source unit of triggering projectile)”. (And make sure to move scripts inside the 4th if statement into the newly created if statement.)

1 Like