设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 601|回复: 2
打印 上一主题 下一主题

[已经过期] 请问一下,如何让玩家穿上某件装备的时候,切换某个行...

[复制链接]

Lv2.观梦者

梦石
0
星屑
529
在线时间
58 小时
注册时间
2021-3-3
帖子
18
跳转到指定楼层
1
发表于 2023-9-20 13:40:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
=begin
#===============================================================================
** 装备事件
Author: Hime
Date: Feb 26, 2013
--------------------------------------------------------------------------------
** Change log
Feb 26, 2014
   - re-ordered event execution .dequip event is executed before equip event.
Jun 7, 2013
   - updated common event queue for backwards compatibility. common event ID
     returns the first element in the queue list
Jun 6, 2013
   - equip events do not automatically run in scenes now. You will need
     the Scene Interpreter script
May 20, 2013
   - common events now queue up and will be run automatically
Feb 15, 2013
   - added support for dequipping items
Sep 21
   - fixed bug where equipping nothing threw NoMethod error
Sep 6, 2012
   - initial release
--------------------------------------------------------------------------------   
** Description

在武器/护甲装备/解除时可以触发一个公共事件.

--------------------------------------------------------------------------------   
** Installation

Place this below Materials and above Main.

--------------------------------------------------------------------------------   
** Usage

武器/护甲备注

    <装备公共事件: x>
    <解除公共事件: x>
   
x为公共事件ID.
#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["Tsuki_EquipEvents"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module Tsuki
  module Equip_Events
   
    Equip_Regex = /<装备公共事件:\s*(\d+)>/i
    Dequip_Regex = /<解除公共事件:\s*(\d+)>/i
  end
end
#===============================================================================
# ** Rest of script
#===============================================================================
module RPG
  class EquipItem
   
    def equip_event_id
      return @equip_event_id unless @equip_event_id.nil?
      res = Tsuki::Equip_Events::Equip_Regex.match(self.note)
      return @equip_event_id = res ? res[1].to_i : 0
    end
   
    def dequip_event_id
      return @dequip_event_id unless @dequip_event_id.nil?
      res = Tsuki::Equip_Events::Dequip_Regex.match(self.note)
      return @dequip_event_id = res ? res[1].to_i : 0
    end
  end
end

class Game_Actor
  
  alias :th_equip_events_change_equip :change_equip
  def change_equip(slot_id, item)
    old_item = @equips[slot_id].object
    th_equip_events_change_equip(slot_id, item)
    if @equips[slot_id].object == item
      $game_temp.reserve_common_event(old_item.dequip_event_id) if old_item
      $game_temp.reserve_common_event(item.equip_event_id) if item
    end
  end
end

unless $imported["TH_CommonEventQueue"]
  class Game_Temp

    attr_reader :reserved_common_events
    alias :th_common_event_queue_init :initialize
    def initialize
      th_common_event_queue_init
      @reserved_common_events = []
    end

    # re-write
    def reserve_common_event(common_event_id)
      @reserved_common_events.push(common_event_id) if common_event_id > 0
    end
   
    def common_event_id
      @reserved_common_events[0]
    end

    # Note that I don't actually need to clear it out. It's done
    # by the queue.

    # true if list is not empty
    def common_event_reserved?
      !@reserved_common_events.empty?
    end

    # Grab the first one, first-in-first-out order
    def reserved_common_event
      $data_common_events[@reserved_common_events.shift]
    end
  end
end
本来我使用的是这个脚本来切换行走图。但是这个脚本与我使用的另一个脚本冲突。

Lv3.寻梦者

梦石
0
星屑
978
在线时间
71 小时
注册时间
2021-4-13
帖子
35
2
发表于 2023-9-20 16:22:07 | 只看该作者
请具体说明另一个脚本是什么……
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
775
在线时间
92 小时
注册时间
2018-2-5
帖子
70
3
发表于 2023-9-29 19:49:22 | 只看该作者
用alias 取个别名试试!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 06:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表