EDIT 02/05/07 : new version
EDIT 03/05/07 :"$game_system.reset" corrected
EDIT 05/05/07 : English version (variables with English names, and a few comments). Old versions removed.
EDIT 06/05/07 : ZTBS compatibility script updated for Mac's version. Removed bug with autotiles in Mode7 script.
EDIT 07/05/07 : Bug with vertical tiles removed.
EDIT 21/05/07 : Flat-drawn events support, and some other small features.
Introduction This new mode7 script is written from an old french script I created, and it is far different from Mewsterus's Mode07 script.
Features
flat maps (not curved)
high resolution (each screen line is independent)
map looping (x or/and y)
animated autotiles
(new version) Tiles with fixed terrain_tag not drawn flat with the map
You must add to the map's name :
- [M7] : to activate Mode7
- [#XX] : XX is the slant angle (in degree). Default value is 0 (it looks like normal maps)
- [Y] : Y-map looping
- [X] : X-map looping. This option needs resources (lower fps).
- [A] : animated autotiles (with 4 patterns). This option increases significantly the loading time, so it may crash for large maps (SystemStackError)
- [C] : to center the map on the hero (even for small maps)
- [P] : to have a fixed panorama
- [H] : to have a white horizon (screenshot's horizon)
- [OV] : Overworld Sprite Resize (a Mewsterus's script feature)
Or :
Prepare your own settings for mode7 maps (script : l.48).
Add for example
and just add in the map's name "Worldmap" to have these settings applied.
New version
The map is drawn from all the tiles of the three layers that do not have a terrain_tag's value of 1 or 2.
The other tiles (terrain_tag = 1 or 2) form elements that are drawn vertically, like the 3rd-layer elements in the old version.
The two values used by my script (1 and 2) can be modified line 6 ($num_terrains = [1,2]).
There are two values so that we can create two distinct vertical elements in contact in one layer.
Example :
With these terrain_tags :
screenshot
The three layers:
screenshot
screenshot
screenshot
We obtain :
screenshot
Other commands (for events) (EDIT : modified for the English version) :
Code:
$scene.spriteset.tilemap.mode7_set (new_angle)
To redraw the map with the new_angle
Code:
$scene.spriteset.tilemap.mode7_set_p(new_angle)
To redraw progressively the map from the current angle to the new
Code:
$scene.spriteset.tilemap.mode7_redraw
To redraw the map (useful with the following commands)
Code:
$game_system.opacite = value
To define the opacity for Mode7 maps (it needs to redraw)
To define a gradual tone for Mode7 maps (it needs to redraw, and it doesn't work with horizontal looping)
Code:
$game_system.map_gradual_opacity = value
To define a gradual opacity for Mode7 maps (it needs to redraw, and it also bugs with horizontal looping)
- To obtain flat events :
just add a comment in the event's commands list with : "Flat"
Moving flat events are supported, but it will take resources.
- To handle the height of a vertical event :
add a comment in the event's commands list with : "Heigth X", where X is the height value ("Heigth 2" will draw the event 64 pixels above its original position - you can use floats)
Compatibility
This script redefines a lot of classes, so it is probably not compliant with most of other scripts
English version : ZTBS compatibility
The compatibility is not perfect, but it doesn't crash.
EDIT 21/05/07 : the sprites used for ranges and areas are flat-drawn
Mode7 script must be above ZTBS, and this script below :
- ...
- Scene_Debug
- SDK
- Mode7
- ZTBS scripts
- Macs addons
- This script
- Main
compatibility script
Code:
#============================================================================
# This script gives a compatibility between the "New Mode7 Script" (MGCaladtogel)
# and the "Zenith Tactical Battle System" (Mac's version)
# Written by MGCaladtogel, for English version of mode7 (21/05/07)
# Mode7 script must be above ZTBS, and this script below :
# - ...
# - Scene_Debug
# - SDK
# - Mode7
# - ZTBS scripts
# - Macs Addons
# - This script
# - Main
#============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ? TBS Setup
#--------------------------------------------------------------------------
def setup(map_id)
# Set Up Map ID
ztbs_setup(map_id)
# Load map info data from Data Folder
$data_mapinfos = load_data("Data/MapInfos.rxdata") if $data_mapinfos.nil?
map_name = $data_mapinfos[@map_id].name2
# Get tactic map end ID
@tactics_end_map = get_tactics_end_map(@map_id)
# If tactical battle map must include [T]
$game_system.in_tactics = map_name.include?("[T]")
end
end
class Sprite_Character < RPG::Sprite
def update
if $game_system.in_tactics
if @flat_indicator and $game_system.mode7
if (!@character.flat or @character.moving? or
@tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue)
@flat_indicator = @character.flat
# redraw the original ground
maps_list = $scene.spriteset.tilemap.maps_list
map_ground = $scene.spriteset.tilemap.map_ground
rect = Rect.new(@flat_x_map, @flat_y_map, @flat_width, @flat_height)
for map in maps_list
map.blt(@flat_x_map, @flat_y_map, map_ground, rect)
if $game_system.loop_x and @flat_x_map.between?(0, 19 * 32)
map.blt(@flat_x_map + 32 * $game_map.width, @flat_y_map, map_ground,
rect)
end
end
else
return
end
end
super
# Changes old tile id, characer name or character hue to new
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# Changes old tile id, characer name and character hue to new
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile id is bigger than orequal to 384 create tile ID and Character Hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# Or in else cases create character
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
self.oy -= 4 if $game_system.mode7
end
end
# Visible when character in not transparent
self.visible = (not @character.transparent)
# Is tile ID is equal to 0
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
if $game_system.mode7 and @character.flat # event must be flat drawn
return if $scene.spriteset == nil
if @tile_id == 0
@flat_x_map = @character.real_x / 4 - (@cw - 32) / 2
@flat_y_map = @character.real_y / 4 - @ch + 32
@flat_x0 = sx
@flat_y0 = sy
@flat_width = @cw
@flat_height = @ch
else
@flat_x_map = @character.real_x / 4
@flat_y_map = @character.real_y / 4
@flat_x0 = 0
@flat_y0 = 0
@flat_width = 32
@flat_height = 32
end
# modify the maps graphics
maps_list = $scene.spriteset.tilemap.maps_list
rect = Rect.new(@flat_x0, @flat_y0, @flat_width, @flat_height)
for map in maps_list
map.blt(@flat_x_map, @flat_y_map, bitmap, rect, @character.opacity)
if $game_system.loop_x and @flat_x_map.between?(0, 19 * 32)
map.blt(@flat_x_map + 32 * $game_map.width, @flat_y_map, bitmap, rect,
@character.opacity)
end
end
@flat_indicator = true
self.opacity = 0
return
end
# Define x, y and z character screen
x_intermediate = @character.screen_x
y_intermediate = @character.screen_y
y_intermediate -= $game_temp.pivot + 4 if $game_system.mode7
if $game_system.loop_y
h = 32 * $game_map.height
y_intermediate = (y_intermediate + h / 2) % h - h / 2
end
if $game_system.mode7
self.y = (($game_temp.distance_h * y_intermediate *
$game_temp.cos_angle).to_f / ($game_temp.distance_h - y_intermediate *
$game_temp.sin_angle) + $game_temp.pivot)
self.zoom_x = $game_temp.slope_value * y + $game_temp.corrective_value
self.zoom_y = zoom_x
self.x = 320 + zoom_x * (x_intermediate - 320)
if $game_system.loop_x
offset = ($game_map.width >= 24 ? 64 * zoom_x : 0)
l = 32 * $game_map.width * zoom_x
self.x = (x + offset) % l - offset
end
else
self.zoom_x = 1.0
self.zoom_y = 1.0
self.x = x_intermediate
self.y = y_intermediate
end
self.z = @character.screen_z(@ch)
# If set opacity is equal to 0 the character is defined as invisible
if self.opacity == 0
@character.invisible = true
end
unless @character.effect
if @character.acted
self.opacity = (self.y < $game_temp.height_limit ? 0 :
@character.opacity - 100)
elsif @character.invisible
self.opacity = 0
else
self.opacity = (self.y < $game_temp.height_limit ? 0 :
@character.opacity)
end
self.y -= 32 * @character.height * zoom_y # height correction
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
end
@character.effect = effect?
if @character.is_a?(Game_Player)
return
end
# Loops state animation for character inflicited
if @character.damage == nil and
@character.state_animation_id != @state_animation_id and
($game_system.tactics_step < 6 or $game_system.tactics_step > 9) and
ZTBS::STATE_ANIMATION
@state_animation_id = @character.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# When character animation ID is 0 use default hit animation
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, @character.animation_hit)
@character.animation_id = 0
end
# When characters turn the characters opacity returns to normal
if @character.appear and
($game_system.tactics_step < 6 or $game_system.tactics_step > 8)
@character.refresh
@character.invisible = false
self.opacity = @character.opacity
appear
@character.appear = false
end
# If character blink is on defined to character if not blink is off
if @character.blink
blink_on
else
blink_off
end
# Character white flash cannot happen if already whitened
if @character.white_flash
whiten
@character.white_flash = false
end
# Display character damage as normal if not critcial
if @character.damage_pop
damage(@character.damage, @character.critical)
@character.damage = nil
@character.critical = false
@character.damage_pop = false
end
# If character dies play actor die sound effect
# If enemy dies play enemy die sound effect
if @character.damage == nil and @character.collapse > 0
case @character.collapse
when 1
$game_system.se_play($data_system.actor_collapse_se)
when 2
$game_system.se_play($data_system.enemy_collapse_se)
end
collapse
@character.collapse = 0
@character.effect = true
end
else
# TBS Update
ztbs_update
end
end
end
Version dated May 21, 2007 (I reformatted the instructions)
* It's a txt file with a .doc extension
Just in case.... (seeing a problem with this version switching from Mode7 to non-Mode7 maps...)
Mode7_old.Doc (Size: 144.2 KB / Downloads: 5)
Version dated May, 5, 2007 (I reformatted the instructions there too)
* It's a txt file with a .doc extension
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)