VX 스크립트

Introduction
This script allow actors to have attributes that enhance their stats, damage when using certain elements, learn skills.

Features
  • custom attributes - each actor has its own attributes
    Attributes give
  • stat bonus
  • boost certain elements (skills/items damage)
  • may actiave a skill while attacking (Eg: You attack a monster, but the skill Fire activated and you use Fire on that monster.)
  • customizable attribute picture (24x24)
  • Each level you gain points equal to your level (start with 1)
  • To level up one attribute one must spend the square of the attribute's current level in points
    (Eg: Flame Mastery Level 1 - upgrade cost 1;Flame Mastery Level 2 - upgrade cost 2 (2x2); level 3 - cost 9 (3x3)
  • Script
    Script Mechanics 여기서 부터 시작합니다!!!!!!!!!!!!
  • module Attibute_Def
    ATTRIBUTES = {
    # 0 - attribute name => [
    "Flame Mastery" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [6,8,1,0,6,1],
    # [element_booster],
    [9],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Flame Mastery: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "155"
    ],
    # 1 - attribute name => [
    "Swordsmanship" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [9,2,7,3,0,1],
    # [element_booster],
    [2],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Swordsmanship: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "154"
    ]
    # scene desc
    }
    ATTRIBUTE_names = ATTRIBUTES.keys
    Actor_attributes = { 1 => [0,1],
    2 => [1]
    }
    end

    imported = {} if imported.nil?
    imported["Attributes"] = true
    #==============================================================================
    # ** Game_Actor
    #------------------------------------------------------------------------------
    # This class handles actors. It's used within the Game_Actors class
    # ($game_actors) and referenced by the Game_Party class ($game_party).
    #==============================================================================
    class Game_Actor < Game_Battler
    include Attibute_Def
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :attributes # attributes
    attr_accessor :attr_levels # attribute levels
    attr_accessor :attr_points # points
    #--------------------------------------------------------------------------
    # * Setup
    # actor_id : actor ID
    #--------------------------------------------------------------------------
    alias attributes_setup setup
    def setup(actor_id)
    attributes_setup(actor_id)
    @attributes = []
    @attr_levels = []
    @attr_points = 0
    if !Actor_attributes[actor_id].nil?
    for attr_i in Actor_attributes[actor_id]
    start_attributes(attr_i)
    end
    end
    end
    #--------------------------------------------------------------------------
    # * Attributes
    # attribute : attribute name
    # new_level : attribute level
    #--------------------------------------------------------------------------
    def start_attributes(attribute)
    attr = ATTRIBUTES[ATTRIBUTE_names[attribute]]
    attr_bonus = attr[0]
    if !attr_bonus.nil?
    @maxhp_plus += attr_bonus[0]
    @maxmp_plus += attr_bonus[1]
    @atk_plus += attr_bonus[2]
    @def_plus += attr_bonus[3]
    @spi_plus += attr_bonus[4]
    @agi_plus += attr_bonus[5]
    end
    attr_skills = attr[2][1]
    actor.learn_skill(attr_skills) if !attr_skills.nil?
    @attributes.push(attribute)
    @attributes.sort!
    @attr_levels[attribute] = 10
    end

    def attribute_up(attribute_id)
    @attr_levels[attribute_id] += 1
    attr = ATTRIBUTES[ATTRIBUTE_names[attribute_id]]
    attr_bonus = attr[0]
    if !attr_bonus.nil?
    @maxhp_plus += attr_bonus[0]
    @maxmp_plus += attr_bonus[1]
    @atk_plus += attr_bonus[2]
    @def_plus += attr_bonus[3]
    @spi_plus += attr_bonus[4]
    @agi_plus += attr_bonus[5]
    end
    attr_skills = attr[2][@attr_levels[attribute_id]]
    learn_skill(attr_skills) if !attr_skills.nil?
    end

    def attribute_down(attribute_id)
    @attr_levels[attribute_id] -= 1
    attr = ATTRIBUTES[ATTRIBUTE_names[attribute_id]]
    attr_bonus = attr[0]
    if !attr_bonus.nil?
    @maxhp_plus -= attr_bonus[0]
    @maxmp_plus -= attr_bonus[1]
    @atk_plus -= attr_bonus[2]
    @def_plus -= attr_bonus[3]
    @spi_plus -= attr_bonus[4]
    @agi_plus -= attr_bonus[5]
    end
    attr_skills = attr[2][@attr_levels[attribute_id]+1]
    forget_skill(attr_skills) if !attr_skills.nil?
    end
    #--------------------------------------------------------------------------
    # * Level Up
    #--------------------------------------------------------------------------
    alias attr_level_up level_up
    def level_up
    attr_level_up
    @attr_points += @level
    end
    #--------------------------------------------------------------------------
    # * Level Down
    #--------------------------------------------------------------------------
    alias attr_level_down level_down
    def level_down
    attr_level_down
    @attr_points -= @level
    @attr_points = 0 if @attr_points < 0
    end
    end

    #==============================================================================
    # ** Game_Battler
    #------------------------------------------------------------------------------
    # This class deals with battlers. It's used as a superclass of the Game_Actor
    # and Game_Enemy classes.
    #==============================================================================

    class Game_Battler
    include Attibute_Def
    #--------------------------------------------------------------------------
    # * Calculation of Damage Caused by Skills or Items
    # user : User of skill or item
    # obj : Skill or item (for normal attacks, this is nil)
    # The results are substituted for @hp_damage or @mp_damage.
    #--------------------------------------------------------------------------
    alias attr_make_obj_damage_value make_obj_damage_value
    def make_obj_damage_value(user, obj)
    if !user.attributes.nil?
    mult = 1
    for element_id in obj.element_set
    for attr in user.attributes
    for element_boost in ATTRIBUTES[ATTRIBUTE_names[attr]][1]
    mult += user.attr_levels[attr] / 10 if element_boost == element_id
    end
    end
    end
    obj.base_damage *= mult
    end
    attr_make_obj_damage_value(user, obj)
    end
    end

    #==============================================================================
    # ** Game_BattleAction
    #------------------------------------------------------------------------------
    # This class handles battle actions. This class is used within the
    # Game_Battler class.
    #==============================================================================

    class Game_BattleAction
    include Attibute_Def
    #--------------------------------------------------------------------------
    # * Set Normal Attack
    #--------------------------------------------------------------------------
    alias attr_set_attack set_attack
    def set_attack
    activated_special_skill = false
    if !battler.attributes.nil?
    for attr in battler.attributes
    auto_skill_id = ATTRIBUTES[ATTRIBUTE_names[attr]][3]
    if rand(100) < battler.attr_levels[attr] and !auto_skill_id.nil?
    set_skill(auto_skill_id)
    battler.last_skill_id = auto_skill_id
    battler.action.forcing = true
    activated_special_skill = true
    break
    end
    end
    end
    if activated_special_skill
    activated_special_skill = false
    else
    attr_set_attack
    end
    end
    end
  • 스크립트 다른것Scene Attributes
  • #================================================================
    ==============
    # ** Window_Attr_Desc
    #------------------------------------------------------------------------------
    # This window shows attribute explanations.
    #==============================================================================

    class Window_Attr_Desc < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
    super(0, 0, 544, 3 * WLH + 32)
    end
    #--------------------------------------------------------------------------
    # * Set Text lines 1..3
    # text : character string displayed in window
    # align : alignment (0..flush left, 1..center, 2..flush right)
    #--------------------------------------------------------------------------
    def set_text1(text, align = 0)
    if text != @text or align != @align
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
    @text = text
    @align = align
    end
    end
    def set_text2(text, align = 0)
    if text != @text or align != @align
    self.contents.font.color = normal_color
    self.contents.draw_text(4, WLH, self.width - 40, WLH, text, align)
    @text = text
    @align = align
    end
    end
    def set_text3(text, align = 0)
    if text != @text or align != @align
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 2*WLH, self.width - 40, WLH, text, align)
    @text = text
    @align = align
    end
    end
    end

    #==============================================================================
    # ** Window_Atrr_List
    #------------------------------------------------------------------------------
    # This window displays a list of attributes
    #==============================================================================

    class Window_Atrr_List < Window_Selectable
    include Attibute_Def
    #--------------------------------------------------------------------------
    # * Object Initialization
    # x : window x-coordinate
    # y : window y-coordinate
    # width : window width
    # height : window height
    # actor : actor
    #--------------------------------------------------------------------------
    def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @column_max = 1
    self.index = 0
    @line = 0
    refresh
    end
    #--------------------------------------------------------------------------
    # * Get Attribute
    #--------------------------------------------------------------------------
    def on_attribute
    return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
    @data = []
    for attr in @actor.attributes
    @data.push(attr)
    draw_attribute(attr)
    @line += 1
    end
    @item_max = @data.size
    end
    #--------------------------------------------------------------------------
    # * Draw Attribute
    # attr_i : attribute ID
    #--------------------------------------------------------------------------
    def draw_attribute(attr_i)
    attr_name = Attibute_Def::ATTRIBUTE_names[attr_i]
    y = @line * WLH
    self.contents.draw_text(4, y, 544, WLH, attr_name)
    for level in 0...@actor.attr_levels[attr_i]
    sq_name = ATTRIBUTES[ATTRIBUTE_names[attr_i]][6]
    sq = Cache.picture(sq_name)
    sq_rect = Rect.new(0, 0, sq.width, sq.height)
    self.contents.blt(150 + level * 30, y, sq, sq_rect, 255)
    end
    end
    #--------------------------------------------------------------------------
    # * Update Attr Window text
    #--------------------------------------------------------------------------
    def update_help
    if on_attribute == nil
    text1 = ""; text2 = ""; text3 = ""
    else
    attr_text = ATTRIBUTES[ATTRIBUTE_names[on_attribute]]
    text1 = sprintf(attr_text[4])
    text2 = sprintf(attr_text[5])
    level = @actor.attr_levels[on_attribute]
    up = level ** 2
    points = @actor.attr_points
    text3 = sprintf("Level: %s Upgrade Cost: %s Points: %s",level,up,points)
    end
    @help_window.set_text1(text1)
    @help_window.set_text2(text2)
    @help_window.set_text3(text3)
    end
    end

    #==============================================================================
    # ** Scene_Attributes
    #------------------------------------------------------------------------------
    # This class performs the skill screen processing.
    #==============================================================================

    class Scene_Attributes < Scene_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    # actor_index : actor index
    #--------------------------------------------------------------------------
    def initialize(actor_index = 0)
    @actor_index = actor_index
    end
    #--------------------------------------------------------------------------
    # * Start processing
    #--------------------------------------------------------------------------
    def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @viewport = Viewport.new(0, 0, 544, 416)
    @help_window = Window_Attr_Desc.new
    @help_window.viewport = @viewport
    @attr_window = Window_Atrr_List.new(0, 104, 544, 304-48, @actor)
    @attr_window.viewport = @viewport
    @attr_window.help_window = @help_window
    @attr_window.active = true
    @status_window = Window_SkillStatus.new(0, 416-56, @actor)
    @status_window.viewport = @viewport
    end
    #--------------------------------------------------------------------------
    # * Termination Processing
    #--------------------------------------------------------------------------
    def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @attr_window.dispose
    @status_window.dispose
    end
    #--------------------------------------------------------------------------
    # * Return to Original Screen
    #--------------------------------------------------------------------------
    def return_scene
    $scene = Scene_Menu.new(1)
    end
    #--------------------------------------------------------------------------
    # * Switch to Next Actor Screen
    #--------------------------------------------------------------------------
    def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Attributes.new(@actor_index)
    end
    #--------------------------------------------------------------------------
    # * Switch to Previous Actor Screen
    #--------------------------------------------------------------------------
    def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Attributes.new(@actor_index)
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
    super
    update_menu_background
    @help_window.update
    @attr_window.update
    @status_window.update
    update_attr_selection
    end
    #--------------------------------------------------------------------------
    # * Update Attribute Selection
    #--------------------------------------------------------------------------
    def update_attr_selection
    if Input.trigger?(Input::cool.gif
    Sound.play_cancel
    return_scene
    elsif Input.trigger?(Input::R)
    Sound.play_cursor
    next_actor
    elsif Input.trigger?(Input::L)
    Sound.play_cursor
    prev_actor
    elsif Input.trigger?(Input::C)
    attr_i = @attr_window.on_attribute
    level = @actor.attr_levels[attr_i]
    up = level ** 2
    points = @actor.attr_points
    if points >= up
    Sound.play_decision
    upgrade_attr(attr_i)
    $scene = Scene_Attributes.new(@actor_index)
    else
    Sound.play_buzzer
    end
    end
    end
    #--------------------------------------------------------------------------
    # * Upgrade Attribute
    #--------------------------------------------------------------------------
    def upgrade_attr(attribute_index)
    @actor.attr_points -= @actor.attr_levels[attribute_index] ** 2
    @actor.attribute_up(attribute_index)
    end
    end
  • Customizationmodule Attibute_Def
    ATTRIBUTES = {
    # 0 - attribute name => [
    "Flame Mastery" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [6,8,1,0,6,1],
    # [boost skills using this element (id)],
    [9],
    # {attribute level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    59,
    # desc line 1
    "Flame Mastery: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "155"
    ],
    # 1 - attribute name => [
    "Swordsmanship" => [
    #[bonus values: HP, MP, ATK, DEF, SPI, AGI],
    [9,2,7,3,0,1],
    # [element_booster],
    [2],
    # {level => skill id}
    {3 => 34, 4 => 45},
    # auto_skill id]
    nil,
    # desc line 1
    "Swordsmanship: affects the user's spirit and damage made",
    # desc line 2
    "by fire skills, may activate Flame kick while attacking.",
    # picture name
    "154"
    ]
    # scene desc
    }
    ATTRIBUTE_names = ATTRIBUTES.keys # don't change this
    Actor_attributes = {
    # attribute index = order of the attributes in the list. In the demo Flame Mastery is the first on the list, so its index is 0
    # for Swordmanship is 1
    #Actor Id => [attribute index, attribute index ...]
    1 => [0,1],
    2 => [1]
    }
  • Compatibility
    Should work with most things. (I hope so)
    overwrites the method: update_actor_command_selection

    Screenshot

    DEMO
    Version 1.2

    Installation
    Plug & Play.
    The Attribute pictures should go in the Pictures Folder

    Terms and Conditions
    Don't post this script on other forums, link them here.

    Notes
    Auto Skill now activates correctly.
    New Scene with the actor bar from the skill window. (check the new demo)

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
197 Limit Break VX 3 Man... 2008.10.28 1777
196 맵/타일 GubiD's Isometric Maps for RPG Maker VX 1 Man... 2008.10.28 1681
195 영상 ??(Avi play ver beta 0.8) 4 Man... 2008.10.28 1575
194 전투 오버 드라이브 프로블럼 2 Man... 2008.10.28 2268
193 새로운 종류의 세이브 스크립트!! 8 Man... 2008.10.28 3517
192 디러그 시스템?? 1 Man... 2008.10.28 1247
191 베틀 스크린 톤 체인지?? 무슨 말? 4 Man... 2008.10.28 1616
190 기타 TagNote v2.0 5 Man... 2008.10.28 1996
189 Detailed Call Script Error Mesage 3 Man... 2008.10.28 1258
188 변수/스위치 Variable Criticals Man... 2008.10.28 1480
187 타이틀/게임오버 New Title Screen 3 Man... 2008.10.28 1832
186 기타 RPG 2000이나 RPG 2003처럼 전체화면으로 나오게 하는 스크립트(대박) 21 Man... 2008.10.28 4821
185 Khai's Window Helper 1.4 1 Man... 2008.10.28 1272
184 More SaveFlies(대박) 2 Man... 2008.10.28 2125
» Attribute System Man... 2008.10.28 1293
182 폴스 세이브 4 Man... 2008.10.28 2343
181 타이틀/게임오버 Random Title Screen 2 Man... 2008.10.28 1454
180 미니맵 Map-System by AmIMeYet [미니맵] 9 Man... 2008.10.28 2746
179 아이템 아이템 프라이스 체인저?? Man... 2008.10.28 2385
178 Good VS EVil? 4 Man... 2008.10.28 1641
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