任务系统脚本文档格式.docx
《任务系统脚本文档格式.docx》由会员分享,可在线阅读,更多相关《任务系统脚本文档格式.docx(10页珍藏版)》请在冰豆网上搜索。
![任务系统脚本文档格式.docx](https://file1.bdocx.com/fileroot1/2023-1/24/21933099-45ca-4464-a76b-64a26a2143a2/21933099-45ca-4464-a76b-64a26a2143a21.gif)
29.#===========================================================
30.classTask
31.
attr_reader:
desc
32.
finished
33.
definitialize(origin_name,desc)
34.
@origin_name=origin_name
35.
@desc=desc
36.
@finished=false
37.
end
38.
defname
39.
if@finished
40.
return@origin_name+"
(完成)"
41.
else
42.
return@origin_name
43.
end
44.
45.
defdesc=(desc)
46.
47.
48.
49.
deffinish
50.
@finished=true
51.
52.
53.end
54.
55.classGame_Party<
Game_Unit
56.
aliasold_initinitialize
57.
definitialize
58.
old_init
59.
@tasks={}
60.
end
61.
defadd_task(i,desc)
62.
@tasks[i].desc=@tasks[i].desc+"
\n"
+desc
63.
64.
defget_task(i,name,desc)
65.
@tasks[i]=Task.new(name,desc)
66.
67.
defhave_task?
(i)
68.
@tasks[i]!
=nil
69.
70.
deffinish_task(i)
71.
@tasks[i].finishifhave_task?
72.
73.
defunfinished_tasks
74.
n=[]
75.
foriin@tasks.values
76.
nextifi.finished
77.
n.push(i)
78.
79.
returnn
80.
81.
deffinished_tasks
82.
83.
84.
nextunlessi.finished
85.
86.
87.
88.
89.end
90.
91.classWindow_Task_Type<
Window_HorzCommand
92.
#--------------------------------------------------------------------------
93.
#●オブジェクト初期化
94.
95.
96.
super(0,0)
97.
activate
98.
99.
defwindow_width
100.
returnGraphics.width
101.
102.
defcol_max
103.
return3
104.
105.
106.
#●コマンドリストの作成
107.
108.
defmake_command_list
109.
add_command("
未完成任务"
:
unfinished_task)
110.
已完成任务"
:
finished_task)
111.
取消"
cancel)
112.
113.end
114.
115.classWindow_TaskLeft<
Window_Selectable
116.
117.
118.
super(0,48,160,Graphics.height-48)
119.
create_contents
120.
121.
@index=0
122.
refresh
123.
deactivate
124.
125.
defset_finish(finish)
126.
@finished=finish
127.
set_item_max
128.
129.
defitem_max
130.
return@item_max!
=nil?
@item_max:
0
131.
132.
defset_item_max
133.
134.
@item_max=$game_party.finished_tasks.size
135.
136.
@item_max=$game_party.unfinished_tasks.size
137.
138.
139.
140.
defrefresh
141.
142.
super
143.
144.
145.
#●項目の描画
146.
147.
defdraw_item(index)
148.
text="
"
149.
unless@finished
150.
if$game_party.unfinished_tasks[index]!
151.
text=$game_party.unfinished_tasks[index].name
152.
153.
154.
if$game_party.finished_tasks[index]!
155.
text=$game_party.finished_tasks[index].name
156.
157.
158.
draw_text(item_rect_for_text(index),text)
159.
160.
161.end
162.
163.classWindow_TaskRight<
Window_Base
164.
left_index
165.
166.
super(160,48,Graphics.width-160,Graphics.height-48)
167.
168.
@left_index=0
169.
170.
171.
172.
defset_index(i)
173.
@left_index=i
174.
175.
176.
defset_finish(i)
177.
@finished=i
178.
179.
180.
181.
contents.clear
182.
draw_desc
183.
184.
defdraw_desc
185.
186.
if$game_party.finished_tasks[@left_index]!
187.
draw_text_ex(0,0,$game_party.finished_tasks[@left_index].desc)
188.
189.
190.
if$game_party.unfinished_tasks[@left_index]!
191.
draw_text_ex(0,0,$game_party.unfinished_tasks[@left_index].desc)
192.
193.
194.
195.
196.end
197.
198.classScene_Task<
Scene_Base
199.
defstart
200.
201.
create_task_type_window
202.
create_left_window
203.
create_right_window
204.
205.
defupdate
206.
207.
if@left_window.active
208.
ifInput.trigger?
(:
B)
209.
@left_window.deactivate
210.
@task_type_window.activate
211.
212.
UP)||Input.trigger?
DOWN)
213.
@right_window.set_finish(@left_window.finished)
214.
@right_window.set_index(@left_window.index)
215.
216.
217.
218.
219.
defterminate
220.
221.
222.
defcreate_task_type_window
223.
@task_type_window=Window_Task_Type.new
224.
@task_type_window.set_handler(:
unfinished_task,method(:
view_unfinished_task))
225.
finished_task,method(:
view_finished_task))
226.
cancel,method(:
return_scene))
227.
228.
defcreate_left_window
229.
@left_window=Window_TaskLeft.new
230.
@left_window.set_finish(false)
231.
@left_window.refresh
232.
233.
defcreate_right_window
234.
@right_window=Window_TaskRight.new
235.
@right_window.refresh
236.
237.
defview_unfinished_task
238.
239.
240.
@left_window.activate
241.
@task_type_window.deactivate
242.
@right_window.set_finish(false)
243.
@right_window.set_index(@left_window.index)
244.
245.
defview_finished_task
246.
@left_window.set_finish(true)
247.
248.
249.
250.
@right_window.set_finish(true)
251.
252.
253.
254.end接下说一下主菜单添加查看任务命令的方法:
255.
256.1、先打开脚本窗口(废话==)
257.2、找到Windows_MenuCommand
258.在
defadd_main_commands下方end之前插入add_command("
任务"
task,
main_commands_enabled)
3、找到Scene_Menu
在defcreate_command_window下方end之前插入
1.
@command_window.set_handler(:
method(:
command_task))
4、在
2.
#●指令“结束游戏”
3.
4.
defcommand_game_end
5.
SceneManager.call(Scene_End)
6.
的前面加入
#●指令“任务”
defcommand_task
SceneManager.call(Scene_Task)
7.
OK~~~
追加:
具体判定某个任务是否完成只需要:
$game_party.tasks(编号).finished(完成的情况下返回真,未完成返回假,说白了,就是完成的情况下条件成立)如:
$game_party.tasks
(1).finished#=>
完成时为true,没有完成为false
在条件分歧的情况下,只需要在脚本里面填上这样一行就了。