NumTarget (Triggers) (Read 1669 times)

Started by Ricepigeon, September 30, 2015, 08:13:29 pm
Share this topic:
NumTarget (Triggers)
New #1  September 30, 2015, 08:13:29 pm
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
This trigger takes an ID number as an optional argument. If the ID number is omitted, NumTarget returns the current number of targets for the player. If the ID number is included, then NumTarget returns the number of targets for the player which have that target ID number. The ID number must be greater than -1. An ID number of -1 or less will give the same behavior as if the ID number is omitted.

        1.) NumTarget
        2.) NumTarget(exprn)

        Expression evaluating to an ID number (int).

Return type:
Error conditions:
    Returns bottom if exprn evaluates to bottom.

;Triggers if the player currently owns 4 or more targets.
trigger1 = NumTarget >= 4

;Triggers if the player currently owns 4 or more targets with TargetID 1234.
trigger1 = NumTarget(1234) >= 4

Related SCTRL:
BindToTarget (SCTRL)
TargetBind (SCTRL)
TargetDrop (SCTRL)
TargetFacing (SCTRL)
TargetLifeAdd (SCTRL)
TargetPowerAdd (SCTRL)
TargetState (SCTRL)
TargetVelAdd (SCTRL)
TargetVelSet (SCTRL)

Additional Notes:
Whenever using target redirection triggers, it is generally recommended to use NumTarget as an additional trigger. This is done to prevent cases in where Player1 has no target, yet attempts to execute a target redirected trigger, causing an error message to be displayed in the MUGEN console. It is also important that when doing so, that NumTarget be placed before any other triggers on a separate line like so;

triggerall = NumTarget(800)
trigger1 = Target(800),stateno = 801

The same also applies to Target-based SCTRLs such as TargetState and TargetLifeAdd.
Last Edit: November 25, 2015, 04:59:02 am by Odb718