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.

Help! Do you know script for..

Hello, I'm new on this forum and i like building with RMXP
but i got some questions and requests.

1) Is there an script for playing with 2 players in your rmxp game? so ye what script?

2) Do you know an site or something with much tile sets?

3) Is there an script for or an tut how to create an lives and stuff on the right top of the screen?

If you could answer my questions thanks ;) But an reaction is
also nice!
 

Nachos

Sponsor

1)Someone posted it some time ago, look for it on the Scripts archive.

Or just use this one:

Code:
#===============================================================================

#-------------------------------------------------------------------------------

# Multiplayer Script

# Version: 2.0

# By: Luis

 

# * Credit me, if you used it.

# * Please give your opinion in the RXMP forum.

# Thanks to Near Fantastica for the Keyboard.

#-------------------------------------------------------------------------------

#Variables - This variables are the starting point of the second player

#You can directly put the coordinates.

    

  $PLAYER_2_STARTING_POINT_X = 16

 

 

  $PLAYER_2_STARTING_POINT_Y = 12

    

#===============================================================================

#======================================

# â–  Keyboard Input Module

#======================================

#  By: Near Fantastica

#======================================

module Keyboard

#-----------------------------------------------------------

@keys = []

@pressed = []

Mouse_Left = 1

Mouse_Right = 2

Back= 8

Tab = 9

Enter = 13

Shift = 16

Ctrl = 17

Alt = 18

Esc = 27

Space = 32

Numberkeys = {}

Numberkeys[0] = 48

Numberkeys[1] = 49

Numberkeys[2] = 50

Numberkeys[3] = 51

Numberkeys[4] = 52

Numberkeys[5] = 53

Numberkeys[6] = 54

Numberkeys[7] = 55

Numberkeys[8] = 56

Numberkeys[9] = 57

Numberpad = {}

Numberpad[0] = 45

Numberpad[1] = 35

Numberpad[2] = 40

Numberpad[3] = 34

Numberpad[4] = 37

Numberpad[5] = 12

Numberpad[6] = 39

Numberpad[7] = 36

Numberpad[8] = 38

Numberpad[9] = 33

Letters = {}

Letters["A"] = 65

Letters["B"] = 66

Letters["C"] = 67

Letters["D"] = 68

Letters["E"] = 69

Letters["F"] = 70

Letters["G"] = 71

Letters["H"] = 72

Letters["I"] = 73

Letters["J"] = 74

Letters["K"] = 75

Letters["L"] = 76

Letters["M"] = 77

Letters["N"] = 78

Letters["O"] = 79

Letters["P"] = 80

Letters["Q"] = 81

Letters["R"] = 82

Letters["S"] = 83

Letters["T"] = 84

Letters["U"] = 85

Letters["V"] = 86

Letters["W"] = 87

Letters["X"] = 88

Letters["Y"] = 89

Letters["Z"] = 90

Fkeys = {}

Fkeys[1] = 112

Fkeys[2] = 113

Fkeys[3] = 114

Fkeys[4] = 115

Fkeys[5] = 116

Fkeys[6] = 117

Fkeys[7] = 118

Fkeys[8] = 119

Fkeys[9] = 120

Fkeys[10] = 121

Fkeys[11] = 122

Fkeys[12] = 123

Collon = 186

Equal = 187

Comma = 188

Underscore = 189

Dot = 190

Backslash = 191

Lb = 219

Rb = 221

Quote = 222

State = Win32API.new("user32","GetKeyState",['i'],'i')

Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')

#--------------------------------------------------------------------------

def Keyboard.getstate(key)

return true unless State.call(key).between?(0, 1)

return false

end

#--------------------------------------------------------------------------

def Keyboard.testkey(key)

Key.call(key) & 0x01 == 1

end

#--------------------------------------------------------------------------

def Keyboard.update

@keys = []

@keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)

@keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)

@keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)

@keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)

@keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)

@keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)

@keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)

@keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)

@keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)

@keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)

for key in Keyboard::Numberkeys.values

@keys.push(key) if Keyboard.testkey(key)

end

for key in Keyboard::Numberpad.values

@keys.push(key) if Keyboard.testkey(key)

end

for key in Keyboard::Letters.values

@keys.push(key) if Keyboard.testkey(key)

end

for key in Keyboard::Fkeys.values

@keys.push(key) if Keyboard.testkey(key)

end

@keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)

@keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)

@keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)

@keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)

@keys.push(Keyboard::Dot) if Keyboard.testkey(Keyboard::Dot)

@keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)

@keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)

@keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)

@keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)

@pressed = []

@pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)

@pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)

@pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)

@pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)

@pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)

@pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)

@pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)

@pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)

@pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)

@pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)

for key in Keyboard::Numberkeys.values

@pressed.push(key) if Keyboard.getstate(key)

end

for key in Keyboard::Numberpad.values

@pressed.push(key) if Keyboard.getstate(key)

end

for key in Keyboard::Letters.values

@pressed.push(key) if Keyboard.getstate(key)

end

for key in Keyboard::Fkeys.values

@pressed.push(key) if Keyboard.getstate(key)

end

@pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)

@pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)

@pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)

@pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)

@pressed.push(Keyboard::Dot) if Keyboard.getstate(Keyboard::Dot)

@pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)

@pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)

@pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)

@pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)

end

#--------------------------------------------------------------------------

def Keyboard.trigger?(key)

return true if @keys.include?(key)

return false

end

#--------------------------------------------------------------------------

def Keyboard.pressed?(key)

return true if @pressed.include?(key)

return false

end

end

 

 

#==========================================================================  

#--------------------------------------------------------------------------

# Game_Map edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================

 

class Game_Map

  #--------------------------------------------------------------------------  

  attr_accessor :display2_x                # display x-coordinate * 128

  attr_accessor :display2_y                # display y-coordinate * 128

  #--------------------------------------------------------------------------  

  alias multi_initialize initialize

  #--------------------------------------------------------------------------  

    def initialize

      @display2_x = 0

      @display2_y = 0

    end  

  #--------------------------------------------------------------------------    

  alias multi_setup :setup

  #--------------------------------------------------------------------------  

   def setup(map_id)

     multi_setup(map_id)

     @display2_x = 0

     @display2_y = 0

   end

  #--------------------------------------------------------------------------

  # * Scroll Down2 Works with the multiplayer script: by: luis

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def scroll_down2(distance)

    @display2_y = [@display2_y + distance, (self.height - 15) * 128].min

  end

  #--------------------------------------------------------------------------

  # * Scroll Left2 Works with the multiplayer script: by: luis

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def scroll_left2(distance)

    @display2_x = [@display2_x - distance, 0].max

  end

  #--------------------------------------------------------------------------

  # * Scroll Right2 Works with the multiplayer script: by: luis

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def scroll_right2(distance)

    @display2_x = [@display2_x + distance, (self.width - 10) * 128].min

  end

  #--------------------------------------------------------------------------

  # * Scroll Up2 Works with the multiplayer script: by: luis

  #     distance : scroll distance

  #--------------------------------------------------------------------------

  def scroll_up2(distance)

    @display2_y = [@display2_y - distance, 0].max

  end

end

 

 

 

#==========================================================================  

#--------------------------------------------------------------------------

# Game_Character edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================

class Game_Character  

  #--------------------------------------------------------------------------

  # * Get Screen2 X-Coordinates

  #--------------------------------------------------------------------------

  def screen2_x

    # Get screen coordinates from real coordinates and map display position

    return (@real_x - $game_map.display2_x + 3) / 4 + 16

  end

  #--------------------------------------------------------------------------

  # * Get Screen2 Y-Coordinates

  #--------------------------------------------------------------------------

  def screen2_y

    # Get screen coordinates from real coordinates and map display position

    y = (@real_y - $game_map.display2_y + 3) / 4 + 32

    # Make y-coordinate smaller via jump count

    if @jump_count >= @jump_peak

      n = @jump_count - @jump_peak

    else

      n = @jump_peak - @jump_count

    end

    return y - (@jump_peak * @jump_peak - n * n) / 2

  end

  #--------------------------------------------------------------------------

  # * Get Screen2 Z-Coordinates

  #     height : character height

  #--------------------------------------------------------------------------

  def screen2_z(height = 0)

    # If display flag on closest surface is ON

    if @always_on_top

      # 999, unconditional

      return 999

    end

    # Get screen coordinates from real coordinates and map display position

    z = (@real_y - $game_map.display2_y + 3) / 4 + 32

    # If tile

    if @tile_id > 0

      # Add tile priority * 32

      return z + $game_map.priorities[@tile_id] * 32

    # If character

    else

      # If height exceeds 32, then add 31

      return z + ((height > 32) ? 31 : 0)

    end

  end

end

  

 

#==============================================================================

#  Game_Player2

#------------------------------------------------------------------------------

#  This class added a second player into the game, based on "$game_player"

#==============================================================================

 

class Game_Player2 < Game_Character

  #--------------------------------------------------------------------------

  # * Invariables

  #--------------------------------------------------------------------------

  CENTER2_X = (160 - 16) * 4   # Center screen x-coordinate * 4

  CENTER2_Y = (240 - 16) * 4   # Center screen y-coordinate * 4

  #--------------------------------------------------------------------------

  # * Passable Determinants

  #     x : x-coordinate

  #     y : y-coordinate

  #     d : direction (0,2,4,6,8)

  #         * 0 = Determines if all directions are impassable (for jumping)

  #--------------------------------------------------------------------------

  def passable?(x, y, d)

    # Get new coordinates

    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)

    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)

    # If coordinates are outside of map

    unless $game_map.valid?(new_x, new_y)

      # Impassable

      return false

    end

    # If debug mode is ON and ctrl key was pressed

    if $DEBUG and Input.press?(Input::CTRL)

      # Passable

      return true

    end

    super

  end

  #--------------------------------------------------------------------------

  # * Set Map Display Position to Center of Screen

  #--------------------------------------------------------------------------

  def center(x, y)

    max_x = ($game_map.width - 10) * 128

    max_y = ($game_map.height - 15) * 128

    $game_map.display2_x = [0, [x - CENTER2_X, max_x].min].max

    $game_map.display2_y = [0, [y - CENTER2_Y, max_y].min].max

  end

  #--------------------------------------------------------------------------

  # * Move to Designated Position

  #     x : x-coordinate

  #     y : y-coordinate

  #--------------------------------------------------------------------------

  def moveto(x, y)

    super

    # Centering

    center(x, y)

    # Make encounter count

    make_encounter_count

  end

  #--------------------------------------------------------------------------

  # * Increaase Steps

  #--------------------------------------------------------------------------

  def increase_steps

    super

    # If move route is not forcing

    unless @move_route_forcing

      # Increase steps

      $game_party.increase_steps

      # Number of steps are an even number

      if $game_party.steps % 2 == 0

        # Slip damage check

        $game_party.check_map_slip_damage

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Get Encounter Count

  #--------------------------------------------------------------------------

  def encounter_count

    return @encounter_count

  end

  #--------------------------------------------------------------------------

  # * Make Encounter Count

  #--------------------------------------------------------------------------

  def make_encounter_count

    # Image of two dice rolling

    if $game_map.map_id != 0

      n = $game_map.encounter_step

      @encounter_count = rand(n) + rand(n) + 1

    end

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    # If party members = 0

    if $game_party.actors.size == 0

      # Clear character file name and hue

      @character_name = ""

      @character_hue = 0

      # End method

      return

    end

    # Get lead actor

    actor = $game_party.actors[1]

    # Set character file name and hue

    @character_name = actor.character_name

    @character_hue = actor.character_hue

    # Initialize opacity level and blending method

    @opacity = 255

    @blend_type = 0

  end

  #--------------------------------------------------------------------------

  # * Same Position Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_here(triggers)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # All event loops

    for event in $game_map.events.values

      # If event coordinates and triggers are consistent

      if event.x == @x and event.y == @y and triggers.include?(event.trigger)

        # If starting determinant is same position event (other than jumping)

        if not event.jumping? and event.over_trigger?

          event.start

          result = true

        end

      end

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Front Envent Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_there(triggers)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # Calculate front event coordinates

    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

    # All event loops

    for event in $game_map.events.values

      # If event coordinates and triggers are consistent

      if event.x == new_x and event.y == new_y and

         triggers.include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          event.start

          result = true

        end

      end

    end

    # If fitting event is not found

    if result == false

      # If front tile is a counter

      if $game_map.counter?(new_x, new_y)

        # Calculate 1 tile inside coordinates

        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

        # All event loops

        for event in $game_map.events.values

          # If event coordinates and triggers are consistent

          if event.x == new_x and event.y == new_y and

             triggers.include?(event.trigger)

            # If starting determinant is front event (other than jumping)

            if not event.jumping? and not event.over_trigger?

              event.start

              result = true

            end

          end

        end

      end

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Touch Event Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_touch(x, y)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # All event loops

    for event in $game_map.events.values

      # If event coordinates and triggers are consistent

      if event.x == x and event.y == y and [1,2].include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          event.start

          result = true

        end

      end

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Remember whether or not moving in local variables

    last_moving = moving?

    # If moving, event running, move route forcing, and message window

    # display are all not occurring

    unless moving? or $game_system.map_interpreter.running? or

           @move_route_forcing or $game_temp.message_window_showing

      # Move player in the direction the directional button is being pressed

      if Keyboard.pressed?(83)

        move_down

      elsif Keyboard.pressed?(65)

        move_left

      elsif Keyboard.pressed?(68)

        move_right

      elsif Keyboard.pressed?(87) # W

        move_up

      end

    end

    # Remember coordinates in local variables

    last_real_x = @real_x

    last_real_y = @real_y

    super

    # If character moves down and is positioned lower than the center

    # of the screen

    if @real_y > last_real_y and @real_y - $game_map.display2_y > CENTER2_Y

      # Scroll map down

      $game_map.scroll_down2(@real_y - last_real_y)

    end

    # If character moves left and is positioned more let on-screen than

    # center

    if @real_x < last_real_x and @real_x - $game_map.display2_x < CENTER2_X

      # Scroll map left

      $game_map.scroll_left2(last_real_x - @real_x)

    end

    # If character moves right and is positioned more right on-screen than

    # center

    if @real_x > last_real_x and @real_x - $game_map.display2_x > CENTER2_X

      # Scroll map right

      $game_map.scroll_right2(@real_x - last_real_x)

    end

    # If character moves up and is positioned higher than the center

    # of the screen

    if @real_y < last_real_y and @real_y - $game_map.display2_y < CENTER2_Y

      # Scroll map up

      $game_map.scroll_up2(last_real_y - @real_y)

    end

    # If not moving

    unless moving?

      # If player was moving last time

      if last_moving

        # Event determinant is via touch of same position event

        result = check_event_trigger_here([1,2])

        # If event which started does not exist

        if result == false

          # Disregard if debug mode is ON and ctrl key was pressed

          unless $DEBUG and Input.press?(Input::CTRL)

            # Encounter countdown

            if @encounter_count > 0

              @encounter_count -= 1

            end

          end

        end

      end

      # If C button was pressed

      if Keyboard.pressed?(9)

        # Same position and front event determinant

        check_event_trigger_here([0])

        check_event_trigger_there([0,1,2])

      end

    end

  end

end

 

 

#==============================================================================

# ** Sprite_Character2

#------------------------------------------------------------------------------

#  This sprite is used to display the character.It observes the Game_Character

#  class and automatically changes sprite conditions.

#==============================================================================

 

class Sprite_Character2 < RPG::Sprite

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :character                # character

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     viewport  : viewport

  #     character : character (Game_Character)

  #--------------------------------------------------------------------------

  def initialize(viewport, character = nil)

    super(viewport)

    @character = character

    update

  end

  #--------------------------------------------------------------------------

  # * 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

      # 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

      end

    end

    # Set visible situation

    self.visible = (not @character.transparent)

    # If graphic is character

    if @tile_id == 0

      # Set rectangular transfer

      sx = @character.pattern * @cw

      sy = (@character.direction - 2) / 2 * @ch

      self.src_rect.set(sx, sy, @cw, @ch)

    end

    # Set sprite coordinates

    self.x = @character.screen2_x

    self.y = @character.screen2_y

    self.z = @character.screen2_z(@ch)

    # Set opacity level, blend method, and bush depth

    self.opacity = @character.opacity

    self.blend_type = @character.blend_type

    self.bush_depth = @character.bush_depth

    # Animation

    if @character.animation_id != 0

      animation = $data_animations[@character.animation_id]

      animation(animation, true)

      @character.animation_id = 0

    end

  end

end

 

 

class Spriteset_Map

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    # Make viewports

    @viewport1 = Viewport.new(0, 0, 319, 480)

    @viewport2 = Viewport.new(0, 0, 319, 480)

    @viewport3 = Viewport.new(0, 0, 319, 480)

    @viewport2.z = 200

    @viewport3.z = 5000

    # Make tilemap

    @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

    # Make panorama plane

    @panorama = Plane.new(@viewport1)

    @panorama.z = -1000

    # Make fog plane

    @fog = Plane.new(@viewport1)

    @fog.z = 3000

    # Make character sprites

    @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_Character.new(@viewport1, $game_player))

    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player2))

    # Make weather

    @weather = RPG::Weather.new(@viewport1)

    # Make picture sprites

    @picture_sprites = []

    for i in 1..50

      @picture_sprites.push(Sprite_Picture.new(@viewport2,

        $game_screen.pictures[i]))

    end

    # Make timer sprite

    @timer_sprite = Sprite_Timer.new

    # Frame update

    update

  end

end

 

#==============================================================================

# Spriteset_Map2

#------------------------------------------------------------------------------

# This class allows to see the second screen, that follows the second player

# based on the original "Spriteset_Map".

#==============================================================================

 

class Spriteset_Map2

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    # Make viewports

    @viewport1 = Viewport.new(325, 0, 319, 480)

    @viewport2 = Viewport.new(325, 0, 319, 480)

    @viewport3 = Viewport.new(325, 0, 319, 480)

    @viewport2.z = 200

    @viewport3.z = 5000

    # Make tilemap

    @tilemap = Tilemap.new(@viewport1)

    @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)

    for i in 0..6

      autotile_name2 = $game_map.autotile_names[i]

      @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name2)

    end

    @tilemap.map_data = $game_map.data

    @tilemap.priorities = $game_map.priorities

    # Make panorama plane

    @panorama = Plane.new(@viewport1)

    @panorama.z = -1000

    # Make fog plane

    @fog = Plane.new(@viewport1)

    @fog.z = 3000

    # Make character sprites

    @character_sprites = []

    for i in $game_map.events.keys.sort

      sprite = Sprite_Character2.new(@viewport1, $game_map.events[i])

      @character_sprites.push(sprite)

    end

    @character_sprites.push(Sprite_Character2.new(@viewport1, $game_player))

    @character_sprites.push(Sprite_Character2.new(@viewport1, $game_player2))

    # Make weather

    @weather = RPG::Weather.new(@viewport1)

    # Make picture sprites

    @picture_sprites = []

    for i in 1..50

      @picture_sprites.push(Sprite_Picture.new(@viewport2,

        $game_screen.pictures[i]))

    end

    # Make timer sprite

    @timer_sprite = Sprite_Timer.new

    # Frame update

    update

  end

  #--------------------------------------------------------------------------

  # * Dispose

  #--------------------------------------------------------------------------

  def dispose

    # Dispose of tilemap

    @tilemap.tileset.dispose

    for i in 0..6

      @tilemap.autotiles[i].dispose

    end

    @tilemap.dispose

    # Dispose of panorama plane

    @panorama.dispose

    # Dispose of fog plane

    @fog.dispose

    # Dispose of character sprites

    for sprite in @character_sprites

      sprite.dispose

    end

    # Dispose of weather

    @weather.dispose

    # Dispose of picture sprites

    for sprite in @picture_sprites

      sprite.dispose

    end

    # Dispose of timer sprite

    @timer_sprite.dispose

    # Dispose of viewports

    @viewport1.dispose

    @viewport2.dispose

    @viewport3.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # If panorama is different from current one

    if @panorama_name != $game_map.panorama_name or

       @panorama_hue != $game_map.panorama_hue

      @panorama_name = $game_map.panorama_name

      @panorama_hue = $game_map.panorama_hue

      if @panorama.bitmap != nil

        @panorama.bitmap.dispose

        @panorama.bitmap = nil

      end

      if @panorama_name != ""

        @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)

      end

      Graphics.frame_reset

    end

    # If fog is different than current fog

    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue

      @fog_name = $game_map.fog_name

      @fog_hue = $game_map.fog_hue

      if @fog.bitmap != nil

        @fog.bitmap.dispose

        @fog.bitmap = nil

      end

      if @fog_name != ""

        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)

      end

      Graphics.frame_reset

    end

    # Update tilemap

    @tilemap.ox = $game_map.display2_x / 4

    @tilemap.oy = $game_map.display2_y / 4

    @tilemap.update

    # Update panorama plane

    @panorama.ox = $game_map.display2_x / 8

    @panorama.oy = $game_map.display2_y / 8

    # Update fog plane

    @fog.zoom_x = $game_map.fog_zoom / 100.0

    @fog.zoom_y = $game_map.fog_zoom / 100.0

    @fog.opacity = $game_map.fog_opacity

    @fog.blend_type = $game_map.fog_blend_type

    @fog.ox = $game_map.display2_x / 4 + $game_map.fog_ox

    @fog.oy = $game_map.display2_y / 4 + $game_map.fog_oy

    @fog.tone = $game_map.fog_tone

    # Update character sprites

    for sprite in @character_sprites

      sprite.update

    end

    # Update weather graphic

    @weather.type = $game_screen.weather_type

    @weather.max = $game_screen.weather_max

    @weather.ox = $game_map.display2_x / 4

    @weather.oy = $game_map.display2_y / 4

    @weather.update

    # Update picture sprites

    for sprite in @picture_sprites

      sprite.update

    end

    # Update timer sprite

    @timer_sprite.update

    # Set screen color tone and shake position

    @viewport1.tone = $game_screen.tone

    @viewport1.ox = $game_screen.shake

    # Set screen flash color

    @viewport3.color = $game_screen.flash_color

    # Update viewports

    @viewport1.update

    @viewport3.update

  end

end

 

 

#==========================================================================  

#--------------------------------------------------------------------------

# Scene_Map edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================

class Scene_Map

#------------------------------------------------------------------------------  

  alias multi_main main

   def main

     @spriteset2 = Spriteset_Map2.new

     multi_main

     @spriteset2.dispose

   end

#------------------------------------------------------------------------------

  alias multi_update update

   def update

     $game_player2.update

     multi_update

     @spriteset2.update

   end

#------------------------------------------------------------------------------    

  alias multi_call_battle call_battle

   def call_battle

     multi_call_battle

     $game_player2.straighten

   end

#------------------------------------------------------------------------------    

  alias multi_call_shop call_shop

   def call_shop

     multi_call_shop

     $game_player2.straighten

   end  

#------------------------------------------------------------------------------    

  alias multi_call_name call_name

   def call_name

     multi_call_name

     $game_player2.straighten

   end

#------------------------------------------------------------------------------    

  alias multi_call_menu call_menu

   def call_menu

     multi_call_menu

     $game_player2.straighten

   end  

#------------------------------------------------------------------------------    

  alias multi_call_save call_save

   def call_save

     multi_call_save

     $game_player2.straighten

   end  

#------------------------------------------------------------------------------    

  alias multi_call_debug call_debug

   def call_debug

     multi_call_debug

     $game_player2.straighten

   end

#------------------------------------------------------------------------------  

  alias multi_transfer_player transfer_player

   def transfer_player

    $game_temp.player_transferring = false

    # If move destination is different than current map

    if $game_map.map_id != $game_temp.player_new_map_id

      # Set up a new map

      $game_map.setup($game_temp.player_new_map_id)

    end

    # Set up

    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)

    $game_player2.moveto($game_temp.player_new_x + 1, $game_temp.player_new_y)

    case $game_temp.player_new_direction

    when 2  

      $game_player.turn_down

      $game_player2.turn_down

    when 4  # left

      $game_player.turn_left

      $game_player2.turn_left

    when 6  # right

      $game_player.turn_right

      $game_player2.turn_right

    when 8  # up

      $game_player.turn_right

      $game_player2.turn_up

    end

     # Straighten player position

    $game_player.straighten

    $game_player2.straighten

    # Update map (run parallel process event)

    $game_map.update

    $game_player2.straighten

    $game_player2.center($game_player2.real_x,$game_player2.real_y)

    # Remake sprite set

    @spriteset.dispose

    @spriteset = Spriteset_Map.new

    @spriteset2.dispose

    @spriteset2 = Spriteset_Map2.new

    # If processing transition

    if $game_temp.transition_processing

      # Clear transition processing flag

      $game_temp.transition_processing = false

      # Execute transition

      Graphics.transition(20)

    end

    # Run automatic change for BGM and BGS set on the map

    $game_map.autoplay

    # Frame reset

    Graphics.frame_reset

    # Update input information

    Input.update

   end

end

#==========================================================================  

#--------------------------------------------------------------------------

# Scene_Title edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================

class Scene_Title

#------------------------------------------------------------------------------  

  alias multi_command_new_game command_new_game

    def command_new_game

      multi_command_new_game

      $game_player2        = Game_Player2.new

      $game_player2.moveto($PLAYER_2_STARTING_POINT_X, $PLAYER_2_STARTING_POINT_Y)

      $game_player2.center($game_player2.real_x,$game_player2.real_y)

      $game_player2.refresh

    end  

#------------------------------------------------------------------------------

alias multi_battle_test battle_test

    def battle_test

      multi_battle_test

      $game_player2        = Game_Player2.new

    end  

  end

  

  

#==========================================================================  

#--------------------------------------------------------------------------

# Scene_Save edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================  

class Scene_Save

#------------------------------------------------------------------------------  

alias multi_write_save_data :write_save_data

   def write_save_data(file)

    multi_write_save_data(file)

    Marshal.dump($game_player2, file)

   end

  end  

#==========================================================================  

#--------------------------------------------------------------------------

# Scene_Load edited to work with the muliplayer script by luis.  

#--------------------------------------------------------------------------  

#==========================================================================  

class Scene_Load  

#------------------------------------------------------------------------------

alias multi_read_save_data :read_save_data

   def read_save_data(file)

     multi_read_save_data(file)

    $game_player2       = Marshal.load(file)

  end

end  

#------------------------------------------------------------------------------

The replace scene_map with this


Code:
#==============================================================================

# ** Scene_Map

#------------------------------------------------------------------------------

#  This class performs map screen processing.

#==============================================================================

 

class Scene_Map

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    # Make sprite set

    @spriteset = Spriteset_Map.new

    # Make message window

    @message_window = Window_Message.new

    # Transition run

    Graphics.transition

    # Main loop

    loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      Keyboard.update    #### Update the keyboard.This is the only edit.

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of sprite set

    @spriteset.dispose

    # Dispose of message window

    @message_window.dispose

    # If switching to title screen

    if $scene.is_a?(Scene_Title)

      # Fade out screen

      Graphics.transition

      Graphics.freeze

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Loop

    loop do

      # Update map, interpreter, and player order

      # (this update order is important for when conditions are fulfilled

      # to run any event, and the player isn't provided the opportunity to

      # move in an instant)

      $game_map.update

      $game_system.map_interpreter.update

      $game_player.update

      # Update system (timer), screen

      $game_system.update

      $game_screen.update

      # Abort loop if player isn't place moving

      unless $game_temp.player_transferring

        break

      end

      # Run place move

      transfer_player

      # Abort loop if transition processing

      if $game_temp.transition_processing

        break

      end

    end

    # Update sprite set

    @spriteset.update

    # Update message window

    @message_window.update

    # If game over

    if $game_temp.gameover

      # Switch to game over screen

      $scene = Scene_Gameover.new

      return

    end

    # If returning to title screen

    if $game_temp.to_title

      # Change to title screen

      $scene = Scene_Title.new

      return

    end

    # If transition processing

    if $game_temp.transition_processing

      # Clear transition processing flag

      $game_temp.transition_processing = false

      # Execute transition

      if $game_temp.transition_name == ""

        Graphics.transition(20)

      else

        Graphics.transition(40, "Graphics/Transitions/" +

          $game_temp.transition_name)

      end

    end

    # If showing message window

    if $game_temp.message_window_showing

      return

    end

    # If encounter list isn't empty, and encounter count is 0

    if $game_player.encounter_count == 0 and $game_map.encounter_list != []

      # If event is running or encounter is not forbidden

      unless $game_system.map_interpreter.running? or

             $game_system.encounter_disabled

        # Confirm troop

        n = rand($game_map.encounter_list.size)

        troop_id = $game_map.encounter_list[n]

        # If troop is valid

        if $data_troops[troop_id] != nil

          # Set battle calling flag

          $game_temp.battle_calling = true

          $game_temp.battle_troop_id = troop_id

          $game_temp.battle_can_escape = true

          $game_temp.battle_can_lose = false

          $game_temp.battle_proc = nil

        end

      end

    end

    # If B button was pressed

    if Input.trigger?(Input::B)

      # If event is running, or menu is not forbidden

      unless $game_system.map_interpreter.running? or

             $game_system.menu_disabled

        # Set menu calling flag or beep flag

        $game_temp.menu_calling = true

        $game_temp.menu_beep = true

      end

    end

    # If debug mode is ON and F9 key was pressed

    if $DEBUG and Input.press?(Input::F9)

      # Set debug calling flag

      $game_temp.debug_calling = true

    end

    # If player is not moving

    unless $game_player.moving?

      # Run calling of each screen

      if $game_temp.battle_calling

        call_battle

      elsif $game_temp.shop_calling

        call_shop

      elsif $game_temp.name_calling

        call_name

      elsif $game_temp.menu_calling

        call_menu

      elsif $game_temp.save_calling

        call_save

      elsif $game_temp.debug_calling

        call_debug

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Battle Call

  #--------------------------------------------------------------------------

  def call_battle

    # Clear battle calling flag

    $game_temp.battle_calling = false

    # Clear menu calling flag

    $game_temp.menu_calling = false

    $game_temp.menu_beep = false

    # Make encounter count

    $game_player.make_encounter_count

    # Memorize map BGM and stop BGM

    $game_temp.map_bgm = $game_system.playing_bgm

    $game_system.bgm_stop

    # Play battle start SE

    $game_system.se_play($data_system.battle_start_se)

    # Play battle BGM

    $game_system.bgm_play($game_system.battle_bgm)

    # Straighten player position

    $game_player.straighten

    # Switch to battle screen

    $scene = Scene_Battle.new

  end

  #--------------------------------------------------------------------------

  # * Shop Call

  #--------------------------------------------------------------------------

  def call_shop

    # Clear shop call flag

    $game_temp.shop_calling = false

    # Straighten player position

    $game_player.straighten

    # Switch to shop screen

    $scene = Scene_Shop.new

  end

  #--------------------------------------------------------------------------

  # * Name Input Call

  #--------------------------------------------------------------------------

  def call_name

    # Clear name input call flag

    $game_temp.name_calling = false

    # Straighten player position

    $game_player.straighten

    # Switch to name input screen

    $scene = Scene_Name.new

  end

  #--------------------------------------------------------------------------

  # * Menu Call

  #--------------------------------------------------------------------------

  def call_menu

    # Clear menu call flag

    $game_temp.menu_calling = false

    # If menu beep flag is set

    if $game_temp.menu_beep

      # Play decision SE

      $game_system.se_play($data_system.decision_se)

      # Clear menu beep flag

      $game_temp.menu_beep = false

    end

    # Straighten player position

    $game_player.straighten

    # Switch to menu screen

    $scene = Scene_Menu.new

  end

  #--------------------------------------------------------------------------

  # * Save Call

  #--------------------------------------------------------------------------

  def call_save

    # Straighten player position

    $game_player.straighten

    # Switch to save screen

    $scene = Scene_Save.new

  end

  #--------------------------------------------------------------------------

  # * Debug Call

  #--------------------------------------------------------------------------

  def call_debug

    # Clear debug call flag

    $game_temp.debug_calling = false

    # Play decision SE

    $game_system.se_play($data_system.decision_se)

    # Straighten player position

    $game_player.straighten

    # Switch to debug screen

    $scene = Scene_Debug.new

  end

  #--------------------------------------------------------------------------

  # * Player Place Move

  #--------------------------------------------------------------------------

  def transfer_player

    # Clear player place move call flag

    $game_temp.player_transferring = false

    # If move destination is different than current map

    if $game_map.map_id != $game_temp.player_new_map_id

      # Set up a new map

      $game_map.setup($game_temp.player_new_map_id)

    end

    # Set up player position

    $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)

    # Set player direction

    case $game_temp.player_new_direction

    when 2  # down

      $game_player.turn_down

    when 4  # left

      $game_player.turn_left

    when 6  # right

      $game_player.turn_right

    when 8  # up

      $game_player.turn_up

    end

    # Straighten player position

    $game_player.straighten

    # Update map (run parallel process event)

    $game_map.update

    # Remake sprite set

    @spriteset.dispose

    @spriteset = Spriteset_Map.new

    # If processing transition

    if $game_temp.transition_processing

      # Clear transition processing flag

      $game_temp.transition_processing = false

      # Execute transition

      Graphics.transition(20)

    end

    # Run automatic change for BGM and BGS set on the map

    $game_map.autoplay

    # Frame reset

    Graphics.frame_reset

    # Update input information

    Input.update

  end

end

im not giving support on this

2)http://www.google.com

3)What do you mean?
 

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