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
617 전투 GTBS for 2d_iso_x3 by Clarabel 2 습작 2013.05.13 1879
616 전투 VX_SRPG2 by tomoaky 1 습작 2013.05.13 2050
615 맵/타일 SwapXT by bulletxt 습작 2013.05.13 1292
614 기타 Resize and Scale by OriginalWij 1 습작 2013.05.13 1349
613 전투 Requiem ABS Hero Edition by Falcao 습작 2013.05.13 2005
612 전투 Verus Tempus Proelium by Vlad 습작 2013.05.13 1243
611 이동 및 탈것 장소이동시 효과 없애기 10 file 허걱 2013.05.05 1960
610 키입력 Key Simulator by Fantasist 습작 2013.05.01 1176
609 키입력 No F1, F12 and Alt+Return (Kein F1, F12 und Alt+Eingabe) by cremno 습작 2013.04.19 1046
608 기타 reijubv - New Balloon Command (VXA에서도 작동) 1 file 혜인 2013.04.08 1332
607 메시지 Etude87_Item_Choice ver.1.00 file 습작 2013.02.16 1771
606 기타 MSX - XP Characters on VX/VX Ace 2 Alkaid 2013.01.26 1346
605 파티 파티원의 첫번째 멤버로 추가하기 5 허걱 2012.12.04 1865
604 장비 카드 슬롯 장비 스크립트[수정] 2 빙하 2012.11.11 2058
603 영상 Avi 재생 스크립트! [고화질 재생 가능] 34 짭뿌C 2012.10.24 2952
602 메시지 문장 및 페이스 정렬 바꾸기 (Neonblack's Text Alignment and Face Flip script) MinaAubert 2012.09.19 2214
601 타이틀/게임오버 코아 코스튬씨의 랜덤 타이틀 스크립트를 VX용으로 변환 2 Alkaid 2012.09.14 1704
600 타이틀/게임오버 타이틀에 날씨 효과 주는 스크립트 (Melmarvin's Rainy Title Screen) 6 MinaAubert 2012.09.13 2323
599 액터 동료가 따라다니게 하는 스크립트 (Woratana's Caterpillar System) 5 MinaAubert 2012.09.13 3012
598 전투 Animated Battlers VX 3.7 by DerVVulfman Alkaid 2012.09.07 2098
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32