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 기타 KGC 스크립트 라이브러리 7 훈덕 2009.05.31 2611
196 변수/스위치 Etude87_Variables_VX 1 file 습작 2011.11.26 2608
195 변수/스위치 특정 키눌러서 스위치 온 시키는 스크립트 7 아방이 2008.01.30 2608
194 스킬 강화주문서, SW_EchantScroll by 시옷전사(SiotWarrior) 21 file 시옷전사 2011.07.13 2605
193 메뉴 윈도우 색변경 스크립트 7 file 비극ㆍ 2010.03.01 2598
192 기타 HG_SHOOT_ANIMATION 4 file 허걱 2010.11.17 2596
191 기타 Kylock1.2+(RMDude-Kylock1.5) Time System Script 4 file communnn 2011.10.20 2595
190 기타 미니게임 로또??일까? 14 file 카르와푸딩의아틀리에 2009.06.30 2577
189 맵/타일 Roguelike Random Dungeon Generator 2.0 by cozziekuns 4 file Alkaid 2011.09.29 2560
188 이동 및 탈것 VX의 기존 대쉬 기능 없애기 8 BAYONET 2008.05.18 2552
187 Crissaegrim SBABS BETA 1.0 12 file 21stcentury 2008.10.08 2543
186 레오 저장 스크립트 9 Man... 2008.10.28 2529
185 기타 문장의 스크롤! 13 루시페르 2009.06.06 2524
184 기타 078656577er님의 스크립트를 개조한, 사격용 스크립트 1 file 타코 2012.03.16 2519
183 기타 세이브 포인트 2 비극ㆍ 2010.04.19 2518
182 스킬 스킬 필요조건에 살짝 손대봤습니다. -- 수정 18 아이미르 2011.03.23 2499
181 기타 확장 에러 메시지 13 file 허걱 2009.08.17 2497
180 전투 전투후 HP/MP 퍼센테이지(지정) 회복 5 하얀슬픔 2010.12.06 2490
179 기타 능력치에 따른 스테이트변화 / 능력치한계지정 5 Evangelista 2009.05.26 2479
178 HUD 변수 표시 HUD 8 Tofuman 2009.02.15 2469
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