设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 76|回复: 0

[转载发布] SkillKost XP

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4471

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22949
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28314

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    SkillKost XP
    version 1.0.2

    by Kyonides Arkanthes


    Introduction

    This is a humble script that should allow you to customize your skill costs in three different ways as I stated in my comments.
    Take in consideration that I have overwritten 2 methods found in the Default Scripts because I did not have another choice.
    Default XP scripts were not very modular back in the days...

    The Script
                    Code:       
    # * SkillKost XP#   Scripter : Kyonides Arkanthes#   2020-08-13 - v1.0.2# This scriptlet allows you to alter the Skill Cost in 3 different ways:# - General Random Cost# - General Custom Cost# - Specific Custom Cost for a given Actor (per Level) or Enemy (no level)# The last option needs you to set the values in the Constants found in the# SkillKost module.# Place this script in a script section below Scene_Debug. Here is why:# * Script Calls * ## Toggle Random SP Cost for every battler in game#   SkillKost.random = true  or  false# Define a Custom SP Cost for every battler in game#   SkillKost.custom = Some Percent# * End of Script Calls * ## * Overridden Method * ## - Game_Battler#skill_can_use?# * Aliased Methods * ## - Game_Battler#sp=# - Interpreter#command_312 and #command_312# - Scene_Skill#update_skill# - Scene_Battle#make_skill_action_resultmodule SkillKost  @random = false  @random_max = 1 # 1 equals 100%  @custom = 0 # SP Percent: 0+  HEROES = {} # You better leave this line alone  MONSTERS = {} # You better leave this line alone  # HEROES[ [ActorID, SkillID] ] = { ActorMinLevel..MaxLevel => Percent, etc. }  HEROES[[1, 60]] = { 1..5 => 20, 6..10 => 15, 11..20 => 10 }  HEROES[[7, 81]] = { 1..2 => 25 }  # MONSTERS[ [EnemyID, SkillID] ] = Percent  class << self    attr_accessor :random, :custom, :skill_id, :used_event_command    def hero(actor_id, skill_id, level)      heroes = HEROES[[actor_id, skill_id]]      return 100 unless heroes      key = heroes.keys.select{|range| range.include?(level) }[0]      heroes[key] || 100    end    def monster(enemy_id, skill_id) MONSTERS[[enemy_id, skill_id]] || 100 end  endendclass Game_Battler  alias :kyon_skillkost_gm_btlr_sp :sp=  def sp=(new_sp)    if !SkillKost.used_event_command and @sp > new_sp      new_sp = @sp - skill_sp_cost(SkillKost.skill_id)    end    kyon_skillkost_gm_btlr_sp(new_sp)  end  def skill_sp_cost(skill_id)    cost = $data_skills[skill_id].sp_cost    cost = rand(cost * 2 + 1).round if SkillKost.random    cost = (SkillKost.custom * cost / 100).round if SkillKost.custom > 0    specific_skill_sp_cost(skill_id, cost)  end  def skill_can_use?(skill_id)    return false if dead?    return false if self.skill_sp_cost(skill_id) > self.sp    return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1    occasion = $data_skills[skill_id].occasion    return (occasion == 0 or occasion == 1) if $game_temp.in_battle    occasion == 0 or occasion == 2  endendclass Game_Actor  def specific_skill_sp_cost(skill_id, cost)    cost += cost * SkillKost.hero(@actor_id, skill_id, @level) / 100    cost.round  endendclass Game_Enemy  def specific_skill_sp_cost(skill_id, cost)    cost += cost * SkillKost.monster(@enemy_id, skill_id) / 100    cost.round  endendclass Interpreter  alias :kyon_skillkost_inter_cmd312 :command_312  alias :kyon_skillkost_inter_cmd332 :command_332  def command_312    SkillKost.used_event_command = true    kyon_skillkost_inter_cmd312    SkillKost.used_event_command = nil  end  def command_332    SkillKost.used_event_command = true    kyon_skillkost_inter_cmd332    SkillKost.used_event_command = nil  endendclass Scene_Skill  alias :kyon_skillkost_scn_skill_up_skill :update_skill  def update_skill    if Input.trigger?(Input::B)      SkillKost.skill_id = nil    elsif Input.trigger?(Input::C)      SkillKost.skill_id = @skill_window.skill.id    end    kyon_skillkost_scn_skill_up_skill  endendclass Scene_Battle  alias :kyon_skillkost_scn_btl_make_skill_ar :make_skill_action_result  def make_skill_action_result    SkillKost.skill_id = @active_battler.current_action.skill_id    kyon_skillkost_scn_btl_make_skill_ar    SkillKost.skill_id = nil  endend


    A Window_Skill class Modification
    It should allow you to get an updated version of the current skill's cost.
                    Code:       
    # * SkillKost XP - Default Skill Window Mod#   Scripter : Kyonides Arkanthes#   2020-08-16class Window_Skill  def draw_item(index)    skill = @data[index]    color = @actor.skill_can_use?(skill.id)? normal_color : disabled_color    contents.font.color = color    x = 4 + index % 2 * (288 + 32)    y = index / 2 * 32    rect = Rect.new(x, y, self.width / @column_max - 32, 32)    contents.fill_rect(rect, Color.new(0, 0, 0, 0))    bitmap = RPG::Cache.icon(skill.icon_name)    opacity = contents.font.color == normal_color ? 255 : 128    contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)    contents.draw_text(x + 28, y, 204, 32, skill.name, 0)    cost = @actor.skill_sp_cost(skill.id).to_s    contents.draw_text(x + 232, y, 48, 32, cost, 2)  endend


    Terms & Conditions

    Free for any game.
    Include my nickname in your game credits.
    Mention this forum as well.
    Give me a free copy of your completed game if you include at least 2 of my scripts!



    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/skillkost-xp.125205/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 17:57 , Processed in 0.143658 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表