Project1

标题: 屬性武器顏色 [打印本页]

作者: WildDagger    时间: 2012-2-8 14:11
标题: 屬性武器顏色
本帖最后由 WildDagger 于 2012-2-25 23:07 编辑

基本上是讓擁有屬性的武器可以馬上被辨識出是哪個屬性,
某程度上是仿雲之遙的屬性武器列表而做的。

衝突可能:基本上是動到物品顏色的腳本穩衝,如果有動到特徵的腳本,說不定也有衝突的可能性。

設定多個屬性的時候,以設置在特徵欄最上面的屬性為準(例如依序設置了火、風、土三屬性的話,採用火屬性設定的顏色),如果該屬性沒有設定顏色,就用通用顏色為準。

  1. # 屬性武器顏色專用腳本
  2. # 可能衝突:
  3. #   基本上是動到物品顏色的腳本穩衝

  4. #===================================
  5. #  ●設定區域
  6. #===================================

  7. module WD
  8. module Weapon_Color
  9.   #顏色的代號為文章表示使用的顏色代碼
  10.   
  11.   WEAPON_COLOR = [
  12.     0,  #通用的顏色
  13.     0,  #屬性1使用顏色
  14.     10, #屬性2使用顏色
  15.     12, #屬性3使用顏色
  16.     31, #屬性4使用顏色,請依序追加
  17.   ]  # 請勿刪除此括號!
  18.   
  19.   # 是否開啟角色名稱使用屬性顏色表示,以裝備在裝備欄的第一個武器為準。
  20.   ELEMENT_NAME_COLOR = true
  21. end
  22. end

  23. #===================================
  24. #  ●設定結束
  25. #===================================

  26. class Window_Base < Window
  27.   include WD::Weapon_Color
  28.   
  29.   def item_color(item)
  30.     if item.is_a?(RPG::Skill)
  31.       normal_color
  32.     else
  33.       if item.is_a?(RPG::Weapon)
  34.         # 取得武器攻擊屬性
  35.         weapon_color(weapon_attackelement(item))
  36.       else
  37.         # 非武器則用原本的顏色。
  38.         normal_color
  39.       end
  40.     end
  41.   end
  42.   
  43.   def weapon_attackelement(item)
  44.     w_element = []
  45.     item.features.each_with_index do |feature, i|
  46.       if feature.code == 31
  47.         w_element.push(feature.data_id)
  48.       end
  49.     end
  50.     return w_element
  51.   end
  52.   
  53.   def weapon_color(set)
  54.     set_color = WEAPON_COLOR[set[0]]
  55.     if set_color == nil
  56.       set_color = WEAPON_COLOR[0]
  57.     end
  58.     text_color(set_color)
  59.   end
  60.   
  61.   # 描繪物品顏色(再定義)
  62.   def draw_item_name(item, x, y, enabled = true, width = 172)
  63.     return unless item
  64.     draw_icon(item.icon_index, x, y, enabled)
  65.     change_color(item_color(item), enabled)
  66.     draw_text(x + 24, y, width, line_height, item.name)
  67.     change_color(normal_color, enabled)
  68.   end
  69.   
  70.   #--------------------------------------------------------------------------
  71.   # ● 職業の描画
  72.   #--------------------------------------------------------------------------
  73.   def draw_actor_class(actor, x, y, width = 112)
  74.     if ELEMENT_NAME_COLOR #判斷是否需要以顏色顯示職業。
  75.       change_color(weapon_color(weapon_attackelement(actor.weapons[0])))
  76.     else
  77.       change_color(normal_color)
  78.     end
  79.     draw_text(x, y, width, line_height, actor.class.name)
  80.   end
  81. end
复制代码
執行圖(沒做過介面漢化,只是把文字改成標楷體)


作者: 370420939    时间: 2012-2-8 17:24
沙发~
话说有类似的脚本了唉……
不过结构和长短都不一样呃……
作者: lcz200966rpg    时间: 2012-2-8 18:39
这个好!搞高自由度有游戏时有用{:nm_4:}
作者: 仲秋启明    时间: 2012-2-8 19:22
http://rpg.blue/thread-217113-1-2.html

功能是一样的
作者: WildDagger    时间: 2012-2-24 02:17
新增功能:
角色的名字可以屬性顏色表示,如果是二刀流,則以裝備在裝備欄的第一個武器為準。
(但我覺得通常會用到這個的人可能不太會想搞二刀流?)


‘‘──WildDagger于2012-2-25 23:45补充以下内容

2012/2/26功能修改

修改功能:
因為VA有HP血量提示功能,故將屬性顏色顯示改為在職業欄顯示,
設定之類的與修改前相同
’’




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