Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Currently, this code block in battlecontrol's step event is what actually plays the animation (using the animation object of the move). a_user is the monster object who is doing the action, and a_targ is an array of one or more monster objects that are being targeted. (And the target can contain the user, e.g. if the move is a buff or recovery action). So, this is the "entry point" where you'd want to put any new behavior.

Your question is a bit vague but I think this is what you're asking for:

  • If some monsters has special animations for certain types of moves, add a struct to the monster data which contains a list of conditional sprites for those moves, stored in a new slot mond_SPECIALANIMATIONS in the monster data array.
    • init_monster initializes the entire struct to NONE for all the cases (cases being e.g. "physical", "special" and "stat"), but then checks if the sprite argument (argument2) is longer than 2 - if so, it reads slots 2 and 3 as a parameter-sprite pair, then slots 4 and 5, and so on, and overwrites the default data in the struct.
    • In the animation entry point, the struct of the monster's special animations is checked (go through a_user --> AMP reference --> monster species ID) using the move's category (e.g. movecat_MAGIC means "special" category) and if there is an animation (i.e., the struct's value for the category is not NONE) it is used
  • To actually perform the animation, you'd set the sprite_index of the affected object to the sprite from the struct, reset image_index to 0 so it starts from the beginning, and then add a new Other --> Animation End event in the obj_battlemonster which resets the sprite to the species' default sprite (so when the animation ends, it goes back to the regular sprite).
    • (And to do custom "hurt" animations, you'd basically do the exact same thing - override the sprite when taking damage, and then the Animation End event resets it to the regular sprite)
 

You don't even need to initialize the struct to all NONE's since variable_struct_exists exists - if e.g. variable_struct_exists("physical") is false when checking the monster species' animations, you can conclude it has no special animation for physical attacks and just skip overriding its sprite.

(I'm assuming you mean "sprite animations" here but if you want attack control objects you could pretty much set up the data the same way)