赞 | 0 |
VIP | 11 |
好人卡 | 14 |
积分 | 2 |
经验 | 28214 |
最后登录 | 2021-9-10 |
在线时间 | 498 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 202
- 在线时间
- 498 小时
- 注册时间
- 2006-10-21
- 帖子
- 907
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
发现RGSS2有很强的扩展性,VX或许更适合会用脚本的人。
还有范例游戏的一些算法,完全突破以前的思维。
比如武器增加技能,以前见到的脚本基本是
if 武器带技能,卸下了武器
forget_skill(技能号)
if 武器带技能,装备了武器
learn_skill(技能号)
但是范例里却没有考虑 learn_skill和 forget_skill
因为学会技能无非是两点
1.技能栏里能显示
2.选择后能使用
这种思维我还需要多加练习啊………………
这里放个提取出来的脚本吧,只是给人看看原理,想用的人还是自己修改一下好了
为使自己有点工作量把它改为防具添加技能了{/cy}
- #==============================================================================
- # ★ LY0_Costants
- #------------------------------------------------------------------------------
- # 独自的定数的定义
- #==============================================================================
- #------------------------------------------------------------------------------
- # ◆ 基本設定
- #------------------------------------------------------------------------------
- # 装备技能(识別用文字列 + [技能 ID|技能 ID|...]) ※ 最大数 4
- LY0_ARMOR_SKILL_SIGNATURE = "*ARMORSKILL"
- #==============================================================================
- # ★ LY0_Module
- #------------------------------------------------------------------------------
- # 独自的机能添加
- #==============================================================================
-
- module LY0
- #--------------------------------------------------------------------------
- # ☆ 属性道具取得
- # id : 属性 ID
- #--------------------------------------------------------------------------
- def self.element_icon(id)
- return LY0_ELEMENT_ICON[id - 1]
- end
- #--------------------------------------------------------------------------
- # ☆ 防具技能的附加
- # item : 防具号
- #--------------------------------------------------------------------------
- def self.armor_skill(item)
- result = []
- if item.is_a?(RPG::Armor)
- sig = LY0_ARMOR_SKILL_SIGNATURE
- reg = /#{Regexp.quote sig}\[((\d+\|?)+)\]/
- if item.note.scan(reg).to_a[0]
- r = $~[0].gsub(/#{Regexp.quote sig}\[/, "").gsub(/\]/, "")
- for s in r.split(/\s*\|\s*/)
- skill = $data_skills[s.to_i]
- result.push(skill) if skill.is_a?(RPG::Skill)
- end
- end
- end
- return result
- end
-
- end
- class Game_Actor
- alias _ly0sys_skill_can_use? skill_can_use?
- #--------------------------------------------------------------------------
- # ☆ 技能配列取得
- #--------------------------------------------------------------------------
- def armor_skills
- result = []
- for armor in self.armors
- for skill in LY0::armor_skill(armor)
- result.push(skill)
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 技能使用可能判定 (再定義)
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- # 防具
- for a_skill in armor_skills
- return super if a_skill.id == skill.id
- end
- return _ly0sys_skill_can_use?(skill)
- end
- end
- #==============================================================================
- # ★ LY0_Window
- #------------------------------------------------------------------------------
- #==============================================================================
- class Window_Base
-
- #--------------------------------------------------------------------------
- # ☆ システムメッセージの下地を描画
- #--------------------------------------------------------------------------
- def draw_system_base
- self.opacity = 0
- rect = Rect.new(0, 0, contents.width, self.contents.height)
- self.contents.fill_rect(rect, system_color)
- rect = Rect.new(2, 2, contents.width - 4, self.contents.height - 4)
- color = Color.new(24, 8, 4)
- self.contents.fill_rect(rect, color)
- end
-
-
- end
- #==============================================================================
- # ■ Window_Skill
- #------------------------------------------------------------------------------
- # 特技画面中、显示可以使用的特技浏览的窗口
- #==============================================================================
- class Window_Skill
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- temp = []
- for skill in @actor.skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill)
- end
- # 防具加技能
- for skill in @actor.armor_skills
- next if $game_temp.in_battle and not skill.battle_ok?
- temp.push(skill) unless temp.include?(skill)
- end
- temp.sort! {|a, b| a.id <=> b.id}
- @data = []
- for skill in temp
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- class Scene_Equip
- alias _ly0mequip_start start
- alias _ly0mequip_terminate terminate
- alias _ly0mequip_update update
- alias _ly0mequip_update_equip_selection update_equip_selection
- alias _ly0mequip_update_item_windows update_item_windows
- #--------------------------------------------------------------------------
- # ○ 開始処理 (追加定義)
- #--------------------------------------------------------------------------
- def start
- _ly0mequip_start
- @skill_window = LY0_WindowItemSpec.new(0, 248, 288, [@actor])
- @skill_window.y = 416 - @skill_window.height
- @skill_window.active = true
- @skill_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 終了処理 (追加定義)
- #--------------------------------------------------------------------------
- def terminate
- _ly0mequip_terminate
- @skill_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (追加定義)
- #--------------------------------------------------------------------------
- def update
- _ly0mequip_update
- @skill_window.update
- end
- #--------------------------------------------------------------------------
- # ○ 装備部位選択の更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_equip_selection
- _ly0mequip_update_equip_selection
- @skill_window.x = 544 - 288
- @skill_window.item = @equip_window.item
- end
- #--------------------------------------------------------------------------
- # ○ アイテムウィンドウの更新 (追加定義)
- #--------------------------------------------------------------------------
- def update_item_windows
- _ly0mequip_update_item_windows
- @skill_window.x = @item_window.index % 2 == 0 ? 544 - 288 : 0
- @skill_window.item = @item_window.item
- end
- end
- #==============================================================================
- # ★ LY0_WindowItemSpec
- #------------------------------------------------------------------------------
- # 装备技能 属性的显示
- #==============================================================================
- class LY0_WindowItemSpec < Window_Base
- #--------------------------------------------------------------------------
- # ☆ オブジェクト初期化
- # actors : アクターの配列
- #--------------------------------------------------------------------------
- def initialize(x, y, width, actors)
- super(x, y, width, WLH * 5 + 48)
- @actors = actors
- @item = nil
- self.opacity = 0
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # ☆ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if self.active and @item != nil
- draw_system_base
- if @item.is_a?(RPG::Armor)
- draw_armor_skill
- else
- self.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ☆防具技能的描画
- #--------------------------------------------------------------------------
- def draw_armor_skill
- cw = contents.width - @actors.size * 24 - 8
- #draw_system_font("ARMOR_SKILL", 8, 8)
- self.contents.draw_text(8, 8, 110, 24, "ARMOR SKILL")
- self.contents.font.color = normal_color
- skills = LY0::armor_skill(@item)
- for i in 0..3
- y = WLH * (i + 1) + 8
- if skills[i] != nil
- for actor in @actors
- x = cw + (@actors.size > 1 ? actor.index * 24 : -8)
- draw_actor_status_character(actor, x + 16, 32)
- if actor.skill_learn?(skills[i])
- #draw_system_icon("CHECK1", x, y, 24)
- self.contents.draw_text(x, y, 24, 2,"RE")
- elsif actor.armor_skills.include?(skills[i])
- #draw_system_icon("CHECK2", x, y, 24)
- self.contents.draw_text(x, y, 24, 24, "ON")
- end
- end
- draw_item_name(skills[i], 8, y)
- else
- self.contents.draw_text(32, y, cw, WLH, "------------")
- end
- end
- self.visible = (not skills.empty?)
- end
- #--------------------------------------------------------------------------
- # ☆ 技能图用步行图の描画
- # actor : 角色
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # opacity : 不透明度
- #--------------------------------------------------------------------------
- def draw_actor_status_character(actor, x, y)
- bitmap = Cache.character(actor.character_name)
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- n = actor.character_index
- src_rect = Rect.new((n%4*3+1)*cw + 5, (n/4*4)*ch, 22, 22)
- self.contents.blt(x - cw / 2 + 1, y - ch + 9, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ☆ 道具的設定
- # item : 新变更的道具
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
复制代码
使用方法就是在防具的注解里添加
*ARMORSKILL[技能ID|技能ID|……]
|
|