赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 4484 |
最后登录 | 2014-9-29 |
在线时间 | 83 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 83 小时
- 注册时间
- 2013-12-21
- 帖子
- 118
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #===============================================================================
- #** VX Input Module#输入脚本,没有什么需要更改的地方,54
- #===============================================================================
- module Input
- @keys = []
- @pressed = []
- Mouse_Left = 1
- Mouse_Right = 2
- Mouse_Middle = 4
- Back= 8
- Tab = 9
- Enter = 13
- Shift = 16
- Ctrl = 17
- Alt = 18
- Esc = 0x1B
- LT = 0x25
- UPs = 0x26
- RT = 0x27
- DN = 0x28
- Space = 32
- Numberkeys = {}
- Numberkeys[0] = 48
- Numberkeys[1] = 49
- Numberkeys[2] = 50
- Numberkeys[3] = 51
- Numberkeys[4] = 52
- Numberkeys[5] = 53
- Numberkeys[6] = 54
- Numberkeys[7] = 55
- Numberkeys[8] = 56
- Numberkeys[9] = 57
- Numberpad = {}
- Numberpad[0] = 45
- Numberpad[1] = 35
- Numberpad[2] = 40
- Numberpad[3] = 34
- Numberpad[4] = 37
- Numberpad[5] = 12
- Numberpad[6] = 39
- Numberpad[7] = 36
- Numberpad[8] = 38
- Numberpad[9] = 33
- Letters = {}
- Letters["A"] = 65
- Letters["B"] = 66
- Letters["C"] = 67
- Letters["D"] = 68
- Letters["E"] = 69
- Letters["F"] = 70
- Letters["G"] = 71
- Letters["H"] = 72
- Letters["I"] = 73
- Letters["J"] = 74
- Letters["K"] = 75
- Letters["L"] = 76
- Letters["M"] = 77
- Letters["N"] = 78
- Letters["O"] = 79
- Letters["P"] = 80
- Letters["Q"] = 81
- Letters["R"] = 82
- Letters["S"] = 83
- Letters["T"] = 84
- Letters["U"] = 85
- Letters["V"] = 86
- Letters["W"] = 87
- Letters["X"] = 88
- Letters["Y"] = 89
- Letters["Z"] = 90
- Fkeys = {}
- Fkeys[1] = 112
- Fkeys[2] = 113
- Fkeys[3] = 114
- Fkeys[4] = 115
- Fkeys[5] = 116
- Fkeys[6] = 117
- Fkeys[7] = 118
- Fkeys[8] = 119
- Fkeys[9] = 120
- Fkeys[10] = 121
- Fkeys[11] = 122
- Fkeys[12] = 123
- Collon = 186
- Equal = 187
- Comma = 188
- Underscore = 189
- Dot = 190
- Backslash = 191
- Lb = 219
- Rb = 221
- Quote = 222
- State = Win32API.new('user32','GetKeyState',['i'],'i')
- Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
- #-------------------------------------------------------------------------------
- USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
- #-------------------------------------------------------------------------------
- module_function
- #--------------------------------------------------------------------------
- def Input.getstate(key)
- return true unless State.call(key).between?(0, 1)
- return false
- end
- #--------------------------------------------------------------------------
- def Input.testkey(key)
- Key.call(key) & 0x01 == 1
- end
- #--------------------------------------------------------------------------
- def Input.update
- @keys = []
- @keys.push(Input::Mouse_Left) if Input.testkey(Input::Mouse_Left)
- @keys.push(Input::Mouse_Right) if Input.testkey(Input::Mouse_Right)
- @keys.push(Input::Back) if Input.testkey(Input::Back)
- @keys.push(Input::Tab) if Input.testkey(Input::Tab)
- @keys.push(Input::Enter) if Input.testkey(Input::Enter)
- @keys.push(Input::Shift) if Input.testkey(Input::Shift)
- @keys.push(Input::Ctrl) if Input.testkey(Input::Ctrl)
- @keys.push(Input::Alt) if Input.testkey(Input::Alt)
- @keys.push(Input::Esc) if Input.testkey(Input::Esc)
- for key in Input::Letters.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Numberkeys.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Numberpad.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Fkeys.values
- @keys.push(key) if Input.testkey(key)
- end
- @keys.push(Input::Collon) if Input.testkey(Input::Collon)
- @keys.push(Input::Equal) if Input.testkey(Input::Equal)
- @keys.push(Input::Comma) if Input.testkey(Input::Comma)
- @keys.push(Input::Underscore) if Input.testkey(Input::Underscore)
- @keys.push(Input::Dot) if Input.testkey(Input::Dot)
- @keys.push(Input::Backslash) if Input.testkey(Input::Backslash)
- @keys.push(Input::Lb) if Input.testkey(Input::Lb)
- @keys.push(Input::Rb) if Input.testkey(Input::Rb)
- @keys.push(Input::Quote) if Input.testkey(Input::Quote)
- @keys.push(Input::Space) if Input.testkey(Input::Space)
- @keys.push(Input::LT) if Input.testkey(Input::LT)
- @keys.push(Input::UPs) if Input.testkey(Input::UPs)
- @keys.push(Input::RT) if Input.testkey(Input::RT)
- @keys.push(Input::DN) if Input.testkey(Input::DN)
- @pressed = []
- @pressed.push(Input::Space) if Input.getstate(Input::Space)
- @pressed.push(Input::Mouse_Left) if Input.getstate(Input::Mouse_Left)
- @pressed.push(Input::Mouse_Right) if Input.getstate(Input::Mouse_Right)
- @pressed.push(Input::Back) if Input.getstate(Input::Back)
- @pressed.push(Input::Tab) if Input.getstate(Input::Tab)
- @pressed.push(Input::Enter) if Input.getstate(Input::Enter)
- @pressed.push(Input::Shift) if Input.getstate(Input::Shift)
- @pressed.push(Input::Ctrl) if Input.getstate(Input::Ctrl)
- @pressed.push(Input::Alt) if Input.getstate(Input::Alt)
- @pressed.push(Input::Esc) if Input.getstate(Input::Esc)
- @pressed.push(Input::LT) if Input.getstate(Input::LT)
- @pressed.push(Input::UPs) if Input.getstate(Input::UPs)
- @pressed.push(Input::RT) if Input.getstate(Input::RT)
- @pressed.push(Input::DN) if Input.getstate(Input::DN)
- for key in Input::Numberkeys.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Numberpad.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Letters.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Fkeys.values
- @pressed.push(key) if Input.getstate(key)
- end
- @pressed.push(Input::Collon) if Input.getstate(Input::Collon)
- @pressed.push(Input::Equal) if Input.getstate(Input::Equal)
- @pressed.push(Input::Comma) if Input.getstate(Input::Comma)
- @pressed.push(Input::Underscore) if Input.getstate(Input::Underscore)
- @pressed.push(Input::Dot) if Input.getstate(Input::Dot)
- @pressed.push(Input::Backslash) if Input.getstate(Input::Backslash)
- @pressed.push(Input::Lb) if Input.getstate(Input::Lb)
- @pressed.push(Input::Rb) if Input.getstate(Input::Rb)
- @pressed.push(Input::Quote) if Input.getstate(Input::Quote)
- end
- #--------------------------------------------------------------------------
- def Input.triggerd?(key)
- return true if @keys.include?(key)
- return false
- end
- #--------------------------------------------------------------------------
- def Input.pressed?(key)
- return true if @pressed.include?(key)
- return false
- end
- #--------------------------------------------------------------------------
- # * 4 Diraction
- #--------------------------------------------------------------------------
- def Input.dir4
- return 2 if Input.pressed?(Input::DN)
- return 4 if Input.pressed?(Input::LT)
- return 6 if Input.pressed?(Input::RT)
- return 8 if Input.pressed?(Input::UPs)
- return 0
- end
- #--------------------------------------------------------------------------
- # * Trigger (key)
- #--------------------------------------------------------------------------
- def trigger?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.triggerd?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Repeat (key)
- #--------------------------------------------------------------------------
- def repeat?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.triggerd?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Press (key)
- #--------------------------------------------------------------------------
- def press?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.pressed?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Check (key)
- #--------------------------------------------------------------------------
- def check(key)
- Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1 # key 0
- end
- #--------------------------------------------------------------------------
- # * Mouse Update
- #--------------------------------------------------------------------------
- def mouse_update
- @used_i = []
- for i in USED_KEYS
- x = check(i)
- if x == true
- @used_i.push(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Short Write C
- #--------------------------------------------------------------------------
- def Input.C
- Input.trigger?(C)
- end
- #--------------------------------------------------------------------------
- # * Short Write B
- #--------------------------------------------------------------------------
- def Input.B
- Input.trigger?(B)
- end
- #--------------------------------------------------------------------------
- # * Short Write A
- #--------------------------------------------------------------------------
- def Input.A
- Input.trigger?(A)
- end
- #--------------------------------------------------------------------------
- # * Short Write Down
- #--------------------------------------------------------------------------
- def Input.Down
- Input.trigger?(DOWN)
- end
- #--------------------------------------------------------------------------
- # * Short Write Up
- #--------------------------------------------------------------------------
- def Input.Up
- Input.trigger?(UP)
- end
- #--------------------------------------------------------------------------
- # * Short Write Right
- #--------------------------------------------------------------------------
- def Input.Right
- Input.trigger?(RIGHT)
- end
- #--------------------------------------------------------------------------
- # * Short Write Left
- #--------------------------------------------------------------------------
- def Input.Left
- Input.trigger?(LEFT)
- end
- #--------------------------------------------------------------------------
- # * Anykey pressed? ( A or B or C or Down or Up or Right or Left )
- #--------------------------------------------------------------------------
- def Input.Anykey
- if A or B or C or Down or Up or Right or Left
- return true
- else
- return false
- end
- end
- def Input.name?(num)
- return "MOUSE PRIMARY" if num==1
- return "MOUSE SECONDARY" if num==2
- return "MOUSE MIDDLE" if num==4
- return "MOUSE 4TH" if num==5
- return "MOUSE 5TH" if num==6
- return "BACKSPACE" if num==8
- return "TAB" if num==9
- return "RETURN" if num==13
- return "SHIFT" if num==16
- return "CTLR" if num==17
- return "ALT" if num==18
- return "CAPS LOCK" if num==20
- return "ESCAPE" if num==27
- return "SPACE" if num==32
- return "PGUP" if num==33
- return "PGDN" if num==34
- return "END" if num==35
- return "HOME" if num==36
- return "LEFT" if num==37
- return "UP" if num==38
- return "RIGHT" if num==39
- return "DOWN" if num==40
- return "SNAPSHOT" if num==44
- return "INSERT" if num==45
- return "DELETE" if num==46
- return "0" if num==48
- return "1" if num==49
- return "2" if num==50
- return "3" if num==51
- return "4" if num==52
- return "5" if num==53
- return "6" if num==54
- return "7" if num==55
- return "8" if num==56
- return "9" if num==57
- return "A" if num==65
- return "B" if num==66
- return "C" if num==67
- return "D" if num==68
- return "E" if num==69
- return "F" if num==70
- return "G" if num==71
- return "H" if num==72
- return "I" if num==73
- return "J" if num==74
- return "K" if num==75
- return "L" if num==76
- return "M" if num==77
- return "N" if num==78
- return "O" if num==79
- return "P" if num==80
- return "Q" if num==81
- return "R" if num==82
- return "S" if num==83
- return "T" if num==84
- return "U" if num==85
- return "V" if num==86
- return "W" if num==87
- return "X" if num==88
- return "Y" if num==89
- return "Z" if num==90
- return "LWIN" if num==91
- return "RWIN" if num==92
- return "APPS" if num==93
- return "0" if num==96
- return "1" if num==97
- return "2" if num==98
- return "3" if num==99
- return "4" if num==100
- return "5" if num==101
- return "6" if num==102
- return "7" if num==103
- return "8" if num==104
- return "9" if num==105
- return "*" if num==106
- return "+" if num==107
- return "-" if num==109
- return "." if num==110
- return "/" if num==111
- return "F1" if num==112
- return "F2" if num==113
- return "F3" if num==114
- return "F4" if num==115
- return "F5" if num==116
- return "F6" if num==117
- return "F7" if num==118
- return "F8" if num==119
- return "F9" if num==120
- return "F10" if num==121
- return "F11" if num==122
- return "F12" if num==123
- return "NUM LOCK" if num==144
- return "SCROLL LOCK" if num==145
- return "LEFT SHIFT" if num==160
- return "RIGHT SHIFT" if num==161
- return "LEFT CTRL" if num==162
- return "RIGHT CTRL" if num==163
- return "LEFT ALT" if num==164
- return "RIGHT ALT" if num==165
- return ";" if num==186
- return "=" if num==187
- return "," if num==188
- return "_" if num==189
- return "." if num==190
- return "/" if num==191
- return "`" if num==192
- return "[" if num==219
- return " \\ " if num==220
- return "]" if num==221
- return "'" if num==222
- return "??? - " + "#{num}"
- end
- end
- #==============================================================================
- # Módulo AntiLag
- #==============================================================================
- module AntiLag
- SPC = Win32API.new("kernel32", "SetPriorityClass", "pi", "i")
- @@high_priority = false
- def self.high_priority ; @@high_priority; end
- def self.high_priority?; @@high_priority; end
- def self.high_priority=(valor)
- return if @@high_priority == valor
- @@high_priority = valor
- if @@high_priority
- SPC.call(-1, 0x80)
- return
- end
- SPC.call(-1, 0x20)
- end
- end
- AntiLag.high_priority = true
复制代码 这是一个人的游戏中添加其中的一个脚本。
#============================================================================
# ** 任务系统
# 基本:
# $scene = Scene_Task.new(返回的场景, 游标初始index) 召唤查看任务场景
# 说明:
# $game_party.accept_task(id) 接受id号任务
# $game_party.delete_task(Game_Task.new(id)) 删除(放弃)id号任务
# $game_party.completed_task(id) 完成id号任务
# $game_party.task_status(id) 获取任务状态,未接受返回nil;未完成返回false;
# 已完成返回true
# $game_party.accepted_task?(id) 判断角色是否接受了id号任务
# $game_party.completed_task?(id) 判断角色是否完成了id号任务
# 快捷手段:
# visible_ts(id, kind)
# 在地图画面上显示id号任务的状态.kind:0为接受任务时显示的信息;
# 1为完成任务时显示的信息;2为任务失败时显示的信息;
# 3为放弃任务时显示的信息;4为无法放弃任务时显示的信息;
# 5为已接此任务的提示.
# accept_task(id, enforcement)
# 接受id号任务并在地图上显示接受任务时显示的信息,enforcement为是否
# 强制接受,true为是,可不填,默认为false
# complete_task(id) 删除id号任务并在地图上显示完成任务时显示的信息
# fail_task(id) 删除id号任务并在地图上显示任务失败时显示的信息
# abandonment_task(id) 删除id号任务并在地图上显示放弃任务时显示的信息
#============================================================================
module DOS
#============================================================================
#-------------------------------任务设置-------------------------------------
#============================================================================
Task_Abandonment_Task_Input = Input::Letters["E"] # 放弃任务按钮........[按键]
Task_Left_Change_Page = Input::LEFT # 左翻页按键........................[按键]
Task_Right_Change_Page = Input::RIGHT # 右翻页按键......................[按键]
Task_Filament_Color = Color.new(0, 0, 0) # 描绘报酬表格时,线条的颜色....[颜色]
# ▼ 绘制确定放弃任务时疑问的文字色.....................................[颜色]
Task_Query_Word_Color = Color.new(255, 255, 0)
Task_Gold_Icon_Index = 205 # 金钱的图标id...............................[数字]
# 没有接受该任务,又调用该任务的complete_task/fail_task/abandonment_task方法时,
# 该怎样处理.0为显示一个窗口, 1为无处理.................................[数字]
Task_No_Accept = 0
#--任务资料设置(此处省略分类)
Task = []
#--痴情的女鬼---------------------------------------------------
Task[0] = { # 任务id
"Icon" => 50, # 图标id
"Name" => "痴情的女鬼",# 任务名称
"Caption" => " 村子里有一间大屋子,里头住着一个叫高姗姗的女鬼,他一直在等他的哥哥高
文彦.这种痴情的确令人佩服,但她每天晚上都会发出鬼哭的声音,引得附近黑毛
狼咆哮,斯库拉唱歌,厄洛斯射箭,狄安娜砸盾等,严重地影响了附近村民的休息
.你能够帮村民解决这个痴情的女鬼吗?",
"Reward" => {"Item" => [], # 完成任务后奖励的物品
"Weapon" => [], # 完成任务后奖励的武器
"Armor" => [], # 完成任务后奖励的防具
"Gold" => 0, # 完成任务后奖励的金钱
"Level_Plus" => [], # 完成任务后奖励的等级
"Exp_Plus" => [] # 完成任务后奖励的经验
},
"Can Abandonment?" => false, # 可否放弃此任务
"Level" => 3 # 任务等级
}
#--遗失的手风琴-----------------------------------------------
Task[1] = { # 任务id
"Icon" => 100, # 图标id
"Name" => "遗失的手风琴",# 任务名称
"Caption" => " 村庄里有一个伟大的音乐家,应邀去参加一个音乐会,但是他的手风琴不见,
你能帮他找找吗?",
"Reward" => {"Item" => [], # 完成任务后奖励的物品
"Weapon" => [], # 完成任务后奖励的武器
"Armor" => [], # 完成任务后奖励的防具
"Gold" => 0, # 完成任务后奖励的金钱
"Level_Plus" => [], # 完成任务后奖励的等级
"Exp_Plus" => [] # 完成任务后奖励的经验
},
"Can Abandonment?" => true, # 可否放弃此任务
"Level" => 3 # 任务等级
}
end
module Vocab
#============================================================================
#---------------------------任务用语设置-------------------------------------
#============================================================================
Task_Accept = "接受了任务[%s]"
Task_Complete = "任务[%s]被完成!"
Task_Fail = "任务[%s]已失败"
Task_Abandonment = "放弃任务[%s]"
Task_Can_Not_Abandonment = "无法放弃任务[%s]"
Task_Adandonment_Query = "你确定要放弃[%s]这个任务吗?"
Task_Accepted = "已接受任务[%s]"
Task_No_Accept = "你还没接受任务[%s]!"
Task_Difficulty = "任务难度:"
Task_Level_Word = ["简单", "容易", "中等", "困难"]
Task_Can_Abandonment_Word = ["可放弃", "不可放弃"]
Task_Change_Page = ["按下右键翻到下一页 >", "< 按下左键翻到上一页"]
end
#============================================================================
# ** Game_Task
#============================================================================
class Game_Task
#----------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------
def initialize(id)
@id = id
@task = DOS::Task[id]
end
#----------------------------------------------------------------------
# * 获取任务id
#----------------------------------------------------------------------
def id
return @id
end
#----------------------------------------------------------------------
# * 获取任务图标索引
#----------------------------------------------------------------------
def icon_index
return @task["Icon"]
end
#----------------------------------------------------------------------
# * 获取任务名
#----------------------------------------------------------------------
def name
return @task["Name"]
end
#----------------------------------------------------------------------
# * 获取任务说明
#----------------------------------------------------------------------
def caption
return @task["Caption"]
end
#----------------------------------------------------------------------
# * 获取任务奖赏资料(不包括物品/武器/防具数量)
# kind:0为道具;1为武器;2为防具;3为金钱;4为lv;5为exp.
#----------------------------------------------------------------------
def reward(kind, index=0)
case kind
when 0
return $data_items[@task["Reward"]["Item"][index][0]]
when 1
return $data_weapons[@task["Reward"]["Weapon"][index][0]]
when 2
return $data_armors[@task["Reward"]["Armor"][index][0]]
when 3
return @task["Reward"]["Gold"]
when 4
if @task["Reward"]["Level_Plus"][index] != nil
return @task["Reward"]["Level_Plus"][index][1]
else return nil
end
when 5
if @task["Reward"]["Exp_Plus"][index] != nil
return @task["Reward"]["Exp_Plus"][index][1]
else return nil
end
end
end
#----------------------------------------------------------------------
# * 获取任务奖赏多少种道具
# kind:0为道具;1为武器;2为防具.
#----------------------------------------------------------------------
def reward_size(kind)
case kind
when 0
return @task["Reward"]["Item"].size
when 1
return @task["Reward"]["Weapon"].size
when 2
return @task["Reward"]["Armor"].size
end
end
#----------------------------------------------------------------------
# * 获取任务奖赏等级/经验的受益人(le = level & exp)
# kind:0为level;1为exp.
#----------------------------------------------------------------------
def reward_le_actor(kind, index)
case kind
when 0
if $game_party.members[@task["Reward"]["Level_Plus"][index][0]] != nil
return $game_party.members[@task["Reward"]["Level_Plus"][index][0]]
else return nil
end
when 1
if $game_party.members[@task["Reward"]["Exp_Plus"][index][0]] != nil
return $game_party.members[@task["Reward"]["Exp_Plus"][index][0]]
else return nil
end
end
end
#----------------------------------------------------------------------
# * 获取任务奖赏等级/经验的受益人总数(le = level & exp)
# kind:0为level;1为exp.
#----------------------------------------------------------------------
def reward_le_actor_size(kind)
case kind
when 0
return @task["Reward"]["Level_Plus"].size
when 1
return @task["Reward"]["Exp_Plus"].size
end
end
#----------------------------------------------------------------------
# * 获取任务奖赏道具数量
# kind:0为道具;1为武器;2为防具.
#----------------------------------------------------------------------
def reward_item_amount(kind,index)
case kind
when 0
return @task["Reward"]["Item"][index][1]
when 1
return @task["Reward"]["Weapon"][index][1]
when 2
return @task["Reward"]["Armor"][index][1]
end
end
#----------------------------------------------------------------------
# * 获取任务等级
#----------------------------------------------------------------------
def level
return @task["Level"]
end
#----------------------------------------------------------------------
# * 获取描述任务等级用语
#----------------------------------------------------------------------
def level_word
return Vocab::Task_Level_Word[@task["Level"]]
end
#----------------------------------------------------------------------
# * 获取可否放弃标识
#----------------------------------------------------------------------
def can_abandonment?
return @task["Can Abandonment?"]
end
#----------------------------------------------------------------------
# * 获取可否放弃文字
#----------------------------------------------------------------------
def can_abandonment_word
if @task["Can Abandonment?"] == true
return Vocab::Task_Can_Abandonment_Word[0]
else return Vocab::Task_Can_Abandonment_Word[1]
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# 這個類用來操控主角隊伍,包含了隊伍所攜資金和物品等資訊。
# 這個類的實例被全域變數 $game_party 所引用。
#==============================================================================
class Game_Party < Game_Unit
attr_reader :accepted_task
def initialize
super
@gold = 100
@steps = 0
@last_item_id = 0
@last_actor_index = 0
@last_target_index = 0
@actors = [] # 隊員類型 (主角編號)
@items = {} # 所攜物品 HASH 表 (物品編號)
@weapons = {} # 所攜武器 HASH 表 (武器編號)
@armors = {} # 所攜護具 HASH 表 (護具編號)
@accepted_task = []
@task_status = []
end
def accept_task(id)
@accepted_task.push(Game_Task.new(id))
@task_status[id] = false
end
def delete_task(task)
@accepted_task.delete(task)
@task_status[id] = nil
end
def completed_task(id)
delete_task(Game_Task.new(id))
for item in 0...@accepted_task[id].reward_size(0)
gain_item(@accepted_task[id].reward(0, item),@accepted_task[id].reward_item_amount(0,item))
end
for item in 0...@accepted_task[id].reward_size(1)
gain_item(@accepted_task[id].reward(1, item),@accepted_task[id].reward_item_amount(1,item))
end
for item in 0...@accepted_task[id].reward_size(2)
gain_item(@accepted_task[id].reward(2, item),@accepted_task[id].reward_item_amount(2,item))
end
for index in 0...@accepted_task[id].reward_le_actor_size(0)
if @accepted_task[id].reward_le_actor(0, index) == nil
next
end
@accepted_task[id].reward_le_actor(0, index).change_level(@accepted_task[id].reward(5, index), true)
end
for index in 0...@accepted_task[id].reward_le_actor_size(1)
if @accepted_task[id].reward_le_actor(1, index) == nil
next
end
@accepted_task[id].reward_le_actor(1, index).change_exp(@accepted_task[id].reward(4, index), true)
end
gain_gold(@accepted_task[id].reward(3))
@task_status[id] = true
end
def task_status(id)
return @task_status[id]
end
def accepted_task?(id)
if @task_status[id] == true or @task_status[id] == false
return true
else return false
end
end
def completed_task?(id)
if @task_stutas[id] == true
return true
else return false
end
end
end
#============================================================================
# ** Window_TaskHelp
#============================================================================
class Window_TaskHelp < Window_Base
attr_accessor :paga
def initialize(id, paga=0)
super(160, 20, 384, 376)
@paga = paga
refresh(id)
end
def refresh(id)
dw = self.width - 32
dh = self.height - 32
task = Game_Task.new(id)
self.contents.clear
if @paga == 0 # 描绘第一页
draw_icon(task.icon_index, 0, 0)
self.contents.draw_text(28, 0, dw, 24, task.name)
self.contents.draw_text(0, 24, dw, 24, Vocab::Task_Difficulty)
w = self.contents.text_size(Vocab::Task_Difficulty).width
self.contents.draw_text(w, 24, dw, 24, task.level_word)
self.contents.draw_text(28, 0, dw-28, 24, task.can_abandonment_word, 2)
chenge_special_character(task.caption.clone, 0, 48)
elsif @paga == 1 # 描绘第二页
#-描绘表格-------------------------------------------------------------
# 边框
draw_straight_filament(0, 0, dw, 0, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, 0, 0, dh, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, 27, dw, 27, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, dh-1, dw/2, dh-1, 1, DOS::Task_Filament_Color)
draw_straight_filament(dw/2+2, dh-5, dw-1, dh-5, 1, DOS::Task_Filament_Color)
draw_straight_filament(dw-1, 0, dw-1, dh-4, 1, DOS::Task_Filament_Color)
# 中线
draw_straight_filament(dw/2-1, 27, dw/2-1, dh, 1, DOS::Task_Filament_Color)
draw_straight_filament(dw/2+1, 27, dw/2+1, dh-4, 1, DOS::Task_Filament_Color)
# 队伍成员分割线
h = (dh-27-1)/4
draw_straight_filament(0, h*1+27, dw/2-1, h*1+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, h*2+27, dw/2-1, h*2+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, h*3+27, dw/2-1, h*3+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(0, h*4+27, dw/2-1, h*4+27, 1, DOS::Task_Filament_Color)
# 头像分割线
draw_straight_filament(79, 27, 79, dh, 1, DOS::Task_Filament_Color)
# 描绘成员奖励分割线
draw_straight_filament(79, (h-h/2)*1+27, dw/2-1, (h-h/2)*1+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(79, (h-h/2)+h+27, dw/2-1, (h-h/2)+h+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(79, (h-h/2)+h*2+27, dw/2-1, (h-h/2)+h*2+27, 1, DOS::Task_Filament_Color)
draw_straight_filament(79, (h-h/2)+h*3+27, dw/2-1, (h-h/2)+h*3+27, 1, DOS::Task_Filament_Color)
# 描绘奖励分割线
a = (dw-28)/24
for i in 0...a
draw_straight_filament(dw/2+2, 24*i+27, dw-1, 24*i+27, 1, DOS::Task_Filament_Color)
end
#-结束描绘-------------------------------------------------------------
#-描绘内容-------------------------------------------------------------
# 描绘标题
self.contents.draw_text(1, 1, dw-1, 24, "奖赏表", 1)
# 描绘头像等
for i in 0...$game_party.members.size
draw_actor_face($game_party.members, 1, h*i+28, h-1)
self.contents.font.size = 20
self.contents.draw_text(1, 1+h*i+27, 96, 24, $game_party.members.name)
self.contents.font.size = 18
self.contents.draw_text(81,1+h*i+27, dw/2-81, 24,"奖励#{Vocab.level}:")
self.contents.draw_text(81,1+h*i+27+h/2, dw/2-81, 24,"奖励经验:")
if task.reward(4, i) != nil
self.contents.draw_text(81,1+h*i+27+h/4, dw/2-82, 24, task.reward(4, i), 2)
else self.contents.draw_text(81,1+h*i+27+h/4, dw/2-82, 24, "无", 2)
end
if task.reward(5, i) != nil
self.contents.draw_text(81,1+h*i+27+h/4+h/2, dw/2-82, 24, task.reward(5, i), 2)
else self.contents.draw_text(81,1+h*i+27+h/4+h/2, dw/2-82, 24, "无", 2)
end
end
self.contents.font.size = 20
x = dw/2+1
# 描绘金钱奖励
draw_icon(DOS::Task_Gold_Icon_Index, x, 26)
self.contents.draw_text(x+25, 26, dw/2-1, 24,"金币:#{task.reward(3, 0)}#{Vocab.gold}")
y = 26+24
# 描绘道具奖励
for i in 0...task.reward_size(0)
draw_icon(task.reward(0, i).icon_index, x, y+i*24)
self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(0, i).name}*#{task.reward_item_amount(0, i)}")
end
y = 26 + 24 + task.reward_size(0)*24
# 描绘武器奖励
for i in 0...task.reward_size(1)
draw_icon(task.reward(1, i).icon_index, x, y+i*24)
self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(1, i).name}*#{task.reward_item_amount(1, i)}")
end
y = 26 + 24 + task.reward_size(0)*24 + task.reward_size(1)*24
# 描绘防具奖励
for i in 0...task.reward_size(2)
draw_icon(task.reward(2, i).icon_index, x, y+i*24)
self.contents.draw_text(x+25, y+i*24, dw/2-1, 24,"#{task.reward(2, i).name}*#{task.reward_item_amount(2, i)}")
end
#-结束描绘-------------------------------------------------------------
end
end
end
#=============================================================================
# ** Scene_Task
#=============================================================================
class Scene_Task < Scene_Base
#---------------------------------------------------------------------------
# * 初始化变量
#---------------------------------------------------------------------------
def initialize(return_scene, index=0)
@index = index
@return_scene = return_scene
end
#---------------------------------------------------------------------------
# * 开始处理
#---------------------------------------------------------------------------
def start
create_menu_background
@th = Window_TaskHelp.new($game_party.accepted_task[0].id)
@paga = @th.paga
tn = []
for i in 0...$game_party.accepted_task.size
tn = $game_party.accepted_task.name
end
@hc = Window_Command.new(160, tn)
@hc.y = 20
@hc.height = 376
@hc.index = @index
@query = Window_Base.new(40, 152, 464, 56)
a = sprintf(Vocab::Task_Adandonment_Query, $game_party.accepted_task[0].name)
@query.contents.font.color = DOS::Task_Query_Word_Color
@query.contents.draw_text(0, 0, 432, 24, a, 1)
@query.contents.font.color = Color.new(0, 0, 0)
@qc = Window_Command.new(160, [" 是", " 否"])
@qc.x = 192
@qc.y = 208
@query.visible = false
@qc.visible = false
@qc.active = false
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new(384, 24)
@sprite.bitmap.draw_text(0, 0, 384, 24, Vocab::Task_Change_Page[@paga], 1)
@sprite.x = 0
@sprite.y = 416-24
end
#--------------------------------------------------------------------------
# * 结束处理
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@hc.dispose
@th.dispose
@query.dispose
@qc.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * 更新帧
#--------------------------------------------------------------------------
def update
@sprite.update
@sprite.x + 10 if @sprite.x != 160
@hc.update
@th.update
update_input
if @hc.index != @index
@th.refresh($game_party.accepted_task[@hc.index].id)
@index = @hc.index
end
@query.update
if @query.active == true
@qc.update
end
if @paga != @th.paga
@sprite.bitmap.clear
@sprite.bitmap.draw_text(0, 0, 384, 24, Vocab::Task_Change_Page[@th.paga], 1)
@sprite.x = 0
@paga = @th.paga
end
end
#--------------------------------------------------------------------------
# * 刷新按键
#--------------------------------------------------------------------------
def update_input
if Input.trigger?(Input::B)
if @hc.active == true
Sound.play_cancel
$scene = @return_scene
elsif @query.visible == true
Sound.play_cancel
@hc.active = true
@query.visible = false
@qc.visible = false
@qc.active = false
end
elsif Input.trigger?(DOS::Task_Abandonment_Task_Input)
if @hc.active == true
if $game_party.accepted_task[@hc.index].can_abandonment? == true
Sound.play_decision
a = sprintf(Vocab::Task_Adandonment_Query, $game_party.accepted_task[@hc.index].name)
@query.contents.clear
@query.contents.font.color = DOS::Task_Query_Word_Color
@query.contents.draw_text(0, 0, 432, 24, a, 1)
@query.contents.font.color = Color.new(0, 0, 0)
@query.visible = true
@qc.visible = true
@qc.active = true
@hc.active = false
else Sound.play_buzzer
@query.contents.clear
a = sprintf(Vocab::Task_Can_Not_Abandonment, $game_party.accepted_task[@hc.index].name)
@query.contents.font.color = DOS::Task_Query_Word_Color
@query.contents.draw_text(0, 0, 432, 24, a, 1)
@query.contents.font.color = Color.new(0, 0, 0)
@query.visible = true
@hc.active = false
end
end
elsif Input.trigger?(Input::C)
if @qc.visible == true
if @qc.index == 0
Sound.play_decision
@query.contents.clear
a = sprintf(Vocab::Task_Abandonment, $game_party.accepted_task[@hc.index].name)
@query.contents.font.color = DOS::Task_Query_Word_Color
@query.contents.draw_text(0, 0, 432, 24, a, 1)
@query.contents.font.color = Color.new(0, 0, 0)
@qc.visible = false
@query.visible = true
$game_party.delete_task($game_party.accepted_task[@hc.index])
Graphics.wait(40)
$scene = Scene_Task.new(@return_scene)
else @hc.active = true
Sound.play_cancel
@query.visible = false
@qc.visible = false
@qc.active = false
end
end
elsif Input.trigger?(DOS::Task_Left_Change_Page)
if @th.paga == 1
@th.paga = 0
@th.refresh($game_party.accepted_task[@hc.index].id)
end
elsif Input.trigger?(DOS::Task_Right_Change_Page)
if @th.paga == 0
@th.paga = 1
@th.refresh($game_party.accepted_task[@hc.index].id)
end
end
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# 這個類用來操控地圖,包含了地圖滾動設置和通行度判定等資訊。
# 這個類的實例被全域變數 $game_map 所引用。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * 宣告執行個體變數
#--------------------------------------------------------------------------
attr_accessor :task_id
attr_reader :ts_visible
attr_reader :task_word
alias old_ini initialize
def initialize
old_ini
@task_word = ""
@ts_visible = false
@task_id = 0
end
def visible_task_status
if @ts_visible == false
@ts_visible = true
else @ts_visible = false
end
end
def set_task_word(kind)
case kind
when 0 # 接受了任务
@task_word = Vocab::Task_Accept
when 1 # 完成了任务
@task_word = Vocab::Task_Complete
when 2 # 任务失败了
@task_word = Vocab::Task_Fail
when 3 # 放弃了任务
@task_word = Vocab::Task_Abandonment
when 4 # 无法放弃任务
@task_word = Vocab::Task_Can_Not_Abandonment
when 5 # 已接受了任务
@task_word = Vocab::Task_Accepted
when 6 # 未接受任务
@task_word = Vocab::Task_No_Accept
when nil
@task_word = nil
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# 這個類用來執行顯示地圖場景畫面的程式。
#==============================================================================
class Scene_Map < Scene_Base
alias old_sta start
alias old_upd update
alias old_ter terminate
def start
old_sta
@ts = Window_Base.new(40, 152, 464, 56)
@ts.visible = false
end
def terminate
old_ter
@ts.dispose
end
def update
old_upd
if $game_map.ts_visible == true
@ts.contents.clear
tw = sprintf($game_map.task_word, Game_Task.new($game_map.task_id).name)
@ts.contents.draw_text(28, 0, 408, 24, tw)
@ts.draw_icon(Game_Task.new($game_map.task_id).icon_index, 0, 0)
@ts.visible = true
Graphics.wait(40)
$game_map.visible_task_status
@ts.visible = false
end
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# 這個類是用來執行事件指令的直譯器。
# 這個類作為 Game_Map、Game_Troop 和 Game_Event 的內部類使用。
#==============================================================================
class Game_Interpreter
def accept_task(id, enforcement=false)
if $game_party.accepted_task?(id) == false or enforcement == true
$game_party.accept_task(id)
visible_ts(id, 0)
else
visible_ts(id, 5)
end
end
def complete_task(id)
if $game_party.accepted_task?(id) == false
$game_party.completed_task(id)
visible_ts(id, 1)
elsif $game_party.accepted_task?(id) == nil
visible_ts(id, 6) if DOS::Task_No_Accept == 0
end
end
def fail_task(id)
if $game_party.accepted_task?(id) == false
$game_party.delete_task(Game_Task.new(id))
visible_ts(id, 2)
elsif $game_party.accepted_task?(id) == nil
visible_ts(id, 6) if DOS::Task_No_Accept == 0
end
end
def abandonment_task(id)
if $game_party.accepted_task?(id) == false
$game_party.delete_task(Game_Task.new(id))
visible_ts(id, 3)
elsif $game_party.accepted_task?(id) == nil
visible_ts(id, 6) if DOS::Task_No_Accept == 0
end
end
def visible_ts(id, kind)
$game_map.task_id = id
$game_map.set_task_word(kind)
$game_map.visible_task_status
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * 描绘直线 by 945127391
# begin_x : 直线开始的x坐标
# begin_y : 直线开始的y坐标
# end_x : 直线结束的x坐标
# end_y : 直线结束的y坐标
# color : 直线的颜色
# width : 直线的宽度(厚度)
#--------------------------------------------------------------------------
def draw_straight_filament(begin_x, begin_y, end_x, end_y, width, color)
if begin_x == end_x
bitmap = Bitmap.new(width, end_y-begin_y)
elsif begin_y == end_y
bitmap = Bitmap.new(end_x-begin_x, width)
else return
end
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, color)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(begin_x, begin_y, bitmap, rect)
bitmap.dispose
end
#--------------------------------------------------------------------------
# * 描绘自动换行文字 by 叶子
# 修改 945127391
#--------------------------------------------------------------------------
def chenge_special_character(text, x=0, y=0)
# 记录换行时y坐标最小加值
min_y = 0
while ((c = text.slice!(/./m)) != nil)
# 另起一行文字的情况下
if c == "\n"
y += [WLH, min_y].max
min_y = 0
x = 0
# 下面的文字
next
end
# 自动换行处理
if x + self.contents.text_size(c).width > self.contents.width
y += [WLH, min_y].max
min_y = 0
x = 0
end
# 描绘文字
self.contents.draw_text(4 + x, y, 40, WLH, c)
# x 为要描绘文字的加法运算
x += self.contents.text_size(c).width
end
end
end
这是另一个,第二个是任务脚本吧...第一个就不知道有没有什么关联,我想问下各路神仙知不知道这2个脚本怎样用,最好有截图教我下,谢谢。 |
评分
-
查看全部评分
|