VX 스크립트

Repel Effect
Version
1.0 revision final
Author puppeto4
Release Date 04/06/2008



Introduction

I always want repel effect in pokemon game in VX, so I made one smile.gif


Features

This script will enable random encounter to turn off temporarily and enable
it again when the character has moved up to the defined steps.
시작
#==============================================================================
# ** Repel Effect
#------------------------------------------------------------------------------
# Author  : puppeto4 (puppeto5@hotmail.com)
# Version : 1.0 revision final
# Date    : 04 / 06 / 2008
# Note    : Order Pizza Hut, support the rebellion.
# Check RPG RPG Revolution(http://www.rpgrevolution.com) for support
#------------------------------------------------------------------------------
# Function :  
#   This script will enable random encounter to turn off temporarily and enable
#   it again when the character has moved up to the defined steps.
#------------------------------------------------------------------------------
# Instruction :
#    Place this script, in a new script page below Material section.
#    Then create a new state(or more) and
#    write the Repel_Text value(default is "*REPEL") in the state's note field.
#    When the state is inflicted, random encounter will immediately disabled.
#    Also, write the Remove_Repel_Text value in the same state's note field.
#    If you don't, the random encounter won't be enabled again.Place it in this
#    format : value[steps] i.e : *REMOVE_REPEL[120]
#       value : Remove_Repel_Text value(default is "*REMOVE_REPEL")
#       steps : Steps taken before the state(the repel effect) is released.
#
#    Using the repel effect :
#
#    To use the repel effect from the menu, create a new item/skill and set the
#    item/skill to inflict the state that has repel effect. You need to write the
#    Repel_Text value(default is "*REPEL") in the item's/skill's note field too.
#    This is to enable notification when repel effect is activated.
#  
#    Player Notification :
#
#    If you want to notify the player when the repel effect is on,
#    in state message field(when actor is inflicted with the state),just write
#    the message that the repel effect is activated, i.e : " effect is activated."
#    It will show "[State name]  effect is activated." in game(not actor name as
#    opposed to usual).
#    As for the notification when the repel effect is off, in the state message
#    field(when state is released), just write the message that the repel effect
#    is off, i.e : " effect is weakened."
#    it will show "[State name]  effect is weakened." in game.
#    Anyway, if you don't want to notify the player, leave both field empty.
#==============================================================================
#==============================================================================
# ** RepelEffect : Configuration
#==============================================================================
#==============================================================================
# ** Puppeto
#------------------------------------------------------------------------------
#  This module handles setup for any script writen by me ^^.
#==============================================================================

module Puppeto
#==============================================================================
# ** Repel
#------------------------------------------------------------------------------
#  This module handles setup for the repel system script.
#==============================================================================
  
module Repel
  #------------------------------------------------------------------------
  # * Repel note text
  #     This is the text that you put in the state's note field for the repel
  #     to take effect when the state is inflicted on the character.
  #------------------------------------------------------------------------
  Repel_Text = "*REPEL"
  #------------------------------------------------------------------------
  # * Repel Remover Text
  #     This is the text that you put in the state's note field for the repel
  #     effect to be removed when the state is released for character.
  #------------------------------------------------------------------------
  Remove_Repel_Text = "*REMOVE_REPEL"
  #------------------------------------------------------------------------
  # * Setup for Message Window background and position
  # For the first object in array(default is 0), determine window background.
  # 0 : Normal Background, 1 : Dim Background, 2 : Transparent Background
  # For the second object in array(default is 2), determine window position.
  # 0 : Top Position, 1 : Middle Position, 2 : Bottom Position
  #------------------------------------------------------------------------
  Repel_Notify_Window = [0, 2]
#==============================================================================
# ** End of Repel module
#------------------------------------------------------------------------------    
end
#==============================================================================
# ** End of Puppeto module
#------------------------------------------------------------------------------
end  
#==============================================================================
# ** End of RepelEffect : Configuration
#==============================================================================
#==============================================================================
# ** RepelEffect : Script
#==============================================================================
#==============================================================================
# ** Class Alias
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Class(es) : Game_Battler, Game_Party, Game_Player, Scene_Item,
#                       Scene_Skill
#----------------------------------------------------------------------------
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Method(s) : add_state, remove_state
#----------------------------------------------------------------------------

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_repel_add_state add_state
  alias puppet_repel_remove_state remove_state
  #--------------------------------------------------------------------------
  # * Add State
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def add_state(state_id)
    # The usual
    puppet_repel_add_state(state_id)
    # Call create_repel_steps_count from $game_party
    $game_party.create_repel_steps_count(state_id)
  end
  #--------------------------------------------------------------------------
  # * Remove State
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def remove_state(state_id)
    # The usual
    puppet_repel_remove_state(state_id)
    # Call clear_repel_steps_count from $game_party
    $game_party.clear_repel_steps_count(state_id)
  end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Method(s) : initialize, on_player_walk
# * New Method(s)     : repel?, repel_steps_count, create_repel_steps_count,
#                       clear_repel_steps_count, check_repel_steps
#----------------------------------------------------------------------------

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Include Puppeto::Repel modules
  #--------------------------------------------------------------------------  
  include Puppeto::Repel  
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------  
  alias puppet_repel_initialize initialize        
  alias puppet_repel_on_player_walk on_player_walk
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # The usual
    puppet_repel_initialize
    # Set repel
    @repel = false
    # Create @repel_steps_count hash object
    @repel_steps_count = {}
  end
  #--------------------------------------------------------------------------
  # * Processing Performed When Player Takes 1 Step
  #--------------------------------------------------------------------------
  def on_player_walk
    # The usual
    puppet_repel_on_player_walk
    # If @repel_steps_count is nil
    @repel_steps_count = {} if @repel_steps_count == nil
    # Browse through all object in @repel_steps_count's keys  
    @repel_steps_count.keys.each do |i|
      # if @repel_steps_count's object is more than 0
      @repel_steps_count[i] -= 1 if @repel_steps_count[i] > 0
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if repel states inflicted on actor
  #--------------------------------------------------------------------------  
  def repel?
    # Browse through all actor in members
    members.each do |actor|
      # Return true if repel states is inflicted on actor
      return true if actor.repel?
    end
    return false
  end  
  #--------------------------------------------------------------------------
  # * Repel Steps Count
  #--------------------------------------------------------------------------
  def repel_steps_count
    # Return @repel_steps_count
    return @repel_steps_count
  end
  #--------------------------------------------------------------------------
  # * Create Repel Steps Count
  #     state_id : state ID  
  #--------------------------------------------------------------------------
  def create_repel_steps_count(state_id)
    # Create state; local variable
    state = $data_states[state_id]
    # Create repel_text; local variable
    repel_text = Remove_Repel_Text.dup
    # If state's note contain repel_text
    if state.note[/#{Regexp.quote repel_text}[(d+)]/].to_a[0]
      # Create n; local variable
      n = $1.to_i
      # Set @repel_steps_count to n
      @repel_steps_count[state_id] = n
    end
  end
  #--------------------------------------------------------------------------
  # * Clear Repel Steps Count
  #     state_id : state ID  
  #--------------------------------------------------------------------------
  def clear_repel_steps_count(state_id)
    # Delete @repel_steps_count
    @repel_steps_count.delete(state_id)
  end
  #--------------------------------------------------------------------------
  # * Check Repel Steps
  #--------------------------------------------------------------------------
  def check_repel_steps
    # Browse through all objects in @repel_steps_count's keys
    @repel_steps_count.keys.each do |i|
      # Unless that @repel_steps_count[i] isn't 0
      next if @repel_steps_count[i] != 0
        # Browse through all actor in members
        members.each do |actor|
          # Remove state from actor
          actor.remove_state(i)
        end
        # Create state; local variable
        state = $data_states[i]
        # Ignore if release message for state is empty
        next if state.message4.empty?
        # Set background for message
        $game_message.background = Repel_Notify_Window[0]
        # Set position for message
        $game_message.position = Repel_Notify_Window[1]
        # Push state's release message to message's text
        $game_message.texts << state.name + state.message4
    end
  end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Method(s) : update_encounter, check_touch_event
#----------------------------------------------------------------------------

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_repel_update_encounter update_encounter
  alias puppet_repel_check_touch_event check_touch_event
  #--------------------------------------------------------------------------
  # * Update Encounter
  #--------------------------------------------------------------------------
  def update_encounter
    # Return in repel states is inflicted on any actor in party
    return if $game_party.repel?
    # The usual
    puppet_repel_update_encounter
  end    
  #--------------------------------------------------------------------------
  # * Determine Event Start Caused by Touch (overlap)
  #--------------------------------------------------------------------------  
  def check_touch_event
    # Call check_repel_steps from $game_party
    $game_party.check_repel_steps
    # The usual
    puppet_repel_check_touch_event
  end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Method(s) : use_item_nontarget
#----------------------------------------------------------------------------

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Include Puppeto::Repel modules
  #--------------------------------------------------------------------------  
  include Puppeto::Repel    
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_repel_use_item_nontarget use_item_nontarget
  #--------------------------------------------------------------------------
  # * Use Item (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_item_nontarget
    # The usual
    puppet_repel_use_item_nontarget
    # If Repel_Text is included in the item's note
    if @item.note.include?(Repel_Text)
      # Browse through all objects in @repel_steps_count's keys
      $game_party.repel_steps_count.keys.each do |i|
        # Create state; local variable
        state = $data_states[i]
        # Ignore if actor message for state is empty
        next if state.message1.empty?
        # Set background for message
        $game_message.background = Repel_Notify_Window[0]
        # Set position for message
        $game_message.position = Repel_Notify_Window[1]
        # Push state's actor message to message's text
        $game_message.texts << state.name + state.message1
      end
    # Return to Scene_Map  
    $scene = Scene_Map.new
    end
  end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs the skill screen processing.
#==============================================================================
#----------------------------------------------------------------------------
# * Aliased Method(s) : use_skill_nontarget
#----------------------------------------------------------------------------

class Scene_Skill < Scene_Base
  #--------------------------------------------------------------------------
  # * Include Puppeto::Repel modules
  #--------------------------------------------------------------------------  
  include Puppeto::Repel    
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_repel_use_skill_nontarget use_skill_nontarget  
  #--------------------------------------------------------------------------
  # * Use Skill (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_skill_nontarget
    # The usual
    puppet_repel_use_skill_nontarget
    # If Repel_Text is included in the item's note
    if @skill.note.include?(Repel_Text)
      # Browse through all objects in @repel_steps_count's keys
      $game_party.repel_steps_count.keys.each do |i|
        # Create state; local variable
        state = $data_states[i]
        # Ignore if actor message for state is empty
        next if state.message1.empty?
        # Set background for message
        $game_message.background = Repel_Notify_Window[0]
        # Set position for message
        $game_message.position = Repel_Notify_Window[1]
        # Push state's actor message to message's text
        $game_message.texts << state.name + state.message1
      end
    # Return to Scene_Map  
    $scene = Scene_Map.new
    end
  end
end
#==============================================================================
# ** End of Class Alias
#==============================================================================
#==============================================================================
# ** Game_Actor(New Method)
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
#----------------------------------------------------------------------------
# * New Method(s) : repel?
#----------------------------------------------------------------------------

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Include Puppeto::Repel modules
  #--------------------------------------------------------------------------  
  include Puppeto::Repel
  #--------------------------------------------------------------------------
  # * Determine if repel note is included
  #--------------------------------------------------------------------------
  def repel?
    # Browse through all state in states
    states.each do |state|
      # Return true if Repel_Text is included in the state's note
      return true if state.note.include?(Repel_Text)
    end
    return false
  end
end
#==============================================================================
# ** End of RepelEffect : Script
#==============================================================================


Customization

Line 67, 73, 81. Change the value there if you want.


Compatibility

Should be compatible with other script, since it was aliased properly(no rewrite method)


Screenshot


Notification when repel effect is activated


데모

State setup...


item setup...


Skill setup...




DEMO

DEMO

Comment '1'
  • ?
    제이슨 2009.01.31 18:36
    랜덤으로 적과 조우하는거 100걸음 무효하는거...
    포켓몬스터 벌레스프레이랑 똑같은거네요...

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
177 전투 RPG Tankentai SBS 3.3 + ATB Kaduki Eng 58 아방스 2009.02.05 9071
176 기타 RPG 2000이나 RPG 2003처럼 전체화면으로 나오게 하는 스크립트(대박) 21 Man... 2008.10.28 4821
175 맵/타일 Roguelike Random Dungeon Generator 2.0 by cozziekuns 4 file Alkaid 2011.09.29 2560
174 영상 RMVX에서 AVI 재생 스크립트 12 Nymph 2008.07.07 4108
173 기타 RMVX Patcher 1.2.0 by Yeyinde 5 file Alkaid 2010.11.12 2116
172 기타 Resize and Scale by OriginalWij 1 습작 2013.05.13 1349
171 전투 Requiem SBABS (Requiem Squad Based Battle System) 14 vk 2009.02.07 7541
170 전투 Requiem ABS Hero Edition by Falcao 습작 2013.05.13 2004
169 전투 Requiem ABS 8 - 액션 배틀 시스템 8 36 아방스 2009.06.24 8540
» Repel Effect 1 Man... 2008.10.28 1753
167 기타 reijubv - New Balloon Command (VXA에서도 작동) 1 file 혜인 2013.04.08 1332
166 장비 Rei(레이)의 Paperdoll(비쥬얼 장비)스크립트 20 file 루시페르 2009.07.29 4467
165 이동 및 탈것 Rei Advanced Movement System 8 file 카르와푸딩의아틀리에 2009.08.19 2624
164 타이틀/게임오버 Random Title Screen 2 Man... 2008.10.28 1454
163 타이틀/게임오버 Rafidelis KaHh Box 타이틀화면 20 카르와푸딩의아틀리에 2009.08.23 5004
162 메시지 Quick Face Border 12 아방스 2008.03.05 4161
161 HUD PRABS v1.0 [hud,주석액알,원거리공격,hotkeys,vx] 대박감이다. 47 유칸지 2008.08.13 11114
160 전투 PRABS 2.0 액션배틀시스템 58 file RPGbooster 2008.10.08 7575
159 액터 Point Spend System 1.05 by Drago del Fato (포인트로 스탯 올리기) 6 Alkaid 2010.09.08 2612
158 Path Finding 6 Man... 2008.10.08 1530
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32