OnNpcTarget hooks not looping all targetsFixed

Anyway to make this loop threw to it will still return the closest target.

        if (Interface.CallHook("OnNpcTarget", (object) this.owner, (object) entity) != null)
          return (BaseEntity) null;
     ​

make it continue the loop otherwise its ignoring all targets in his range.

Changed for staging branch and release this week. Thanks for the report!

Thank you for your work..

Merged post

Im a little confused on this i may be wrong.. in AIBrainSenses
Is this going to block the target from this call  if i return false for just the one target and continue?
It looks like if i return false it will break the loop of the foreach.

if (!((UnityEngine.Object) entity == (UnityEngine.Object) null) && (double) entity.Health() > 0.0)
      {
        if (Interface.CallHook("OnNpcTarget", (object) this.owner, (object) entity) == null)
        {
          float num2 = Vector3.Distance(entity.transform.position, this.owner.transform.position);
          if ((double) num2 <= (double) rangeFraction * (double) this.maxRange && (double) num2 < (double) num1)
            baseEntity = entity;
        }
        else
          break;
      }​


Merged post

I think the else break; should not be there.

Ah derp, those need to be continues... not sure why I was thinking breaks. I'll fix it shortly.

Merged post

Fixed in the latest develop build, sorry about that!

Thank you.

Locked automatically