Game Development Reference
In-Depth Information
A Discussion of Floor Damage
How do I know how much damage such tiles cause? Well, it's all contained within a few lines of code (which you
cannot edit unless you own the full version of RMVXA). To note: These lines are contained within Game_Actor .
#--------------------------------------------------------------------------
# * Get Base Value for Floor Damage
#--------------------------------------------------------------------------
def basic_floor_damage
return 10
end
You'll probably be interested to know that you can have variable floor damage, depending on the type of floor.
Here, let me illustrate with some code that I hammered out in about a minute on my full version of RMVXA.
#--------------------------------------------------------------------------
# * Get Base Value for Floor Damage
#--------------------------------------------------------------------------
def basic_floor_damage
return 2 if $game_variables[3] == 1
return 5 if $game_variables[3] == 2
return 10 if $game_variables[3] == 3
return 25 if $game_variables[3] == 4
end
Instead of a single global value for floor damage, we can have multiple values, as set by a particular variable.
In this case, $game_variables[3] (where 3 is the variable ID in the Database), signifying the variable containing the
Region ID, is the one I chose to use. You could consider leaving a simple return value (like the default number) for
damage floors set within the Tileset tab and then have other damage floors marked by regions or terrain tags.
Additional Exercises
Here are some final exercises for you to close out this chapter with a bang!
1.
Expand the innkeeper so that you can choose to rest in the morning or nighttime.
Having night in your game is as simple as applying a filter on the graphics. The Tint Screen command is perfect
for this and, in fact, even has a specific color setting for nighttime. However, if you want nighttime to influence
random encounters, that is quite a bit harder. It takes a small amount of scripting, and a fair amount of eventing, to
have different encounters based on the time of day. Even so, you can stop the player character from leaving town and
have certain events happen only at night.
I recommend having a Daytime switch and a Nighttime switch, if you're going to do this. Then, you can
differentiate what events trigger when using the relevant conditionals. Just make sure you set one of the switches to on
at the very start of the game. (Switches default to off and variables to 0 when a new game is created).
2.
Have some NPCs in Seaside give the player items when they're talked to.
You have already used Change Party Member to add Noah to the player's party in Seaside. However, there are
four other event commands in the Party category, and they can be used to grant items, weapons, gold, or armor to the
player. Treasure chest events actually use those event commands to give items.
 
Search WWH ::




Custom Search