Project1
标题:
技能說明顯示特殊變數?
[打印本页]
作者:
jeff13579
时间:
2014-1-24 21:57
标题:
技能說明顯示特殊變數?
我的技能說明是
"造成(攻擊X0.5+2)點物理傷害"
假設我人物攻擊是60
有辦法讓說明直接顯示
"造成(32)點物理傷害"嗎?
說明文要隨能力提升而變動
作者:
喵呜喵5
时间:
2014-1-25 02:10
先加入这段脚本
=begin
#===============================================================================
Title: Convert Code: Eval
Author: Tsukihime
Date: Nov 25, 2013
URL: http://himeworks.wordpress.com/2013/09/17/battle-reactions/
--------------------------------------------------------------------------------
** Change log
Nov 25, 2013
- Initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Tsukihime in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description
This script adds a new convert code to your project called "eval".
You can use this to evaluate arbitrary formulas inside your show text
commands.
--------------------------------------------------------------------------------
** Installation
In the script editor, place this script below Materials and above Main
--------------------------------------------------------------------------------
** Usage
In your show text command, use the convert code
\eval[FORMULA}
The formula will be evaluated when the message is being processed and the
appropriate value will be displayed.
The following formula variables are available
p - game party
t - game troop
s - game switches
v - game variables
Note that the text is not automatically re-positioned to fill in the gaps.
#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_ConvertCodeEval"] = true
#===============================================================================
# ** Rest of Script
#===============================================================================
class Window_Base < Window
alias :th_convert_code_eval_convert_escape_characters :convert_escape_characters
def convert_escape_characters(text)
result = th_convert_code_eval_convert_escape_characters(text)
result.gsub!(/\eEVAL\[(.*)\]/i) { eval_convert_code($1) }
result
end
def eval_convert_code(formula, p=$game_party, t=$game_troop, s=$game_switches, v=$game_variables)
eval(formula)
end
end
复制代码
然后技能说明这么写即可:
造成\eval[(p.leader.atk * 0.5 +2).to_i]點物理傷害
作者:
jeff13579
时间:
2014-1-31 01:49
喵呜喵5 发表于 2014-1-25 02:10
先加入这段脚本然后技能说明这么写即可:
造成\eval[(p.leader.atk * 0.5 +2).to_i]點物理傷害
leader的話 應該是指隊長吧
可是如果技能是其他隊員的話 怎麼辦呢?
作者:
喵呜喵5
时间:
2014-1-31 16:12
把p.leader改成p.members[n]:第n+1名队伍成员
改成$game_actors[n]:数据库中第n名角色
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1