It's very simple as far as X2 goes but you would need to have a local copy of altpsystem in your episode folder. For the PAL version you would need to go into data/scripts/Legacy and copy the "altpsystem" file into you episode folder. Rename this file in your episode folder to "local_altpsystem". Then write a lua script like this.
It's as simple as that. When you have a fire flower/leaf whatever you won't go straight to small when you take damage anymore.
For teascript though I would have no idea. I've never dabbled in 1.4.