Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hey, how would I go about adding abilities to the game, for example stuff like Water Absorb that heals you when hit with a certain type of attack?

Easiest way would probably be to add a new argument to init_monster which is supposed to contain an array with at least four elements; trigger constant, trigger function, name string, and description string (the last two are optional but you probably want them for the status screen later), and then go through init_monsters and make sure every monster gets an ability. (Of course you need to define new "mond_" constants for these new data points and increase MONSTER_DATA_MAX accordingly, on top of adding the trigger constants and making some scripts)

The idea is that you add triggers wherever an ability could affect something: every turn, on damage, when first entering battle, etc. Check if the monster in question has the matching trigger constant, and if so, run its script. For your Water Absorb (and Flash Fire, Lightningrod, etc) example specifically, check out obj_damageapply's Alarm 0 event, near the bottom:


You'd basically want a check like this, but for the monster's ability instead of its item. (And since it might potentially cancel out damage, you want it at the TOP of the event instead - the "water absorb" ability effect script would set my_dmg to a negative value before it's applied, so it becomes healing)

Side note: if you want monsters to potentially have different abilities, you should also add ability slots to the "amp_" (Active Monster Party) system, and make amp_generate_monster pick a random ability out of the available choices from the species data (and of course, you look up AMP data instead of MOND data when you check if the ability applies). If you're gonna reuse abilities a lot you'd probably want to make a whole ability data array and have references to that instead of storing the entire trigger+script+name+description per-monster. But one step at a time!