查看: 2132|回复: 10

300分问一个脚本问题

  [复制链接]

静

梦石
0
星屑
49
在线时间
157 小时
注册时间
2007-12-16
回帖
3031
发表于 2008-8-30 23:47:43 | 显示全部楼层 |阅读模式

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

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

×
如何判断物品是否为1号?
版务信息:本贴由楼主自主结贴~
头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-8-30
回帖
55
发表于 2008-8-30 23:51:50 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-8-29
回帖
48
发表于 2008-8-30 23:53:05 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
50
在线时间
5 小时
注册时间
2008-2-15
回帖
23
发表于 2008-8-31 01:25:13 | 显示全部楼层
在系统里不是设定好了吗
回复

使用道具 举报

魔王 ⑨

梦石
0
星屑
90
在线时间
379 小时
注册时间
2006-10-16
回帖
3980

贵宾

发表于 2008-8-31 01:28:40 | 显示全部楼层
lz的签名乃…………多啦A梦,还有,此帖竟然还有10点VIP奖励!!!
话说回来,真不知道你问什么
回复

使用道具 举报

梦石
0
星屑
68
在线时间
105 小时
注册时间
2008-1-27
回帖
1223
发表于 2008-8-31 01:30:59 | 显示全部楼层
20VIP你省著花
回复

使用道具 举报

梦石
0
星屑
42235
在线时间
6017 小时
注册时间
2006-11-10
回帖
6966
发表于 2008-8-31 02:57:00 | 显示全部楼层
吃到老还是新手- -,问这种没头没尾的伸手党问题。

判断战斗中使用物品的ID是否为1号
$data_items[@active_battler.current_action.item_id].id == 1

判断平时使用物品的ID是否为1号
@itemlist_window.item.id == 1
回复

使用道具 举报

静

梦石
0
星屑
49
在线时间
157 小时
注册时间
2007-12-16
回帖
3031
 楼主| 发表于 2008-8-31 03:41:54 | 显示全部楼层
以下引用灯笼菜刀王于2008-8-30 18:57:00的发言:

吃到老还是新手- -,问这种没头没尾的伸手党问题。

判断战斗中使用物品的ID是否为1号
$data_items[@active_battler.current_action.item_id].id == 1

判断平时使用物品的ID是否为1号
@itemlist_window.item.id == 1



[本贴由作者于 2008-8-30 18:59:05 最后编辑]

踹飞
我说IF
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-8-30
回帖
7
发表于 2008-8-31 04:21:23 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

梦石
0
星屑
50
在线时间
93 小时
注册时间
2008-5-16
回帖
705
发表于 2008-8-31 04:32:57 | 显示全部楼层
我想LZ应该是想在使用物品时判断ID吧?
把该脚本放入Main前
  1. class Scene_Item
  2.   def update_item
  3.     if Input.trigger?(Input::B)
  4.       $game_system.se_play($data_system.cancel_se)
  5.       $scene = Scene_Menu.new(0)
  6.       return
  7.     end
  8.     if Input.trigger?(Input::C)
  9.       @item = @item_window.item
  10.       $item_id = @item.id
  11.       unless @item.is_a?(RPG::Item)
  12.         $game_system.se_play($data_system.buzzer_se)
  13.         return
  14.       end
  15.       unless $game_party.item_can_use?(@item.id)
  16.         $game_system.se_play($data_system.buzzer_se)
  17.         return
  18.       end
  19.       $game_system.se_play($data_system.decision_se)
  20.       if @item.scope >= 3
  21.         @item_window.active = false
  22.         @target_window.x = (@item_window.index + 1) % 2 * 304
  23.         @target_window.visible = true
  24.         @target_window.active = true
  25.         if @item.scope == 4 || @item.scope == 6
  26.           @target_window.index = -1
  27.         else
  28.           @target_window.index = 0
  29.         end
  30.       else
  31.         if @item.common_event_id > 0
  32.           $game_temp.common_event_id = @item.common_event_id
  33.           $game_system.se_play(@item.menu_se)
  34.           if @item.consumable
  35.             $game_party.lose_item(@item.id, 1)
  36.             @item_window.draw_item(@item_window.index)
  37.           end
  38.           $scene = Scene_Map.new
  39.           return
  40.         end
  41.       end
  42.       return
  43.     end
  44.   end
  45.   def update_target
  46.     if Input.trigger?(Input::B)
  47.       $game_system.se_play($data_system.cancel_se)
  48.       unless $game_party.item_can_use?(@item.id)
  49.         @item_window.refresh
  50.       end
  51.       @item_window.active = true
  52.       @target_window.visible = false
  53.       @target_window.active = false
  54.       return
  55.     end
  56.     if Input.trigger?(Input::C)
  57.       $item_id = @item_window.item.id
  58.       if $game_party.item_number(@item.id) == 0
  59.         $game_system.se_play($data_system.buzzer_se)
  60.         return
  61.       end
  62.       if @target_window.index == -1
  63.         used = false
  64.         for i in $game_party.actors
  65.           used |= i.item_effect(@item)
  66.         end
  67.       end
  68.       if @target_window.index >= 0
  69.         target = $game_party.actors[@target_window.index]
  70.         used = target.item_effect(@item)
  71.       end
  72.       if used
  73.         $game_system.se_play(@item.menu_se)
  74.         if @item.consumable1
  75.           $game_party.lose_item(@item.id, 1)
  76.           @item_window.draw_item(@item_window.index)
  77.         end
  78.         @target_window.refresh
  79.         if $game_party.all_dead?
  80.           $scene = Scene_Gameover.new
  81.           return
  82.         end
  83.         if @item.common_event_id > 0
  84.           $game_temp.common_event_id = @item.common_event_id
  85.           $scene = Scene_Map.new
  86.           return
  87.         end
  88.       end
  89.       unless used
  90.         $game_system.se_play($data_system.buzzer_se)
  91.       end
  92.       return
  93.     end
  94.   end
  95. end
复制代码


然后用物品里的公共事件来用$item_id判断物品ID即可
if $item_id == 1
p "sa"
end
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部