XP 스크립트

http://www.gamebaker.com/rmxp/scripts/self-variables.htm
  이벤트에 셀프스위치같은 로컬변수를 부여하는 스크립트입니다.  사용하기 위해서는 SG Settings control 스크립트가 필요합니다.  이벤트 로컬변수는 전투시 임시변수로도 사용가능합니다.


오리지널 버전(로컬변수 1개):
#=============================================================================
# ** SG Self Variables
#=============================================================================
# sandgolem
# Version 2
# 7.05.06
#=============================================================================
#
SG_Self_Variable = 1
#
# To use this script, use variable #1 in any events.
# Set the number above if you'd like to use a different variable.
# It'll be whatever that event's self variable for it is.
# This also works for event page conditions
# In battle, this is a temporary variable that is reset with each.
#
#=============================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts. Needs to be under SG Script Control, but
# above any that alias Game_Event's refresh.
#
# This script is not SDK compatible. See site above for details on how to edit.
#
# Have problems? You can leave me a message at:
# http://www.gamebaker.com/users/sandgolem
#
#=============================================================================

class Scene_Title
  alias sandgolem_selfvar_title_main main
  def main
    $sg_self_variables = {}
    sandgolem_selfvar_title_main
  end
end   

class Scene_Save < Scene_File   
  alias sandgolem_selfvar_save_write write_save_data
  def write_save_data(file)
    $game_sg['selfvars'] = $sg_self_variables
    sandgolem_selfvar_save_write(file) 
    $game_sg['selfvars'] = nil
  end
end

class Scene_Load < Scene_File     
  alias sandgolem_selfvar_load_read read_save_data
  def read_save_data(file) 
    sandgolem_selfvar_load_read(file)
    if $game_sg['selfvars'] != nil
      $sg_self_variables = $game_sg['selfvars']
      $game_sg['selfvars'] = nil
    end
  end
end

class Scene_Battle
  alias sandgolem_selfvar_battle_main main
  def main
    $game_variables[SG_Self_Variable] = 0
    sandgolem_selfvar_battle_main
  end
end

class Interpreter
  alias sandgolem_selfvar_interp_execcommand execute_command
  def execute_command
    if $scene.is_a?(Scene_Map)
      @key = [@map_id, @event_id]
      if $sg_self_variables[@key] != nil
        $game_variables[SG_Self_Variable] = $sg_self_variables[@key]
      else
        $game_variables[SG_Self_Variable] = 0
      end
    end
    sandgolem_selfvar_interp_execcommand
  end
 
  alias sandgolem_selfvar_interp_command122 command_122
  def command_122
    sandgolem_selfvar_interp_command122
    if @parameters[0] == SG_Self_Variable && $scene.is_a?(Scene_Map)
      $sg_self_variables[@key] = $game_variables[SG_Self_Variable]
      $game_map.need_refresh = true
    end
  end
end

class Game_Event < Game_Character
 
  def refresh
    new_page = nil
    unless @erased
      for page in @event.pages.reverse
        c = page.condition
        if c.switch1_valid
          if $game_switches[c.switch1_id] == false
            next
          end
        end
        if c.switch2_valid
          if $game_switches[c.switch2_id] == false
            next
          end
        end
#------------------------------------------------------------------------------
# Begin SG Self Variables edit
#------------------------------------------------------------------------------
        if c.variable_valid
          if c.variable_id == SG_Self_Variable
            key = [$game_map.map_id, @event.id]
            if $sg_self_variables[key] != nil
              if $sg_self_variables[key] < c.variable_value
                next
              end
            else
              next
            end
          elsif $game_variables[c.variable_id] < c.variable_value
            next
          end
        end
#------------------------------------------------------------------------------
# End SG Self Variables edit
#------------------------------------------------------------------------------
        if c.self_switch_valid
          key = [@map_id, @event.id, c.self_switch_ch]
          if $game_self_switches[key] != true
            next
          end
        end
        new_page = page
        break
      end
    end
    if new_page == @page
      return
    end
    @page = new_page
    clear_starting
    if @page == nil
      @tile_id = 0
      @character_name = ""
      @character_hue = 0
      @move_type = 0
      @through = true
      @trigger = nil
      @list = nil
      @interpreter = nil
      return
    end
    @tile_id = @page.graphic.tile_id
    @character_name = @page.graphic.character_name
    @character_hue = @page.graphic.character_hue
    if @original_direction != @page.graphic.direction
      @direction = @page.graphic.direction
      @original_direction = @direction
      @prelock_direction = 0
    end
    if @original_pattern != @page.graphic.pattern
      @pattern = @page.graphic.pattern
      @original_pattern = @pattern
    end
    @opacity = @page.graphic.opacity
    @blend_type = @page.graphic.blend_type
    @move_type = @page.move_type
    @move_speed = @page.move_speed
    @move_frequency = @page.move_frequency
    @move_route = @page.move_route
    @move_route_index = 0
    @move_route_forcing = false
    @walk_anime = @page.walk_anime
    @step_anime = @page.step_anime
    @direction_fix = @page.direction_fix
    @through = @page.through
    @always_on_top = @page.always_on_top
    @trigger = @page.trigger
    @list = @page.list
    @interpreter = nil
    if @trigger == 4
      @interpreter = Interpreter.new
    end
    check_event_trigger_auto
  end
end


로컬변수 3개까지 사용가능한 버전:
#=============================================================================
# ** SG Self Variables B
#=============================================================================
# sandgolem
# Version 1
# 19.04.06
#=============================================================================
#
# To use this script, use variables #1 - 3 in any events.
# It'll be whatever that event's self variable for it is.
# This also works for event page conditions
# In battle, these are temporary variables that is reset with each.
#
#=============================================================================
#
# To check for updates or find more scripts, visit:
#      http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts. Needs to be under SG Script Control, but
# above any that alias Game_Event's refresh.
#
# Have problems? You can leave me a message at:
# http://www.gamebaker.com/users/sandgolem
#
#=============================================================================

class Scene_Title
  alias sandgolem_selfvarb_title_main main
  def main
    $sg_self_variables = {}
    sandgolem_selfvarb_title_main
  end
end   

class Scene_Save < Scene_File   
  alias sandgolem_selfvarb_save_write write_save_data
  def write_save_data(file)
    $game_sg['selfvars'] = $sg_self_variables
    sandgolem_selfvarb_save_write(file) 
    $game_sg['selfvars'] = nil
  end
end

class Scene_Load < Scene_File     
  alias sandgolem_selfvarb_load_read read_save_data
  def read_save_data(file) 
    sandgolem_selfvarb_load_read(file)
    if $game_sg['selfvars'] != nil
      $sg_self_variables = $game_sg['selfvars']
      $game_sg['selfvars'] = nil
    end   
  end
end

class Scene_Battle
  alias sandgolem_selfvarb_battle_main main
  def main
    for i in 1 .. 3
      $game_variables[i] = 0
    end
    sandgolem_selfvarb_battle_main
  end
end

class Interpreter
  alias sandgolem_selfvarb_interp_execcommand execute_command
  def execute_command
    if $scene.is_a?(Scene_Map)
      for i in 1 .. 3
        key = [@map_id, @event_id, i]
        if $sg_self_variables[key] != nil
          $game_variables[i] = $sg_self_variables[key]
        else
          $game_variables[i] = 0
        end
      end
    end
    sandgolem_selfvarb_interp_execcommand
  end
 
  alias sandgolem_selfvarb_interp_command122 command_122
  def command_122
    sandgolem_selfvarb_interp_command122
    if @parameters[0] <= 3 && $scene.is_a?(Scene_Map)
      for i in @parameters[0] .. @parameters[1]
        if i <= 3
          key = [@map_id, @event_id, i]
          $sg_self_variables[key] = $game_variables[1]
        end
      end
      $game_map.need_refresh = true
    end
  end
end

class Game_Event < Game_Character
 
  def refresh
    new_page = nil
    unless @erased
      for page in @event.pages.reverse
        c = page.condition
        if c.switch1_valid
          if $game_switches[c.switch1_id] == false
            next
          end
        end
        if c.switch2_valid
          if $game_switches[c.switch2_id] == false
            next
          end
        end
#------------------------------------------------------------------------------
# Begin SG Self Variables edit
#------------------------------------------------------------------------------
        if c.variable_valid
          if c.variable_id <= 3
            key = [$game_map.map_id, @event.id, c.variable_id]
            if $sg_self_variables[key] != nil
              if $sg_self_variables[key] < c.variable_value
                next
              end
            else
              next
            end
          elsif $game_variables[c.variable_id] < c.variable_value
            next
          end
        end
#------------------------------------------------------------------------------
# End SG Self Variables edit
#------------------------------------------------------------------------------
        if c.self_switch_valid
          key = [@map_id, @event.id, c.self_switch_ch]
          if $game_self_switches[key] != true
            next
          end
        end
        new_page = page
        break
      end
    end
    if new_page == @page
      return
    end
    @page = new_page
    clear_starting
    if @page == nil
      @tile_id = 0
      @character_name = ""
      @character_hue = 0
      @move_type = 0
      @through = true
      @trigger = nil
      @list = nil
      @interpreter = nil
      return
    end
    @tile_id = @page.graphic.tile_id
    @character_name = @page.graphic.character_name
    @character_hue = @page.graphic.character_hue
    if @original_direction != @page.graphic.direction
      @direction = @page.graphic.direction
      @original_direction = @direction
      @prelock_direction = 0
    end
    if @original_pattern != @page.graphic.pattern
      @pattern = @page.graphic.pattern
      @original_pattern = @pattern
    end
    @opacity = @page.graphic.opacity
    @blend_type = @page.graphic.blend_type
    @move_type = @page.move_type
    @move_speed = @page.move_speed
    @move_frequency = @page.move_frequency
    @move_route = @page.move_route
    @move_route_index = 0
    @move_route_forcing = false
    @walk_anime = @page.walk_anime
    @step_anime = @page.step_anime
    @direction_fix = @page.direction_fix
    @through = @page.through
    @always_on_top = @page.always_on_top
    @trigger = @page.trigger
    @list = @page.list
    @interpreter = nil
    if @trigger == 4
      @interpreter = Interpreter.new
    end
    check_event_trigger_auto
  end
end


**이 스크립트는 기본적으로 SDK와 호환되지 않습니다. 

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
541 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
540 능력치 올리기 스크립트 21 file 아방스 2007.11.09 3451
539 기타 능력치 무한대 스크립트 (따로 넣을필요없음) 2 백호 2009.02.21 1027
538 온라인 넷플레이1.7.0+abs5.5+한챗 49 쀍뛝쒧 2009.01.24 7289
537 메뉴 넷플레이 업그레이드됀 메뉴 스크립트 4 백호 2009.02.22 2040
536 HUD 넷플레이 HUD표시 2 file 백호 2009.02.22 3094
535 넷플2.0(펌) 3번째 4 오동훈 2008.02.25 1303
534 넷플2.0(펌) 2번째 2 오동훈 2008.02.25 1498
533 넷플2.0(펌) 1 오동훈 2008.02.25 1543
532 전투 깔끔한형식의 Asan'Tear배틀시스탬 4 file 콩밥 2010.09.29 4124
531 이동 및 탈것 기차스크립트 6 백호 2009.02.21 1757
530 스킬 기술문서(스킬 습득 아이템) 7 ok하승헌 2010.02.18 2132
529 기타 기본설정 강화ㄴ 1 백호 2009.02.21 1047
528 메뉴 기본메뉴 뜯어고친것. (스샷추가) 6 file 백호 2009.02.22 4315
527 이동 및 탈것 금금님 요청 대쉬 1 백호 2009.02.22 1384
526 이동 및 탈것 그림자 스크립트 13 file 백호 2009.02.22 3545
525 이동 및 탈것 그래픽의 크기로 좁은길은 못지나가게한다. 7 file 백호 2009.02.21 1816
524 이동 및 탈것 그래픽 변경 데쉬 3 file 백호 2009.02.22 2502
523 기타 광물캐기 시스템 v2 3 백호 2009.02.22 1776
522 기타 광물캐기 스크립트 1 file 백호 2009.02.22 1850
Board Pagination Prev 1 ... 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ... 52 Next
/ 52