Game Development Reference
In-Depth Information
Again, the else statement contains quotation marks, as the no damage situation is handled in hp_damage_text .
Once you have all three of the tweaked methods set up in a script page in the Materials section, you are done! Let's
work on a much simpler exercise now.
Of TP and Their Preservation
I have to start this section by noting that it is bizarre that TP is never spelled out within RMVXA. I assume that TP
is short for Technique Points (or Tech Points). Given that most default skills that require TP are weapons skills or
empowered physical attacks, this seems to be a valid assumption. In any case, TP are different from MP in the
following ways:
Each party member starts each battle with between 0 and 25 TP.
A character can gain TP from taking damage and skills that grant TP.
After each battle, the party's TP is reset.
TP as a stat is not displayed anywhere in the default RMVXA game menu, only in battle. You
would have to use a script to add a visible TP stat into the game's menu.
But what if you want TP in your game to act like the Limit Break bar in Final Fantasy VII? Making TP a persistent
resource is actually extremely easy but requires code tweaking, so it's a perfect exercise for this chapter. As usual, we have
to find where and how RMVXA handles TP. We know that TP is set at the start of battle and reset at the end of combat.
Searching for TP
Let's run a search in the Script Editor for TP. Among the first sets of results that pop in, we can see the TP display
messages that we tweaked in the previous exercise. Of particular interest is Game_BattlerBase (line 42), where we
can see that Preserve TP is a special flag that can be set. Where? In weapons and armor. You can create pieces of
equipment that grant their users the ability to carry over their TP values from battle to battle. Of course, that's not what
we came here for, so let's scroll down some more in the search results.
The next item of interest is also in Game_BattlerBase (line 449). A click on that result leads us to the following
snippet.
def preserve_tp?
special_flag(FLAG_ID_PRESERVE_TP)
This is a method that allows us to set the flag to preserve TP. If you get the sudden urge to search for preserve_tp? ,
I applaud you. It is definitely the right way to go. Running a search for that particular term returns a mere three results.
The latter two are in Game_Battler and are exactly what we're looking for. The first of them is the on_battle_start
method (line 785), which initializes a player's TP at the start of each battle, unless the flag has been set.
def on_battle_start
init_tp unless preserve_tp?
You should always try not to edit the default code and use script pages for that purpose. that way, if your
changes break something, you can just erase the offending code, and all is well.
Note
 
 
Search WWH ::




Custom Search