Can AI be programmed to use countermeasures?

If you put unitSetProperties directly into missile check trigger, you will get less code. No need to referr to additional trigger.

Not sure if I get it. The aim is to make bot to launch flares, right?

yes

image

my mission require scalability. i cant create separate sln for each aircraft

the point was to create selfrefering trigger that will reapeat itself until i say stop

Ah, ok, now I get the point.
How do you start/stop it? As I understand, “playerShortcutPressed” condition works only in SP missions.
I usually create missions by URL where this function does not work.

but it doesnt look for player shortcutpressed.
rn, im only looking of player have missile in world and then filter it with another condition, like distance or line of sight.
then i launch trigger that theoreticly should launch flares for sec or two and then stop untill new missile

updated logic.

so here one launch takes 0.2sec, i control time using

 wait{
        time:r=2
      }

so i get around 10 launches…

triggers{
  isCategory:b=yes
  is_enabled:b=yes

  missile{
    is_enabled:b=yes
    comments:t=""

    props{
      actionsType:t="PERFORM_ONE_BY_ONE"
      conditionsType:t="ALL"
      enableAfterComplete:b=yes
    }

    events{
      periodicEvent{
        time:r=5
      }
    }

    conditions{
      unitWhenStatus{
        object_type:t="hasMissilesInWorld"
        check_objects:t="any"
        object_marking:i=0
        object_var_name:t=""
        object_var_comp_op:t="equal"
        object_var_value:i=0
        target_type:t="isAlive"
        check_period:r=1
        object:t="player"
      }

      playerSeesUnit{
        target_type:t="isAlive"
        check_targets:t="any"
        target:t="phantoms"
        viewAngle:r=90
        distance:r=2000
      }
    }

    actions{
      playHint{
        hintType:t="standard"
        name:t="missile"
        action:t="show"
        shouldFadeOut:b=no
        isOverFade:b=no
        time:r=-1
        priority:i=0
        target_marking:i=0
        object_var_name:t=""
        object_var_comp_op:t="equal"
        object_var_value:i=0
      }

      triggerEnable{
        target:t="Flares"
      }

      wait{
        time:r=2
      }

      triggerDisable{
        target:t="Flares"
      }
    }

    else_actions{}
  }

  Flares{
    is_enabled:b=no
    comments:t=""

    props{
      actionsType:t="PERFORM_ONE_BY_ONE"
      conditionsType:t="ANY"
      enableAfterComplete:b=yes
    }

    events{
      periodicEvent{
        time:r=0.1
      }
    }

    conditions{}
    actions{
      unitSetProperties{
        object:t="phantoms"

        plane{
          weaponTriggers{
            trigger:t="countermeasures"
            set:b=yes
          }
        }
      }

      wait{
        time:r=0.1
      }

      unitSetProperties{
        object:t="phantoms"

        plane{
          weaponTriggers{
            trigger:t="countermeasures"
            set:b=no
          }
        }
      }
    }

    else_actions{}
  }
}

Hmmm, I made F-18 to drop one flare. Then trigger stopped working at all.


i found the way to scale the solution
requires at least 3 triggers per unit
cruck only in multiplayer…
in furbal looking good though

1 Like