Project1
标题:
关于经验书之类的道具如何制作
[打印本页]
作者:
高天之歌
时间:
2021-8-19 09:16
标题:
关于经验书之类的道具如何制作
想制作像恢复剂一样,选择谁就给谁加经验而不是公共事件中给全体队员或固定队员加经验
作者:
任小雪
时间:
2021-8-19 13:02
提示,可以利用状态的附加和附加与否判定,然后可以是逐个设置的不靠脚本的事件方法
作者:
shencao
时间:
2021-8-19 15:56
同2楼,给道具的效果加一个状态,对角色使用角色会被附加这个状态,然后在道具的公共事件里判定一下是谁持有这个状态,然后就对他操作你想要的效果blabla,最后解除状态。
把这个状态图标设成空白,就看不出来了~
作者:
Nil2018
时间:
2021-8-19 18:06
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ▼ 经验包
# Author: Kread-EX
# Version 1.01
# Release date: 01/02/2012
#
# For Tobyej.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#-------------------------------------------------------------------------------------------------
# ▼ UPDATES
#-------------------------------------------------------------------------------------------------
# # 30/03/2012. Fixed mistake in dynamic exp calculation.
#-------------------------------------------------------------------------------------------------
# ▼ TERMS OF USAGE
#-------------------------------------------------------------------------------------------------
# # You are free to adapt this work to suit your needs.
# # You can use this work for commercial purposes if you like it.
# # Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#-------------------------------------------------------------------------------------------------
# ▼ 介绍
#-------------------------------------------------------------------------------------------------
# # 一个为Tobyej写的小脚本,可以让物品给予使用者或目标一定的经验值
# # 事实上对技能也适用(??).
#-------------------------------------------------------------------------------------------------
# ▼ 使用方法
#-------------------------------------------------------------------------------------------------
# # 使用物品备注:
# # <target_exp: x> 给予目标x点exp
# # <target_exp%: x> 给予目标需要到下一级的x%的exp
# # <user_exp: x> 给予使用者x点exp
# # <user_exp%: x> 给予使用者需要到下一级的x%的exp
#-------------------------------------------------------------------------------------------------
# ▼ COMPATIBILITY
#-------------------------------------------------------------------------------------------------
# # List of aliases and overwrites:
# #
# # DataManager
# # load_database (alias)
# # load_expbag_notetags (new method)
# #
# # RPG::UsableItem
# # load_expbag_notetags (new method)
# # exp_user (new attr method)
# # exp_user_dyn (new attr method)
# # exp_target (new attr method)
# # exp_target_dyn (new attr method)
# #
# # Game_Actor
# # item_test (alias)
# # item_apply (alias)
# # item_user_effect (alias)
#-------------------------------------------------------------------------------------------------
$imported = {} if $imported.nil?
$imported['KRX-EXPBag'] = true
puts 'Load: EXP Bag v1.01 by Kread-EX'
module KRX
module REGEXP
EXP_GAIN_ON_HIT = /<target_exp:[ ]*(\d+)>/i
EXP_GAIN_ON_HIT_DYN = /<target_exp%:[ ]*(\d+)>/i
EXP_GAIN_ON_USE = /<user_exp:[ ]*(\d+)>/i
EXP_GAIN_ON_USE_DYN = /<user_exp%:[ ]*(\d+)>/i
end
end
#===========================================================================
# ■ DataManager
#===========================================================================
module DataManager
#--------------------------------------------------------------------------
# ● Loads the database
#--------------------------------------------------------------------------
class << self
alias_method(:krx_expbag_dm_load_database, :load_database)
end
def self.load_database
krx_expbag_dm_load_database
load_expbag_notetags
end
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def self.load_expbag_notetags
groups = [$data_items, $data_skills]
for group in groups
for obj in group
next if obj.nil?
obj.load_expbag_notetags
end
end
puts "Read: EXP Bag Notetags"
end
end
#==========================================================================
# ■ RPG::UsableItem
#==========================================================================
class RPG::UsableItem
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
attr_reader :exp_user
attr_reader :exp_user_dyn
attr_reader :exp_target
attr_reader :exp_target_dyn
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def load_expbag_notetags
@exp_user = @exp_user_dyn = 0
@exp_target = @exp_target_dyn = 0
@note.split(/[\r\n]+/).each do |line|
case line
when KRX::REGEXP::EXP_GAIN_ON_HIT
@exp_target = $1.to_i
when KRX::REGEXP::EXP_GAIN_ON_HIT_DYN
@exp_target_dyn = $1.to_i
when KRX::REGEXP::EXP_GAIN_ON_USE
@exp_user = $1.to_i
when KRX::REGEXP::EXP_GAIN_ON_USE_DYN
@exp_user_dyn = $1.to_i
end
end
end
end
#==========================================================================
# ■ Game_Actor
#==========================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● Searches if the item has any effect
#--------------------------------------------------------------------------
alias_method(:krx_expbag_ga_it, :item_test)
def item_test(user, item)
return true if item.exp_target > 0
return true if item.exp_target_dyn > 0
return true if item.exp_user > 0
return true if item.exp_user_dyn > 0
return krx_expbag_ga_it(user, item)
end
#--------------------------------------------------------------------------
# ● Applies the effects of a skill or item
#--------------------------------------------------------------------------
alias_method(:krx_expbag_ga_ia, :item_apply)
def item_apply(user, item)
krx_expbag_ga_ia(user, item)
gain_exp(item.exp_target) if item.exp_target > 0
if item.exp_target_dyn > 0
rate = item.exp_target_dyn / 100.00
gain_exp((next_level_exp - current_level_exp) * rate)
end
end
#--------------------------------------------------------------------------
# ● Applies the effects of the item on the user
#--------------------------------------------------------------------------
alias_method(:krx_expbag_ga_iue, :item_user_effect)
def item_user_effect(user, item)
krx_expbag_ga_iue(user, item)
user.gain_exp(item.exp_user) if item.exp_user > 0
if item.exp_user_dyn > 0
user.gain_exp(((user.next_level_exp - user.current_level_exp) *
item.exp_user_dyn / 100.00).round)
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1