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 풍선대화 메세지시스템 32 file RPGbooster 2008.10.11 6126
616 폴스 세이브 4 Man... 2008.10.28 2343
615 폰 시스템 29 RPGbooster 2008.10.11 3454
614 전투 포켓몬 스크립트 한글화 완료 26 file 서울냥이 2010.10.11 6030
613 아이템 편리한 디자인의 아이템메뉴 30 file RPGbooster 2008.10.11 5098
612 기타 페이드 시간 변경 2 rukan 2009.07.01 1360
611 퍼스 스크립트 5 Man... 2008.10.28 1679
610 파티 파티원이 따라다니는 스크립트 11 file 놀러 2011.09.15 3988
609 파티 파티원의 첫번째 멤버로 추가하기 5 허걱 2012.12.04 1865
608 파티 파티 체인저 3.4 최신 13 file RPGbooster 2008.10.08 3864
607 파티 파티 변경 시스템 21 file 아방스 2008.03.09 3945
606 전투 파이널 판타지 XIII 배틀 시스템 [출처:RRR포럼] 56 file WolV 2010.02.03 6795
605 메뉴 파이날 판타지 IX 메뉴. 12 file 할렘 2009.02.06 6286
604 변수/스위치 특정 키눌러서 스위치 온 시키는 스크립트 7 아방이 2008.01.30 2608
603 기타 통합 스크립트(좋은 마우스 스크립트 좋은거),KGC좋은거 새로운 거 스크립트 세이브 스크립트 좋은거!~~~~~ 14 알피지GM 2010.03.07 3829
602 그래픽 토마스 에디슨(파티클 엔진 비슷) 9 file 비극ㆍ 2010.04.19 3432
601 기타 텍스트 파일 읽어 오는 스크립트 11 아방스 2008.03.04 2878
600 기타 태양 스크립트. 15 file 할렘 2009.02.20 4463
599 이동 및 탈것 탈것탑승후 내부로 이동하는 스크립트 16 file 카르와푸딩의아틀리에 2009.07.01 3268
598 탈것을 소환 12 file RPGbooster 2008.10.08 2713
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