Maybe no custom scripts are needed. Usually battlers gain tp from trg or skills or items or taking damage, and damage are usually from negative hrg or enemies or self's attacks which are usually skills. So the below setup might work:
1. Change/add the custom damage formula of all skills that deal damage or give tp directly to targets and/or users to something like the below:
[a, b].each { |c| c.add_state(x) if c.tp == c.max_tp }; original_custom_damage_formulaNow if that skill hits the target, state with id x should be added to that target when his/her/its tp reaches the max. original_custom_damage_formula is the original custom damage formula of those skills before applying the above modification.
Just beware that using the above modification might cause some of the resulting custom damage formulae to exceed the default RMVXA limit.
2. Add an battle event page with trigger turn 0 + 1 * x in all battles. Add the below script code in all those battle event pages(the script box of v1.02a should be large enough for this):
battlers = $game_party.alive_members + $game_troop.alive_membersbattlers.each { |battler| battler.add_state(x) if battler.tp == battler.max_tp }As tp regen from trg are at the beginning of turns in the default RMVXA settings, if a battler's tp reaches max due to this, the above script code should be able to catch these battlers and add state with id x to them.
Of course even if the above whole setup does work it's still tedious to implement(especially if you have lots of skills and battle troops), and any decent custom script will be much, much simpler and more efficient and effective, but you may want to try this non-scripting method 🙂
True that. Probably why we have the code off challenge too, so that those of us learning (like me) can try and compare with the pros.
Most of the time i spent writing the documentation 😛
Yea, checking @tp == max_tp is not really ideal, but its a necessary evil imo. I mean, most all max tp controlling scripts modify the max_tp method to read from the newly written(usually) method of mtp. So having a check against whatever is considered the max value is best in this situation, rather than just assuming it will always be 100. 🙂
Thanks. I try to keep my code as neat and tidy as possible 🙂
If you have any problems with it let me know. I'm sure I wrote a more advanced version of this for someone in the past. I've been trying to find the thread to no avail. If do though, I will send a link your way 🙂
Well, another potential issue, again probably due to the 'creative geniuses'... If someone where to rewrite the refresh method (which i have seen unnecessarily done alot) within either Game_BattlerBase, Game_Battler, Game_Actor or Game_Enemy. Then, my script would be 'unread' by the interpreter (but this again would be solved by placing my script below theirs)... So I guess thats not really any kind of major threat 😛
Oh yea, it would have to be an extreme case for such a thing to occur.
Personally I think a rewrite of the refresh method would be great (not only for battlerbase, but for everything)- but only to place each line of code into its own method... For example...
class Game_BattlerBase def refresh state_resist_set.each {|state_id| erase_state(state_id) } @hp = [[@hp, mhp].min, 0].max @mp = [[@mp, mmp].min, 0].max @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id) endendBeing rewritten into something like
class Game_BattlerBase def refresh refresh_state_resist refresh_hp_set refresh_mp_set refresh_death_state end def refresh_state_resist state_resist_set.each {|state_id| erase_state(state_id) } end def refresh_hp_set @hp = [[@hp, mhp].min, 0].max end def refresh_mp_set @mp = [[@mp, mmp].min, 0].max end def refresh_death_state @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id) endendObviously doing this is completely unnecessary, but its also alot cleaner and leaves alot more room for 3r party modification. Hopefully the next RPGMaker is structured as such. That will make for many easy to make scripts with high chance of compatibility 🙂
Also - have to remember as well, alof of new scripters - the ones like me, who started by modifying other scripts rather than learn the language first - dont fully understand the power of super or even aliasing. Obviously, once they are more familiarized with writing code in general it rarely happens, but the mistakes people make can 'haunt them' forever...
My first script was the 'Perfect Stat Point Distribution System' < Which has many flaws. I later rewrote that system into my 'Insane Stat Point Distribution System' < Which is much better in terms of efficient code and features. Yet still, my PSPDS has gained just as many views this year as my ISPDS.
Is a complete pain in the ass - when you know there is a better script available (and have stated that on the script download page) yet people continue to use the old inefficient model...
Anyway... I'm rambling now...
And I've found the hard way being a good programmer at Java/C/C++ (which are my primary languages) does NOT make you good at scripting right away. Ruby syntax is mostly similar to Java, but the concepts are in some cases radically different. Not to mention I'm always going through the base scripts trying to find "What object affects this?"
It just takes a lot of practice.
No problem 🙂
Also: there is no need to use any of the scripts from above. They are just examples I gave in my ramblings about ho things should be structured (imo) 😀