Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

New Mode7 script / Neo Mode 7 script

EmuMaster2002;201005 said:
What would make this script even awesomer is if the terrain tag or something made tiles appear at different heights. That would make stuff like cliffs look really cool.

Doing that with scanlines is going to be damn slow... The whole point of mode_7 is to easily use 2d graphics to generate a quick and dirty 3D-like world.
 
MGCaladtogel;200608 said:
BlueScope -> If I put the settings in the script, I think there will be less freedom for an user. I can perhaps combine the two systems. (My script is surely not compliant with a resolution different from 640*480, but you can modify it)
You could arrange the settings like this:
Code:
somethingsomething = ["Mapname", "[M][whatnot][...]"]
That's what I thought, and it'd even increase the overview both on your mapnames and the M7 script.

For the changed resolutions, again for 320x240, I gave it a shot, and I had to do quite some editing to get this:

http://img145.imageshack.us/img145/635/res01qo3.th.jpg[/IMG]

Well, it's your turn now, I guess... If you're up to it, that is XD I'd like to see a plugin for my resolution script (link in signature), but you should make sure to only use the definitions inside the Setup module and not change anything from the default three scripts, of course, as this is about compatibility ^_^
 
wow, this is the script i've been waiting 4 score and 17 years for!

Great job, and engine compatability is perfect, works well with ABSes, and other things =]
 
el_felixio -> this script is completely free of use, so you can post it on your website, no problem. But perhaps you should wait until the script is rewritten (with english words, and comments).

BlueScope -> I will arrange the settings in the english version. For the resolutions compability, I'll see that later.

EmuMaster2002 -> rataime is right : the theory is not hard, but it will lag.
I don't think that RmXp is expected to manage real 3D. It is just a tool to create beautiful 2D games. But you can make a 3D-isometric's engine : it is not too hard to create, and that looks rather good. I'm creating this sort of isometric's engine, it's not finished but you can try a testing map -> http://rapidshare.com/files/29430784/3DISO.exe.html
(don't comment this script, it's only a draft)
 
the Objects on the second and first Layer ( with terrain tag ) won?t be displayd vertical????
They?re flat like the map...

only the Objects on the third layer will be diplayed vertical ( but as one wall.. like if all objects are stacked...

What i?ve made wrong?


-------------------EDIT-------------------
Fixed it.. my mistake.. downloaded the old version..sry..
------------------------------------------
 
im using the ZTBS for one of my projects and im using the one posted here on rmxp.org by Mac and im not sure exactly above which script i post the mode07 and below which one do i put the compatibility script?
 
so for this new version do i need the compatibility script still? or is it built in now?

And i still need to know above which and below which script they go exactly
 
uzumakishade;201687 said:
so for this new version do i need the compatibility script still? or is it built in now?

And i still need to know above which and below which script they go exactly

Instead of waiting for the answer, you could just try it yourself :)

just cut and paste the script over and over until you find the right spot.
 
uzumakishade;201687":oprh0887 said:
so for this new version do i need the compatibility script still? or is it built in now?

And i still need to know above which and below which script they go exactly

MGCaladtogel;201633":oprh0887 said:
uzumakishade -> see the first post

I edited the script (English version).

MGCaladtogel;199676":oprh0887 said:
English version : ZTBS compatibility
The compatibility is not perfect, but it doesn't crash.
Mode7 script must be above ZTBS, and this script below :
- ...
- Scene_Debug
- Mode7
- ZTBS scripts
- This script
- Main
Code:
#============================================================================
# This script gives a compatibility between the "New Mode7 Script" (MGCaladtogel)
# and the "Zenith Tactical Battle System"
# Written by MGCaladtogel, for English version of mode7 (05/05/07)
# Mode7 script must be above ZTBS, and this script below :
# - ...
# - Scene_Debug
# - Mode7
# - ZTBS scripts
# - This script
# - Main
#============================================================================

#============================================================================
# â–  Game_Player
#============================================================================

class Game_Player < Game_Character
  def initialize()
    super()
    @through_original = @through
    @speed_original = @move_speed
    self.map_number_x = 0
    self.map_number_y = 0
  end
end

#============================================================================
# â–  Spriteset_Map
#============================================================================

class Spriteset_Map
  def initialize
    if $game_system.in_tactics
      init_options
      @viewport1 = Viewport.new(0, 0, 640, 480)
      @viewport2 = Viewport.new(0, 0, 640, 480)
      @viewport3 = Viewport.new(0, 0, 640, 480)
      @viewport2.z = 200
      @viewport3.z = 5000
      # mode7 map
      if $game_system.mode7
        @tilemap = Tilemap_mode7.new(@viewport1)
      # normal ZTBS map
      else
        @tilemap = Tilemap.new(@viewport1)
        @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
        for i in 0..6
          autotile_name = $game_map.autotile_names[i]
          @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
        end
        @tilemap.map_data = $game_map.data
        @tilemap.priorities = $game_map.priorities
      end
      @panorama = Plane.new(@viewport1)
      @panorama.z = ($game_system.mode7 ? -100000 : -1000)
      @fog = Plane.new(@viewport1)
      @fog.z = 3000
      @area_sprites = []
      @range_sprites = []
      if defined? $onscreen
        @character_sprites = []
        @party_sprites = []
        for i in $game_map.events.keys.sort
          sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
          @character_sprites[i] = sprite
         $onscreen[i] = true
       end
        @party_sprites.push(Sprite_Cursor.new(@viewport1, $game_player.x, $game_player.y))
      else
        @character_sprites = []
        for i in $game_map.events.keys.sort
          sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
          @character_sprites.push(sprite)
        end
        @character_sprites.push(Sprite_Cursor.new(@viewport1, $game_player.x, $game_player.y))
      end
      @weather = RPG::Weather.new(@viewport1)
      @picture_sprites = []
      for i in 1..50
        @picture_sprites.push(Sprite_Picture.new(@viewport2,
          $game_screen.pictures[i]))
      end
      @timer_sprite = Sprite_Timer.new
      update
    else
      ztbs_initialize
    end
  end
end

#============================================================================
# â–  Sprite_Area
#    Coordinates correction for mode7 maps
#============================================================================

class Sprite_Area < RPG::Sprite
  def update
    super
    x_intermediate = screen_x
    y_intermediate = 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 = screen_z
  end
end

#============================================================================
# â–  Sprite_Range
#    Coordinates correction for mode7 maps
#============================================================================

class Sprite_Range < RPG::Sprite
  def update
    super
    @map_x = $game_player.x + @plus_map_x
    @map_y = $game_player.y + @plus_map_y
    @real_x = @map_x * 128
    @real_y = @map_y * 128
    x_intermediate = screen_x
    y_intermediate = 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 = screen_z
  end
end

#============================================================================
# â–  Sprite_Character
#    Coordinates correction for mode7 maps
#============================================================================

class Sprite_Character < RPG::Sprite
  def update
    if $game_system.in_tactics
      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
      # 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 $game_system.mode7
        self.opacity = (self.y < $game_temp.height_limit ? 0 : @character.opacity)
      else
        self.opacity = @character.opacity
      end
      # 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 = @character.opacity - 100
        elsif @character.invisible
          self.opacity = 0
        else
          self.opacity = @character.opacity
        end
        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

You need to read better...
 
How do you script this right..I love the screenshots, but whenever I make a map it makes the map over, and over again. Say you had a map with one tree that is 20X20...that map will repeat itself forever whenever I start to play the game(Test).

What I'am doing wrong?
 
uzumakishade -> sorry, it's my fault... I worked with the old version of ZTBS.
A new compatibility script is released (see first post) (and SKD must be above all other custom scripts)

Khengi -> I saw the NP+ script, and I think it's not compatible (some classes are redifined in the two scripts)
But you can try this script :
Code:
#============================================================================
# â–  Game_Map
#============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #     x          : x-coordinate
  #     y          : y-coordinate
  #     d          : direction (0,2,4,6,8,10)
  #                  *  0,10 = determine if all directions are impassable
  #     self_event : Self (If event is determined passable)
  #--------------------------------------------------------------------------
  def passable?(x, y, d, self_event = nil)
    # If coordinates given are outside of the map
    unless valid?(x, y)
      # impassable
      return false
    end
    # Change direction (0,2,4,6,8,10) to obstacle bit (0,1,2,4,8,0)
    bit = (1 << (d / 2 - 1)) & 0x0f
    # Loop in all events
    for event in events.values
      # If tiles other than self are consistent with coordinates
      if event.tile_id >= 0 and event != self_event and
         event.x == x and event.y == y and not event.through
        # If obstacle bit is set
        if @passages[event.tile_id] & bit != 0
          # impassable
          return false
        # If obstacle bit is set in all directions
        elsif @passages[event.tile_id] & 0x0f == 0x0f
          # impassable
          return false
        # If priorities other than that are 0
        elsif @priorities[event.tile_id] == 0
          # passable
          return true
        end
      end
    end
    # Loop in all events
    for player in Network::Main.mapplayers.values
      next if player == nil
      next if player.map_id != $game_map.map_id
      # If tiles other than self are consistent with coordinates
      if player.tile_id >= 0 and player != self_event and
         player.x == x and player.y == y and not player.through
        # If obstacle bit is set
        if @passages[player.tile_id] & bit != 0
          # impassable
          return false
        # If obstacle bit is set in all directions
        elsif @passages[player.tile_id] & 0x0f == 0x0f
          # impassable
          return false
        # If priorities other than that are 0
        elsif @priorities[player.tile_id] == 0
          # passable
          return true
        end
      end
    end
    # Loop searches in order from top of layer
    for i in [2, 1, 0]
      # Get tile ID
      tile_id = data[x % width, y % height, i]
      # Tile ID acquistion failure
      if tile_id == nil
        # impassable
        return false
      # If obstacle bit is set
      elsif @passages[tile_id] & bit != 0
        # impassable
        return false
      # If obstacle bit is set in all directions
      elsif @passages[tile_id] & 0x0f == 0x0f
        # impassable
        return false
      # If priorities other than that are 0
      elsif @priorities[tile_id] == 0
        # passable
        return true
      end
    end
    # passable
    return true
  end
end

#============================================================================
# â–  Game_Map
#============================================================================

class Sprite_NetCharacter < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If tile ID, file name, or hue are different from current ones
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
       #Updates tile info
       update_tile
    end
    # Set visible situation
    self.visible = (not @character.transparent)
    # If graphic is character
    animate_player if @tile_id == 0
    # Set sprite coordinates
    x_intermediate = @character.screen_x
    y_intermediate = @character.screen_y
    y_intermediate -= $game_temp.pivot + 4 if $game_system.mode7
    # if vertical looping
    if $game_system.loop_y
      h = 32 * $game_map.height
      y_intermediate = (y_intermediate + h / 2) % h - h / 2
    end
    # if it is a mode7 map
    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
      # normal map
    else
      self.zoom_x = 1.0
      self.zoom_y = 1.0
      self.x = x_intermediate
      self.y = y_intermediate
    end
    if @character.is_a?(Game_Player)
      # Overworld Sprite Resize
      if $game_system.ov
        self.zoom_x *= $game_system.ov_zoom
        self.zoom_y *= $game_system.ov_zoom
      end
    end
    self.z = @character.screen_z(@ch)
    # if it is a mode7 map
    if $game_system.mode7
      # hide the sprite if it is beyond the horizon's line
      self.opacity = (y < $game_temp.height_limit ? 0 : @character.opacity)
    # normal map
    else
      self.opacity = @character.opacity
    end
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    # Animation
    update_ani if @character.animation_id != 0
    # Name Sprite
    @_text_display.x = self.x
    @_text_display.y = self.y - self.oy / 2 - 24
  end
  #--------------------------------------------------------------------------
  # * Update Tile
  #--------------------------------------------------------------------------
  def update_tile
    # Remember tile ID, file name, and hue
    @tile_id = @character.tile_id
    @character_name = @character.character_name
    @character_hue = @character.character_hue
    # If tile ID value is valid
    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
    # If tile ID value is invalid
    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
end

Put Mode7 script above NP+ (but below SDK), and that script just above main. I didtn't test it.
 
well for n+;.. trying to make it work with the current old versions.... won't be compatible with the 2.0 that will be out soon.

Nice to see an other french scripter! making good job by the way.!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top