Project1

标题: [Scene篇]简陋任务列表 [打印本页]

作者: fux2    时间: 2010-12-28 13:24
标题: [Scene篇]简陋任务列表
本帖最后由 fux2 于 2010-12-29 10:24 编辑

喵,咱只是尝试写一个Scene,很渣,各位就不要吐槽了,非常简陋,范例就不发了。
感谢EngShun纠正错误喵~
[line]2[/line]



于是还是比较朴实啦~
以下献给新手
1.插入下面的脚本在main以上
2.进入游戏按Z键呼出任务列表
3.变量100控制任务进度
4.脚本42行修改任务描述

喵就这样了
  1. class Scene_Fux2
  2.   
  3.    def main
  4.     @help_window = Window_Help.new
  5.     @item_window = Window_Fux2.new
  6.     @item_window.help_window = @help_window
  7.     Graphics.transition
  8.     loop do
  9.       Graphics.update
  10.       Input.update
  11.       update
  12.       if $scene != self
  13.         break
  14.       end
  15.     end
  16.     Graphics.freeze
  17.     @help_window.dispose
  18.     @item_window.dispose
  19.   end

  20.   def update
  21.     @help_window.update
  22.     @item_window.update
  23.     if @item_window.active
  24.       update_item
  25.       return
  26.     end
  27.   end

  28.   def update_item
  29.     if Input.trigger?(Input::B)
  30.       $game_system.se_play($data_system.cancel_se)
  31.       $scene = Scene_Map.new
  32.       return
  33.     end
  34.   end
  35.   
  36. end
  37. ########################################################
  38. class Window_Fux2 < Window_Selectable
  39.   
  40.   FUX_BLOCK = [["任务1","杀死所有敌人"],["任务2","喵喵"]]

  41.   def initialize
  42.     super(0, 64, 640, 416)
  43.     @column_max = 1
  44.     refresh
  45.     self.index = 0
  46.   end

  47.   def item
  48.     return @data[self.index]
  49.   end

  50.   def refresh
  51.     if self.contents != nil
  52.       self.contents.dispose
  53.       self.contents = nil
  54.     end
  55.     @data = []
  56.    
  57.     for i in 0...$game_variables[100]
  58.         @data.push i
  59.     end

  60.     @item_max = @data.size
  61.     if @item_max > 0
  62.       self.contents = Bitmap.new(width - 32, row_max * 32)
  63.       for i in 0...@item_max
  64.         draw_item(i)
  65.       end
  66.     end
  67.   end

  68.   def draw_item(index)
  69.     item = @data[index]
  70.     @data[index] == @data.size ? self.contents.font.color = Color.new(255, 255, 0, 255) : self.contents.font.color = normal_color
  71.     x = 12
  72.     y = index * 32
  73.     rect = Rect.new(x, y, self.width - 32, 32)
  74.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  75.     opacity = self.contents.font.color == normal_color ? 255 : 128
  76.     self.contents.draw_text(x + 28, y, 212, 32, FUX_BLOCK[index][0], 0)
  77.   end

  78.   def update_help
  79.     @help_window.set_text(self.item == nil ? "" : FUX_BLOCK[self.index][1])
  80.   end
  81.   
  82. end
  83. ########################################
  84. class Scene_Map
  85.   alias:fuxupdate:update
  86.   
  87.   def update
  88.     unless moving? or $game_system.map_interpreter.running? or
  89.            @move_route_forcing or $game_temp.message_window_showing
  90.       if Input.trigger?(Input::A)
  91.         $scene = Scene_Fux2.new
  92.       end
  93.       fuxupdate
  94.     end
  95.   end
  96. end
复制代码

作者: 血のばら    时间: 2010-12-28 13:47
咱是沙发,果然,有点简陋,我要个美化版的
作者: EngShun    时间: 2010-12-29 09:29
本帖最后由 EngShun 于 2010-12-29 09:54 编辑

万一我要重中间插入某些剧情以外的任务
(比如某人叫你找某某东西,找到给你钱)
这种情况要怎么办?
建议增加多一个变量,
一个主要任务,
一个次要任务。

突然发现一个大大大错误,

  1. class Scene_Map
  2.   alias:fuxupdate:update
  3.   
  4.   def update
  5.     if Input.trigger?(Input::A)
  6.       $scene = Scene_Fux2.new
  7.     end
  8.     fuxupdate
  9.   end
  10.   
  11. end  
复制代码
这样会导致事件执行中也能叫出任务画面
应该替换成这个
  1. class Scene_Map
  2.   alias:fuxupdate:update
  3.   
  4.   def update
  5.     unless moving? or $game_system.map_interpreter.running? or
  6.            @move_route_forcing or $game_temp.message_window_showing
  7.       if Input.trigger?(Input::A)
  8.         $scene = Scene_Fux2.new
  9.       end
  10.       fuxupdate
  11.     end
  12.   end
  13. end
复制代码

作者: 退屈£无聊    时间: 2011-1-8 11:43
每个任务都应该有自己的一个独立的进度.
不过这个...很难改啊.
跟原版的任务提示有很大的不同><我到现在还不知道它是做什么用的..
虽然建议每个任务都设置一个独立的类似于task[1] = [名称,介绍,进度]
但是那样又变成原版的了><




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1