YesNoOk
avatar

PlayerIDExist (Triggers) (Read 1047 times)

Started by Ricepigeon, September 14, 2015, 08:31:15 pm
Share this topic:
PlayerIDExist (Triggers)
New #1  September 14, 2015, 08:31:15 pm
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
    • ricepigeon.neocities.org
Returns 1 if a player with the specified ID number exists, 0 otherwise. This ID number is obtained using the "ID" trigger (see ID). Do not confuse PlayerID with TargetID.

Format:
    PlayerIDExist(ID_number)
Arguments:
    ID_number
        An expression that evaluates to the ID number to check for (int)
Return type:
    boolean int (1 or 0)
Error conditions:
    Returns bottom if ID_number evaluates to bottom.

Examples:
Code:
trigger1 = PlayerIDExist(var(4))
  Triggers if a player with an ID number equal to the value of var(4) exists.

Details:
   See section for ID trigger for more information.

Additional Notes:
Bottom is a special value used by the MUGEN engine that is returned whenever an expression would otherwise cause an unrecoverable error during computation. See bottom for more information.
Last Edit: September 18, 2015, 02:48:03 pm by Just No Point
Re: PlayerIDExist (Triggers)
#2  September 17, 2015, 05:37:44 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I'm not sure what other practical uses there are for this code, but I use it because I use trigger redirections via PlayerID.

If for whatever reason the PlayerID does not exist, this will allow you to have a "plan B"

Example:
Code:
[State 1100,4]
type = PlaySnd
trigger1 = PlayerIdExist(var(58)) ;enemy exists
trigger1 = PlayerId(var(58)),StateNo = 1105 ;enemy is in custom hit state
trigger2 = !PlayerIdExist(var(58)) ;fallback code
trigger2 = p2stateno = 1105 ;fallback code
value = 1100,2
persistent = 0
ignorehitpause = 1

For more info on my usage of this see here