Script na plošinovku

Skripty pro RPG Makeru XP (nekompatibilní s verzemi VX).

Moderátor: Moderátoři

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Script na plošinovku

Příspěvek od Sorc » květen 16, 2010, 7:49 pm

Spousta lidí si chce vytvořit plošinovku a spousta lidí ty, kteří ji chtějí vytvořit pomocí RM, považuje za blázny. Tak a teď budou vyvedeni z omylu, protože jsem po dlouhém hledání našel script, díky kterému už stačí jen rozestavovat plošinky a o nic víc se starat nemusíte. :) Už jsem si v tom scriptu hrál ale očividně to na něj nemělo vliv tak snad nevadí že ho sem dám takhle. A ty komentáře byly v nějakém asijském jazyce, protože ale není třeba nic měnit, není potřeba je číst.

Kód: Vybrat vše
#▼▲▼ XRXS50. Action-Maps XC. ▼▲▼ built 033010
# by 桜雅 在土

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
class XRXS50
#
# Action-Maps を稼動させるマップIDの配列
#
ENABLE_FULL_ACTY_MAPS = [1,2]#
# 「斜め降下」
#
ENABLE_SLIDE_DESCENT = true
#
# 向きジャンプ(true : 向いている方向へジャンプ。
# false : キーが押されている方向へジャンプ。)
#
JUMP_AS_KEY = false
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
# 既存
attr_writer :direction_fix
attr_accessor :walk_anime
# 新規
attr_accessor :now_jumps
attr_writer :xrxs50_direction_sidefix
#--------------------------------------------------------------------------
# ○ 最大ジャンプ回数
#--------------------------------------------------------------------------
def max_jumps
return 1
end
#--------------------------------------------------------------------------
# ● 左を向く
#--------------------------------------------------------------------------
alias xrxs50_turn_left turn_left
def turn_left
if @xrxs50_direction_sidefix
@direction = 4
else
xrxs50_turn_left
end
end
#--------------------------------------------------------------------------
# ● 右を向く
#--------------------------------------------------------------------------
alias xrxs50_turn_right turn_right
def turn_right
if @xrxs50_direction_sidefix
@direction = 6
else
xrxs50_turn_right
end
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias xrxs50_main main
def main
# チェック
xrxs50_enable_check
# 呼び戻す
xrxs50_main
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias xrxs50_update update
def update
# 呼び戻す
xrxs50_update
# フレーム更新 (座標系更新)
if @xrxs50_enable
update_coordinates
end
end
#--------------------------------------------------------------------------
# ○ フレーム更新 (座標系更新)
#--------------------------------------------------------------------------
def update_coordinates
if $game_player.passable?($game_player.x,$game_player.y,2)
unless $game_player.moving?
if XRXS50::ENABLE_SLIDE_DESCENT and
Input.press?(Input::RIGHT) and
$game_player.passable?($game_player.x,$game_player.y+1,6)
$game_player.move_lower_right
elsif XRXS50::ENABLE_SLIDE_DESCENT and
Input.press?(Input::LEFT) and
$game_player.passable?($game_player.x,$game_player.y+1,4)
$game_player.move_lower_left
else
$game_player.move_down
end
end
else
$game_player.move_down
$game_player.walk_anime = true unless $game_player.walk_anime
$game_player.now_jumps = 0
if Input.trigger?(Input::X) and
$game_player.now_jumps < $game_player.max_jumps
if XRXS50::JUMP_AS_KEY
direction = $game_player.direction == 11 ? -11 : 11
else
if Input.press?(Input::RIGHT)
direction = 5
elsif Input.press?(Input::LEFT)
direction = -5
else
direction = 0
end
end
$game_player.jump(direction, -1)
$game_player.now_jumps += 2
$game_player.walk_anime = false
end
end
end
#--------------------------------------------------------------------------
# ● プレイヤーの場所移動
#--------------------------------------------------------------------------
alias xrxs50_transfer_player transfer_player
def transfer_player
# 呼び戻す
xrxs50_transfer_player
# チェック
xrxs50_enable_check
end
#--------------------------------------------------------------------------
# ○ XRXS50 が稼動するか判定
#--------------------------------------------------------------------------
def xrxs50_enable_check
if XRXS50::ENABLE_FULL_ACTY_MAPS.include?($game_map.map_id)
$game_player.now_jumps = 0 if $game_player.now_jumps.nil?
@xrxs50_enable = true
$game_player.direction_fix = true
$game_player.xrxs50_direction_sidefix = true
else
@xrxs50_enable = false
$game_player.direction_fix = false
$game_player.xrxs50_direction_sidefix = false
end
end
end


Ještě je však třeba nastavit to, aby hráč skákal více než 1 políčko. Proto přepište script game_Player.

Kód: Vybrat vše
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Invariables
  #--------------------------------------------------------------------------
  CENTER_X = (320 - 16) * 4   # Center screen x-coordinate * 4
  CENTER_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 - 20) * 128
    max_y = ($game_map.height - 15) * 128
    $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
    $game_map.display_y = [0, [y * 128 - CENTER_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[0]
    # 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
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        if Input.press?(Input::RIGHT)
          move_up and move_right
          move_up and move_right
          move_up and move_right
        elsif Input.press?(Input::LEFT)
          move_up and move_left
          move_up and move_left
          move_up and move_left
        else
          move_up
          move_up
          move_up
        end
      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.display_y > CENTER_Y
      # Scroll map down
      $game_map.scroll_down(@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.display_x < CENTER_X
      # Scroll map left
      $game_map.scroll_left(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.display_x > CENTER_X
      # Scroll map right
      $game_map.scroll_right(@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.display_y < CENTER_Y
      # Scroll map up
      $game_map.scroll_up(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 Input.trigger?(Input::C)
        # Same position and front event determinant
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
end


Obrázek

Download mého dema:
http://www.edisk.cz/stahni/79266/plosin ... 8.8KB.html


Přeji hodně úspěšných plošinovek a side-scrolling RPGček :)
úpravu scriptu Game_Player pro skok do stran udělal legition.
úpravu scriptu Game_Player pro vyšší skos jsem udělal já.

EDIT: V řádku 11 scriptu na plošinovku je třeba vypsat čísla všech map pro které má script platit!
Naposledy upravil Sorc dne květen 17, 2010, 4:20 pm, celkově upraveno 4

Uživatelský avatar
 
Příspěvky: 361
Registrován: březen 3, 2010, 5:59 pm
Bydliště: Chomutov

Re: Script na plošinovku

Příspěvek od komi » květen 16, 2010, 8:01 pm

to v game_player to mám dát pod nebo mám přepsat řádek 221 protože vždycky když to udělám naskočí chyba posledního řádku. :cry:

možná by se hodil tutoriál kde je ten script už upravenej.
Obrázek
Komi
Moje stránky: http://rm2k3.svet-stranek.cz/
RM2K3 4ever ;-)

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Re: Script na plošinovku

Příspěvek od Sorc » květen 16, 2010, 8:35 pm

Sry on je ten script celej předělanej, je tam celej + jsem přidal to co jsem si vyrobil pro test.

Uživatelský avatar
 
Příspěvky: 361
Registrován: březen 3, 2010, 5:59 pm
Bydliště: Chomutov

Re: Script na plošinovku

Příspěvek od komi » květen 16, 2010, 8:37 pm

bomba, díky sorci. :D :D :D
Obrázek
Komi
Moje stránky: http://rm2k3.svet-stranek.cz/
RM2K3 4ever ;-)

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Re: Script na plošinovku

Příspěvek od Sorc » květen 16, 2010, 8:42 pm

Mě neděkuj, já to jenom našel. Děkuj tomu chlápkovi co to napsal a legitionovi díky kterýmu fungujou správně skoky.

Uživatelský avatar
 
Příspěvky: 361
Registrován: březen 3, 2010, 5:59 pm
Bydliště: Chomutov

Re: Script na plošinovku

Příspěvek od komi » květen 16, 2010, 8:44 pm

ještě jedna věc postava má nastevený skok na nějaký tlačítko nebo to musim nastavit?
Obrázek
Komi
Moje stránky: http://rm2k3.svet-stranek.cz/
RM2K3 4ever ;-)

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Re: Script na plošinovku

Příspěvek od Sorc » květen 16, 2010, 8:47 pm

Nastavený to je na šipku nahoru, nastavit to jinak asi nebude úplně lehké.

Uživatelský avatar
 
Příspěvky: 361
Registrován: březen 3, 2010, 5:59 pm
Bydliště: Chomutov

Re: Script na plošinovku

Příspěvek od komi » květen 16, 2010, 8:54 pm

díky. :lol:
Obrázek
Komi
Moje stránky: http://rm2k3.svet-stranek.cz/
RM2K3 4ever ;-)

Uživatelský avatar
 
Příspěvky: 1915
Registrován: květen 18, 2009, 2:43 pm
Bydliště: České Budějovice - někde pod mostem xD

Re: Script na plošinovku

Příspěvek od Michalc » květen 16, 2010, 9:23 pm

Rek bych, ze to neni nic moc. Prominte. Ale rek bych, ze to neni spatnej script, ale kdo chce delat tu plosinovku, bude pro nej jednoduzsi se naucit s tim MMF 2. Tohle je takovy neohrabany a i kdyby se to nejak dalo jakoby zlepsit, pochybuju, ze se to nekdy vyrovna plosinovce z MMF2. Sorry, ale myslim, ze neni nad to, bejt uprimnej a rict svuj nazor.
Pomohl jsem ti? Pomoz i ty me. Jdi na --TUTO-- stranku a klikni na reklamu kterou tam uvidis. Tobe to zabere par vterin a me to pomuze.
Obrázek
Userbary - bannery - kraviny...
Obrázek
Obrázek

Obrázek Obrázek

Obrázek

Oficiální stránka hry Bratrstvo Vyvolávačú démonů: http://brotofde.blogspot.com/ - Tak nějak zrušeno

Obrázek
Můj nejnovější návrh WoW setu: Lvl 19 F1 Firebolt Mage Twink set

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Re: Script na plošinovku

Příspěvek od Sorc » květen 17, 2010, 2:55 pm

Jistě, není to dokonalé, ještě by se to dalo vylepšit scriptem na chození po pixelech a ne čtverečkách (alespoň myslím), ale třeba mě to takhle úplně stačí. Copak o to, naučit se v MMF2 plošinovku by snad nebyl problém, ale přecijen s RM už umím spoustu dalších věcí takže si tam udělám truhly, ABS a uvažuji i o CMS a podobně.

Uživatelský avatar
 
Příspěvky: 1915
Registrován: květen 18, 2009, 2:43 pm
Bydliště: České Budějovice - někde pod mostem xD

Re: Script na plošinovku

Příspěvek od Michalc » květen 17, 2010, 3:14 pm

Jiste, tobe to tak staci, pripoustim, ze truhly, ABS ci menu system bude good... Ale prece jenom ty skoky co jsou ted tu hru celkem zazdivaj. Sorry, ale hrace jen sotva bude bavit hra, kde pri kazdym druhym skoku skoci jinam, nez chce.
Pomohl jsem ti? Pomoz i ty me. Jdi na --TUTO-- stranku a klikni na reklamu kterou tam uvidis. Tobe to zabere par vterin a me to pomuze.
Obrázek
Userbary - bannery - kraviny...
Obrázek
Obrázek

Obrázek Obrázek

Obrázek

Oficiální stránka hry Bratrstvo Vyvolávačú démonů: http://brotofde.blogspot.com/ - Tak nějak zrušeno

Obrázek
Můj nejnovější návrh WoW setu: Lvl 19 F1 Firebolt Mage Twink set

Uživatelský avatar
 
Příspěvky: 881
Registrován: srpen 25, 2008, 9:01 pm

Re: Script na plošinovku

Příspěvek od Sorc » květen 17, 2010, 3:51 pm

Já vím že ty skoky nejsou ideální. A důležitý edit v prvním příspěvku!

Uživatelský avatar
 
Příspěvky: 361
Registrován: březen 3, 2010, 5:59 pm
Bydliště: Chomutov

Re: Script na plošinovku

Příspěvek od komi » květen 24, 2010, 6:00 am

V scriptu na plošinovku je již obsáhlý ještě jeden skok pomocí klávesy "a". :yes:
Obrázek
Komi
Moje stránky: http://rm2k3.svet-stranek.cz/
RM2K3 4ever ;-)


Zpět na Skripty pro RPG Maker XP

Kdo je online

Uživatelé procházející toto fórum: Žádní registrovaní uživatelé a 3 návštevníků