YesNoOk
avatar

SelfAnimExist (Triggers) (Read 6712 times)

Started by Ricepigeon, September 29, 2015, 04:55:37 pm
Share this topic:
SelfAnimExist (Triggers)
#1  September 29, 2015, 04:55:37 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
SelfAnimExist is like AnimExist, except that this only checks P1's animation data. If P1 has been given P2's animation data by a hit, SelfAnimExist will not check P2's animation data to determine whether or not a given action exists.


Format:
    SelfAnimExist(exprn)
Arguments:
    exprn
        An expression evaluating to an animation number (int).

Return type:
    boolean int (1 or 0)
Error conditions:
    Returns bottom if exprn evaluates to bottom.

Examples:
Code:
trigger1 = !SelfAnimExist(200)
  Triggers if the player is missing action 200 from his or her own files.

Additional Notes:
SelfAnimExist is commonly used in custom states to determine if Player2 already has a specific animation that can be used, otherwise a default animation from Player1's file can be used if the animation does not already exist in Player2's files. A common application of this would be Demitri's Midnight Bliss, which would check to see if Player2 has a midnight bliss animation with the necessary sprites by using SelfAnimExist within the custom state, otherwise Player2 will change to a generic predefined animation from Player1's files that utilize the SFF's required sprites instead. A compiled list of commonly used animation numbers that can be used with SelfAnimExist can be found here.
Last Edit: September 29, 2015, 05:01:43 pm by Ricepigeon
Re: SelfAnimExist (Triggers)
#2  January 05, 2016, 12:42:07 pm
  • *****
  • Shame on you!
    • USA
An example when to use it would be in a custom state, inside a ChangeAnim

;P2 is in a custom state we don't want to look custom
[State 3009, Falling]
type = ChangeAnim
triggerall = time > 10
trigger1 = vel y >= 0
trigger1 = anim != [5060,5061]                               ;Stops it from constantly changing to the animations
value = ifelse(SelfAnimExist(5060),5060,5061)         ;If anim 5060 isn't present in P2's animations, try anim 5061.
ignorehitpause = 1

ChangeAnim is used in Player 1's custom state for Player 2. This is so P2's natural hit reaction can be used. In this case it would be Falling animations. If ChangeAnim2 is used, Player 1's hit reaction would be used.  If both animations are not present, P2 would be switched to a random animation.
vVv Ryuko718 Updated 10/31/22 vVv
Re: SelfAnimExist (Triggers)
#3  January 20, 2016, 09:00:20 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Stemming from the above and from what was in the original post, you can set up certain custom states to use an animation in Player 2's animation file if the specified number exists, or a predefined animation from Player 1's animation if it does not, using the following;

Code:
[State ???, Changeanim (Self)]
type = changeanim
trigger1 = anim!=5360 && anim!=4150
trigger1 = selfanimexist(5360)=1
value = 5360

[State ???, Changeanim (Default)]
type = changeanim2
trigger1 = anim!=5360 && anim!=4150
trigger1 = selfanimexist(5360)=0
value = 4150

Assuming the above is placed in a custom state defined in Player 1's files, the above code will check if animation number 5360 exists in Player 2's animation files. If it does, it will change to that animation. If animation 5360 does not exist in Player 2's animation file, it will instead change the animation to animation number 4150 in Player 1's animation file. You cannot condense the above code into a single SCTRL due to how differently ChangeAnim and ChangeAnim2 operate.

Examples of where you may wish to use such code include Throw Escapes, Guard Crushes, Demitri's Midnight Bliss, Cheese KOs, and Dizzy states. See ChangeAnim & ChangeAnim2 for more info.