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 기타 땅파기 18 file 비극ㆍ 2010.04.19 3013
196 메뉴 Final Fantasy VII Menu System 8 비극ㆍ 2010.04.19 3506
195 기타 스크린샷 기능 14 비극ㆍ 2010.04.19 2090
194 타이틀/게임오버 타이틀에서 홈페이지 연결 17 비극ㆍ 2010.04.19 2271
193 기타 메뉴에서 애니매이션 사용! 12 비극ㆍ 2010.04.19 3022
192 기타 그림자 없애기... 3 비극ㆍ 2010.04.19 1642
191 기타 세이브 포인트 2 비극ㆍ 2010.04.19 2518
190 기타 레벨업 이펙트... 20 비극ㆍ 2010.04.19 3768
189 기타 Lock Screen 3 비극ㆍ 2010.04.19 2012
188 그래픽 토마스 에디슨(파티클 엔진 비슷) 9 file 비극ㆍ 2010.04.19 3432
187 기타 전투후 이어지는 베경음 9 비극ㆍ 2010.04.19 2190
186 이동 및 탈것 자동 이동 시스템 20 file 허걱 2010.04.21 4303
185 메뉴 매우 간단명료한 메뉴. 32 file 비극ㆍ 2010.04.23 6619
184 메시지 직접 생각해서 만든 "문장 속 특정 단어 색 바꾸기" 10 file X.66 2010.04.28 4363
183 스킬 [ultimate series]스킬,아이템 데미지계산식을 자기입맛에 맞게 고치는 스크립트 16 file EuclidE 2010.05.04 4373
182 기타 [자작]게임 실행시 파일 체크 프로그램. 또는 파일 실행기. 16 file NightWind AYARSB 2010.05.20 3193
181 원경 원경(파노라마) 바꾸기 9 file 허걱 2010.05.28 3369
180 타이틀/게임오버 Graphics Load System 1.0.1 14 file NightWind AYARSB 2010.06.10 3230
179 변수/스위치 HG_Variables : 변수 확장 시스템 11 file 허걱 2010.06.14 2957
178 퀘스트 HG_QUEST_SYSTEM 29 file 허걱 2010.06.18 4130
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