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

Project1

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

[已经过期] 求助关于pudding的ARPG范例出现BUG的解决方案

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
44
在线时间
237 小时
注册时间
2011-2-27
帖子
1008
跳转到指定楼层
1
发表于 2011-6-11 18:15:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 fux2 于 2011-6-11 18:35 编辑

对pudding 的ARPG范例大爱。。。。但是,这个世界上没有无BUG的游戏。。
所以。。。求求各位解决以下的问题。。。。
每次刷新老怪们和队友都。。。满血!?
一打开菜单,存档等等就这样。。。
还有:开关条件存在时就会出错。麻烦解决成有开关判定的怪!(如XX开关打开,怪才出现。)
顺便帮忙加个暴击

以下为我自己修改过的脚本
  1. #by pudding    由 囧灬王阳 修改
  2. #------------------------------------------------------------------------------
  3. # 地图显示生命和地图显示伤害。
  4. #==============================================================================
  5. class Sprite_Character < RPG::Sprite
  6.   attr_accessor :character
  7. def initialize(viewport, character = nil)
  8.   super(viewport)
  9.     @character = character
  10.     @hpspsprite = Sprite.new(viewport)
  11.     @hpspsprite.bitmap = Bitmap.new(160, 480)
  12.     @hpspsprite.z = 0
  13.     #@hp = 0
  14.     #@maxhp = 0
  15.     @sp = $game_party.actors[0].sp
  16.     @maxsp = $game_party.actors[0].maxsp
  17.     @damage = 0
  18.     @level = $game_party.actors[0].level
  19.     @kill = $game_party.actors[0].int
  20.   end #initialize
  21. #------------------------------------------------------------------------------
  22. # 刷新
  23. #------------------------------------------------------------------------------
  24.   alias :old_update :update
  25.   def update
  26.     old_update
  27.       event = $game_map.events[@character.id] if @character.id != 0
  28.      if @character.id != 0 and (@character.return_erased2 or @character.list[0].code != 108 or @character.list[0].parameters[0] != "全部")

  29.          @hpspsprite.bitmap.clear
  30.          
  31.        old_update
  32.        return
  33.      end
  34. #------------------------------------------------------------------------------
  35. #
  36. #------------------------------------------------------------------------------
  37.       if @character.id == 0
  38.         @hp = $game_party.actors[0].hp
  39.         @maxhp = $game_party.actors[0].maxhp
  40.          else
  41.         @damage -= @character.damage if @character.id != 0 and @character.damage
  42.         if @hp=0
  43.         @hp = @character.list[4].parameters[0].to_i + @damage
  44.         end
  45.         @maxhp = @character.list[5].parameters[0].to_i
  46.         @exp = @character.list[6].parameters[0].to_i
  47.       end
  48. #------------------------------------------------------------------------------
  49. # 描绘敌人HP
  50. #------------------------------------------------------------------------------
  51. if @character.id != 0 and (@character.return_erased2 or @character.list[0].code != 108 or @character.list[2].parameters[0] != "特殊")
  52.      #p2 = 21 * @hp/[@maxhp].max
  53.      #@hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
  54.      #@hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
  55.      #@hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(255,0,0))
  56.      #@hpspsprite.bitmap.font.size = 7
  57.      #@hpspsprite.bitmap.font.color.set(255, 255, 255)
  58.      #@hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
  59.      else
  60.      p2 = 21 * @hp/[@maxhp].max
  61.      @hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
  62.      @hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
  63.      @hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(0,255,0))
  64.      @hpspsprite.bitmap.font.size = 7
  65.      @hpspsprite.bitmap.font.color.set(255, 255, 255)
  66.      @hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
  67.    end
  68. #------------------------------------------------------------------------------
  69. # 描绘角色HP
  70. #------------------------------------------------------------------------------
  71.    if @character.id == 0
  72.      p2 = 21 * @hp/[@maxhp].max
  73.      @hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
  74.      @hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
  75.      @hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(255,0,0))
  76.      @hpspsprite.bitmap.font.size = 7
  77.      @hpspsprite.bitmap.font.color.set(255, 255, 255)
  78.      @hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
  79.      end
  80. #------------------------------------------------------------------------------
  81. #  敌人的名字显示
  82. #------------------------------------------------------------------------------
  83.   if @character.id != 0 and @ccd == nil
  84.       @ccd = 1
  85.      @hpspsprite.bitmap.font.size = 12
  86.      @hpspsprite.bitmap.font.color.set(0, 0, 0)
  87.      @hpspsprite.bitmap.draw_text(-1, -1, 215, 220, "#{@character.name}", 1)
  88.      @hpspsprite.bitmap.draw_text(+1, -1, 215, 220, "#{@character.name}", 1)
  89.      @hpspsprite.bitmap.draw_text(-1, +1, 215, 220, "#{@character.name}", 1)
  90.      @hpspsprite.bitmap.draw_text(+1, +1, 215, 220, "#{@character.name}", 1)
  91.      if @character.return_erased2 or @character.list[0].code != 108 or @character.list[2].parameters[0] != "特殊"
  92.      @hpspsprite.bitmap.font.color.set(255, 0, 0)  
  93.      else
  94.      @hpspsprite.bitmap.font.color.set(0, 255, 0)
  95.      end
  96.      @hpspsprite.bitmap.draw_text(0, 0, 215, 220, "#{@character.name}", 1)
  97.    end
  98. #------------------------------------------------------------------------------
  99. # 角色名字
  100. #------------------------------------------------------------------------------
  101. if @character.id == 0 and @kk == nil
  102. @kk = 1
  103. p3 = 21 * @sp/[@maxsp].max
  104. @hpspsprite.bitmap.fill_rect(90,104,31,5,Color.new(0,0,0))
  105. @hpspsprite.bitmap.fill_rect(99,104,21,4,Color.new(255,255,255))
  106. @hpspsprite.bitmap.fill_rect(99,104,p3,4,Color.new(0,135,255))
  107. @hpspsprite.bitmap.draw_text(0, 0, 190, 213, "SP", 1)
  108. @hpspsprite.bitmap.font.size = 12
  109. @hpspsprite.bitmap.font.color.set(0, 0, 0)
  110. @hpspsprite.bitmap.draw_text(-1, -1, 215, 230, "#{$game_party.actors[0].name}", 1)
  111. @hpspsprite.bitmap.draw_text(+1, -1, 215, 230, "#{$game_party.actors[0].name}", 1)
  112. @hpspsprite.bitmap.draw_text(-1, +1, 215, 230, "#{$game_party.actors[0].name}", 1)
  113. @hpspsprite.bitmap.draw_text(+1, +1, 215, 230, "#{$game_party.actors[0].name}", 1)
  114. @hpspsprite.bitmap.font.color.set(0, 170, 250)
  115. @hpspsprite.bitmap.draw_text(0, 0, 215, 230, "#{$game_party.actors[0].name}", 1)
  116. end
  117. #------------------------------------------------------------------------------
  118. # 描绘SP
  119. #------------------------------------------------------------------------------
  120. if @character.id == 0
  121. if @sp != $game_party.actors[0].sp
  122. @sp = $game_party.actors[0].sp
  123. @maxsp = $game_party.actors[0].maxsp
  124. p3 = 21 * @sp/[@maxsp].max
  125. @hpspsprite.bitmap.fill_rect(90,104,31,5,Color.new(0,0,0))
  126. @hpspsprite.bitmap.fill_rect(99,104,21,4,Color.new(255,255,255))
  127. @hpspsprite.bitmap.fill_rect(99,104,p3,4,Color.new(0,135,255))
  128. @hpspsprite.bitmap.draw_text(0, 0, 190, 213, "SP", 1)
  129. end
  130. #------------------------------------------------------------------------------
  131. # 显示名字和等级
  132. #------------------------------------------------------------------------------
  133. if @level != $game_party.actors[0].level
  134. @level = $game_party.actors[0].level
  135. @hpspsprite.bitmap.clear
  136. @hpspsprite.bitmap.font.size = 12
  137. @hpspsprite.bitmap.font.color.set(0, 0, 0)
  138. @hpspsprite.bitmap.draw_text(-1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
  139. @hpspsprite.bitmap.draw_text(+1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
  140. @hpspsprite.bitmap.draw_text(-1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
  141. @hpspsprite.bitmap.draw_text(+1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
  142. @hpspsprite.bitmap.font.color.set(0, 170, 250)
  143. @hpspsprite.bitmap.draw_text(0, 0, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
  144. end
  145. end
  146. #------------------------------------------------------------------------------
  147. # 设置坐标
  148. #------------------------------------------------------------------------------
  149. @hpspsprite.x = self.x-106
  150. @hpspsprite.y = self.y-98
  151. #------------------------------------------------------------------------------
  152. # 地图显示伤害一部分
  153. #------------------------------------------------------------------------------
  154. if @character.damage_pop
  155. damage(@character.damage, @character.critical)
  156. @character.damage = nil
  157. @character.critical = false
  158. @character.damage_pop = false
  159. end
  160. #------------------------------------------------------------------------------
  161. #  当敌人生命值小于0时。
  162. #------------------------------------------------------------------------------
  163. if @hp <= 0 and @character.id != 0 and [email protected]_erased2 and @character.list[0].code == 108 and @character.list[0].parameters[0] == "全部"
  164.   @character.erase2
  165. end
  166. #------------------------------------------------------------------------------
  167. # 角色死亡设置
  168. #------------------------------------------------------------------------------
  169. if $game_party.actors[0].hp <= 1
  170. $scene = Scene_Gameover.new
  171. end
  172. #------------------------------------------------------------------------------
  173. # 敌人死亡设置
  174. #------------------------------------------------------------------------------
  175. if @character.id != 0 and @character.return_erased2 == true and @asd == nil
  176.   @asd = 1
  177.   $game_party.actors[0].exp += @exp

  178.   # 生成独立开关键
  179.     key = [$game_map.map_id, event.id, 'A']
  180.     # 更改独立开关
  181.     $game_self_switches[key] = true
  182.     $game_map.need_refresh = true
  183. end
  184. end #update
  185. end#class
  186. #------------------------------------------------------------------------------
  187. #
  188. #------------------------------------------------------------------------------
  189. class Game_Event
  190.   def return_erased2
  191.     return @erased2
  192.   end
  193.   def erase2
  194.     @erased2 = true
  195.   end
  196. end
  197. class Game_Event < Game_Character
  198. #——————————————————————————————————————
  199. # 用来返回名称
  200. #——————————————————————————————————————
  201. def name
  202.    return @event.name
  203. end  
  204. def name=(newname)
  205.    @event.name = newname
  206. end
  207. end
  208. #------------------------------------------------------------------------------
  209. #地图显示伤害一部分
  210. #------------------------------------------------------------------------------
  211. class Game_Character
  212.   attr_writer :opacity
  213.   attr_accessor :through
  214.   attr_accessor :character_name
  215.   attr_accessor :white_flash
  216.   attr_accessor :damage_pop
  217.   attr_accessor :damage
  218.   attr_accessor :critical
  219.   attr_accessor :move_speed
  220.   alias carol3_66RPG_damage_pop_initialize initialize
  221.   def initialize
  222.     @damage_pop = false
  223.     @damage = 0
  224.     @critical = false
  225.     @white_flash=false
  226.     carol3_66RPG_damage_pop_initialize
  227.   end
  228. end
  229. #------------------------------------------------------------------------------
  230. #  播放动画时,不能移动(角色)
  231. #==============================================================================
  232. class Game_Player
  233. attr_accessor :sprite
  234. alias hzhj_update update
  235. def update
  236. return if @sprite != nil and @sprite.effect?
  237. hzhj_update
  238. end
  239. end

  240. module RPG
  241. class Sprite < ::Sprite
  242. def effect?
  243. @_whiten_duration > 0 or
  244. @_appear_duration > 0 or
  245. @_escape_duration > 0 or
  246. @_collapse_duration > 0 or
  247. @_animation_duration > 0
  248. end
  249. end
  250. end

  251. class Sprite_Character < RPG::Sprite
  252. alias hzhj_initialize initialize
  253. def initialize(viewport, character = nil)
  254. hzhj_initialize(viewport, character)
  255. if @character.class == Game_Player
  256. @character.sprite = self
  257. end
  258. end
  259. end
  260. #------------------------------------------------------------------------------
  261. # 处理地图画面的类。
  262. #------------------------------------------------------------------------------
  263. $enemy_S = 0
  264. $friend_S = 0
  265. #------------------------------------------------------------------------------
  266. class Scene_Map
  267. alias update_kc update
  268. def update
  269. update_kc
  270. @ppp = $game_party.actors[0]
  271. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  272. #▲△▲▲△▲▲△▲▲△▲▲△★  敌人攻击  ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
  273. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  274. for enemy in $game_map.events.values
  275. next if enemy.return_erased2
  276. next if enemy.list == nil
  277. next if enemy.list[0].code != 108
  278. next if enemy.list[1].parameters[0] != "敌人"
  279. for friend in $game_map.events.values
  280. next if friend.return_erased2
  281. next if friend.list == nil
  282. next if friend.list[0].code != 108
  283. next if friend.list[1].parameters[0] != "队友"

  284. #--------------------------设置注释----------------------------------------------
  285. #敌人的攻击力
  286. @enemy_attack = enemy.list[7].parameters[0].to_i
  287. #敌人物理防御
  288. @enemy_pdef = enemy.list[8].parameters[0].to_i
  289. #敌人显示的动画
  290. @enemy_animation = enemy.list[9].parameters[0].to_i
  291. #敌人攻击速度
  292. @enemy_S = enemy.list[10].parameters[0].to_i
  293. #敌人攻击范围1
  294. @enemy_h = enemy.list[11].parameters[0].to_i
  295. #敌人攻击范围2
  296. @enemy_h2 = enemy.list[12].parameters[0].to_i
  297. #敌人挨打动画(很费)
  298. @enemy_p = enemy.list[13].parameters[0].to_i
  299. #------------------------------------------------------------------------------
  300. #角色的攻击

  301. @ppp_attack = @ppp.atk/2 + @ppp.str
  302. #角色的攻击减去敌人的防御
  303. @ppp_damage = @ppp_attack - @enemy_pdef.to_i
  304. #普通箭的伤害
  305. @arrow_damage = (@ppp_damage + @ppp.dex) * @ppp.agi
  306. #技能箭的伤害
  307. @arrow_skill_damage = ((@ppp_damage + @ppp.dex + @ppp.int) * @ppp.agi) *2
  308. #------------------------------------------------------------------------------
  309. #队友的攻击力
  310. @friend_attack = friend.list[7].parameters[0].to_i
  311. #队友的防御力
  312. @friend_pdef = friend.list[8].parameters[0].to_i
  313. #队友显示的动画
  314. @friend_animation_id = friend.list[9].parameters[0].to_i
  315. #队友攻击速度
  316. @friend_S = friend.list[10].parameters[0].to_i
  317. #队友攻击范围1
  318. @friend_h= friend.list[11].parameters[0].to_i
  319. #队友攻击范围2
  320. @friend_h2= friend.list[12].parameters[0].to_i
  321. #队友挨打动画(很费)
  322. @friend_p= friend.list[13].parameters[0].to_i
  323. #------------------------------------------------------------------------------
  324. #                    △敌人面向下,设置攻击△ (队友)
  325. #------------------------------------------------------------------------------
  326. if friend.x == enemy.x and friend.y - enemy.y <= @enemy_h and friend.y - enemy.y>=0 and enemy.direction == 2
  327.   $enemy_S += 1
  328.   case rand(5)     #减少攻击次数
  329.   when 2
  330.   if $enemy_S >= @enemy_S #延迟攻击速度
  331.   enemy.animation_id = @enemy_animation
  332. if @friend_pdef >= @enemy_attack  #当敌人攻击少于队友防御
  333.    $game_switches[31] = true      #显示MISS
  334.    friend.damage_pop = true
  335.    $enemy_S = 0
  336.   
  337.    else
  338.     friend.damage = @enemy_attack - @friend_pdef
  339.     friend.damage_pop = true
  340.     $enemy_S = 0

  341. end #if
  342. end #if
  343. end #case
  344. end #if
  345. #------------------------------------------------------------------------------
  346. #                    △敌人面向左,设置攻击△(队友)
  347. #------------------------------------------------------------------------------
  348. if friend.x - enemy.x >= @enemy_h2 and friend.y == enemy.y and friend.x - enemy.x<=0  and enemy.direction == 4
  349.   $enemy_S += 1  
  350.   case rand(5)     #减少攻击次数
  351.   when 2
  352.   if $enemy_S >= @enemy_S #延迟攻击速度
  353.   enemy.animation_id = @enemy_animation + 1
  354. if @friend_pdef >= @enemy_attack  #当敌人攻击少于队友防御
  355.    $game_switches[31] = true      #显示MISS
  356.    friend.damage_pop = true
  357.    $enemy_S = 0

  358.    else
  359.     friend.damage = @enemy_attack - @friend_pdef
  360.     friend.damage_pop = true
  361.     $enemy_S = 0
  362.   
  363. end #if
  364. end #if
  365. end #case
  366. end #if
  367. #------------------------------------------------------------------------------
  368. #                    △敌人面向右,设置攻击△(队友)
  369. #------------------------------------------------------------------------------
  370. if friend.x - enemy.x <= @enemy_h and friend.y == enemy.y and friend.x - enemy.x>=0 and enemy.direction == 6
  371.   $enemy_S += 1
  372.   case rand(5)     #减少攻击次数
  373.   when 2
  374.   if $enemy_S >= @enemy_S #延迟攻击速度
  375.   enemy.animation_id = @enemy_animation + 2
  376. if @friend_pdef >= @enemy_attack  #当敌人攻击少于队友防御
  377.    $game_switches[31] = true      #显示MISS
  378.    friend.damage_pop = true
  379.    $enemy_S = 0

  380.    else
  381.     friend.damage = @enemy_attack - @friend_pdef
  382.     friend.damage_pop = true
  383.     $enemy_S = 0
  384. end #if
  385. end #if
  386. end #case
  387. end #if
  388. #------------------------------------------------------------------------------
  389. #                    △敌人面向上,设置攻击△(队友)
  390. #------------------------------------------------------------------------------
  391. if friend.x == enemy.x and friend.y - enemy.y >= @enemy_h2 and friend.y - enemy.y<=0 and enemy.direction == 8
  392.   $enemy_S += 1
  393.   case rand(5)     #减少攻击次数
  394.   when 2
  395.   if $enemy_S >= @enemy_S #延迟攻击速度
  396.   enemy.animation_id = @enemy_animation + 3
  397. if @friend_pdef >= @enemy_attack  #当敌人攻击少于队友防御
  398.    $game_switches[31] = true      #显示MISS
  399.    friend.damage_pop = true
  400.    $enemy_S = 0

  401.    else
  402.     friend.damage = @enemy_attack - @friend_pdef
  403.     friend.damage_pop = true
  404.     $enemy_S = 0

  405. end #if
  406. end #if
  407. end #case
  408. end #if
  409. end #for
  410. end #for
  411. #------------------------------------------------------------------------------
  412. #                    ▲敌人面向下,设置攻击▲ (角色)
  413. #------------------------------------------------------------------------------
  414. for enemy in $game_map.events.values
  415. next if enemy.return_erased2
  416. next if enemy.list == nil
  417. next if enemy.list[0].code != 108
  418. next if enemy.list[1].parameters[0] != "敌人"
  419. if $game_player.x == enemy.x and $game_player.y - enemy.y <= @enemy_h and $game_player.y - enemy.y>=0 and enemy.direction == 2
  420.   $enemy_S += 1
  421.   case rand(5)     #减少攻击次数
  422.   when 2  
  423.   if $enemy_S >= @enemy_S #延迟攻击速度  
  424.   enemy.animation_id = @enemy_animation
  425. if @ppp.pdef >= @enemy_attack     #当敌人攻击少于角色防御
  426.    $game_switches[31] = true      #显示MISS
  427.    $game_player.damage_pop = true
  428.    $enemy_S = 0

  429.    else
  430.     $game_player.damage = @enemy_attack - @ppp.pdef
  431.     $game_player.damage_pop = true
  432.     @ppp.hp -= $game_player.damage
  433.     $enemy_S = 0

  434. end #if
  435. end #if
  436. end #case
  437. end #if
  438. #------------------------------------------------------------------------------
  439. #                    ▲敌人面向左,设置攻击▲ (角色)
  440. #------------------------------------------------------------------------------
  441. if $game_player.x - enemy.x >= @enemy_h2 and $game_player.x - enemy.x<=0 and $game_player.y == enemy.y and enemy.direction == 4
  442.   $enemy_S += 1
  443.   case rand(5)     #减少攻击次数
  444.   when 2  
  445.   if $enemy_S >= @enemy_S #延迟攻击速度  
  446.   enemy.animation_id = @enemy_animation + 1
  447. if @ppp.pdef >= @enemy_attack     #当敌人攻击少于角色防御
  448.    $game_switches[31] = true      #显示MISS
  449.    $game_player.damage_pop = true
  450.    $enemy_S = 0

  451.    else
  452.     $game_player.damage = @enemy_attack - @ppp.pdef
  453.     $game_player.damage_pop = true
  454.     @ppp.hp -= $game_player.damage
  455.     $enemy_S = 0

  456. end #if
  457. end #if
  458. end #case
  459. end #if
  460. #------------------------------------------------------------------------------
  461. #                    ▲敌人面向右,设置攻击▲ (角色)
  462. #------------------------------------------------------------------------------
  463. if $game_player.x - enemy.x <=@enemy_h  and $game_player.x - enemy.x>=0 and$game_player.y == enemy.y and enemy.direction == 6
  464.   $enemy_S += 1
  465.   case rand(5)     #减少攻击次数
  466.   when 2  
  467.   if $enemy_S >= @enemy_S #延迟攻击速度  
  468.   enemy.animation_id = @enemy_animation + 2
  469. if @ppp.pdef >= @enemy_attack     #当敌人攻击少于角色防御
  470.    $game_switches[31] = true      #显示MISS
  471.    $game_player.damage_pop = true
  472.    $enemy_S = 0

  473.    else
  474.     $game_player.damage = @enemy_attack - @ppp.pdef
  475.     $game_player.damage_pop = true
  476.     @ppp.hp -= $game_player.damage
  477.     $enemy_S = 0

  478. end #if
  479. end #if
  480. end #case
  481. end #if
  482. #------------------------------------------------------------------------------
  483. #                    ▲敌人面向上,设置攻击▲ (角色)
  484. #------------------------------------------------------------------------------
  485. #角色
  486. if $game_player.x == enemy.x and $game_player.y - enemy.y >= @enemy_h2 and $game_player.y - enemy.y <=0 and enemy.direction == 8
  487.   $enemy_S += 1
  488.   case rand(5)     #减少攻击次数
  489.   when 2  
  490.   if $enemy_S >= @enemy_S #延迟攻击速度  
  491.   enemy.animation_id = @enemy_animation + 3
  492. if @ppp.pdef >= @enemy_attack     #当敌人攻击少于角色防御
  493.    $game_switches[31] = true      #显示MISS
  494.    $game_player.damage_pop = true
  495.    $enemy_S = 0

  496.    else
  497.     $game_player.damage = @enemy_attack - @ppp.pdef
  498.     $game_player.damage_pop = true
  499.     @ppp.hp -= $game_player.damage
  500.     $enemy_S = 0
  501.    
  502. end #if
  503. end #if
  504. end #case
  505. end #if
  506. #-------
  507. end#for
  508. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  509. #▲△▲▲△▲▲△▲▲△▲▲△★  角色攻击  ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
  510. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  511. $game_temp.common_event_id = 5
  512. if Input.trigger?(Input::Y) and $game_player.sprite.effect? == false
  513.   $game_temp.common_event_id = 2
  514.   case $game_player.direction
  515.   when 2  #角色向面下的动画
  516.     $game_player.animation_id = $game_variables[51]
  517.   when 4  #角色向面左的动画
  518.     $game_player.animation_id = $game_variables[52]
  519.   when 6  #角色向面右的动画
  520.     $game_player.animation_id = $game_variables[53]
  521.   when 8  #角色向面上的动画
  522.     $game_player.animation_id = $game_variables[54]
  523.     end

  524. #------------------------------------------------------------------------------
  525. for event in $game_map.events.values
  526. next if event.return_erased2
  527. next if event.list == nil
  528. next if event.list[0].code != 108
  529. next if event.list[1].parameters[0] != "敌人"  

  530. #------------------------------------------------------------------------------
  531. #                    ▲角色面向下,设置攻击▲
  532. #------------------------------------------------------------------------------
  533. if $game_player.x == event.x and event.y - $game_player.y <= $game_variables[80] and event.y - $game_player.y >=0 and $game_player.direction == 2
  534.     event.animation_id = @enemy_p
  535.   if @ppp_attack <= @enemy_pdef      #当角色攻击小于敌人防御就显示Miss
  536.     $game_switches[31] = true        #显示MISS
  537.     event.damage_pop = true

  538.     else
  539.     event.damage = @ppp_damage
  540.     event.damage_pop = true


  541. end
  542. end
  543. #------------------------------------------------------------------------------
  544. #                    ▲角色面向左,设置攻击▲
  545. #------------------------------------------------------------------------------
  546. if $game_player.x - event.x <= $game_variables[80] and $game_player.x - event.x >=0 and event.y == $game_player.y and $game_player.direction == 4
  547.     event.animation_id = @enemy_p
  548.   if @ppp_attack <= @enemy_pdef      #当角色攻击小于敌人防御就显示Miss
  549.     $game_switches[31] = true        #显示MISS
  550.     event.damage_pop = true
  551.     else
  552.     event.damage = @ppp_damage
  553.     event.damage_pop = true

  554.   end
  555.   end
  556. #------------------------------------------------------------------------------
  557. #                    ▲角色面向右,设置攻击▲
  558. #------------------------------------------------------------------------------
  559. if $game_player.x - event.x >= $game_variables[81] and $game_player.x - event.x <=0 and event.y == $game_player.y and $game_player.direction == 6
  560.     event.animation_id = @enemy_p
  561.   if @ppp_attack <= @enemy_pdef      #当角色攻击小于敌人防御就显示Miss
  562.     $game_switches[31] = true        #显示MISS
  563.     event.damage_pop = true
  564.     else
  565.     event.damage = @ppp_damage
  566.     event.damage_pop = true

  567.   end
  568.   end
  569. #------------------------------------------------------------------------------
  570. #                    ▲角色面向上,设置攻击▲
  571. #------------------------------------------------------------------------------
  572. if $game_player.x == event.x and event.y - $game_player.y >= $game_variables[81] and event.y - $game_player.y <=0 and $game_player.direction == 8
  573.     event.animation_id = @enemy_p
  574.   if @ppp_attack <= @enemy_pdef      #当角色攻击小于敌人防御就显示Miss
  575.     $game_switches[31] = true        #显示MISS
  576.     event.damage_pop = true
  577.     else
  578.     event.damage = @ppp_damage
  579.     event.damage_pop = true

  580.   end
  581. end

  582. for event in $game_map.events.values
  583. next if event.return_erased2
  584. next if event.list == nil
  585. next if event.list[0].code != 108
  586. next if event.list[1].parameters[0] != "队友"  
  587. #------------------------------------------------------------------------------
  588. #  ###################        ▲角色面向下,设置攻击▲
  589. #------------------------------------------------------------------------------
  590. if $game_player.x == event.x and event.y - $game_player.y <= $game_variables[80] and event.y - $game_player.y >=0 and $game_player.direction == 2
  591.     event.animation_id = @friend_p
  592.        if @ppp_attack <= @friend_pdef      #当角色攻击小于敌人防御就显示Miss
  593.     $game_switches[31] = true        #显示MISS
  594.     event.damage_pop = true


  595.     else
  596.     event.damage = @ppp_damage
  597.     event.damage_pop = true


  598. end
  599. end
  600. #------------------------------------------------------------------------------
  601. #                    ▲角色面向左,设置攻击▲
  602. #------------------------------------------------------------------------------
  603. if $game_player.x - event.x <= $game_variables[80] and $game_player.x - event.x >=0 and event.y == $game_player.y and $game_player.direction == 4
  604.     event.animation_id = @friend_p
  605.        if @ppp_attack <= @friend_pdef      #当角色攻击小于敌人防御就显示Miss
  606.     $game_switches[31] = true        #显示MISS
  607.     event.damage_pop = true
  608. else
  609.     event.damage = @ppp_damage
  610.     event.damage_pop = true


  611.   end
  612.   end
  613. #------------------------------------------------------------------------------
  614. #                    ▲角色面向右,设置攻击▲
  615. #------------------------------------------------------------------------------
  616. if $game_player.x - event.x >= $game_variables[81] and $game_player.x - event.x <=0 and event.y == $game_player.y and $game_player.direction == 6
  617.     event.animation_id =  @friend_p
  618.        if @ppp_attack <= @friend_pdef      #当角色攻击小于敌人防御就显示Miss
  619.     $game_switches[31] = true        #显示MISS
  620.     event.damage_pop = true
  621.     else
  622.     event.damage = @ppp_damage
  623.     event.damage_pop = true

  624.   end
  625.   end
  626. #------------------------------------------------------------------------------
  627. #                    ▲角色面向上,设置攻击▲
  628. #------------------------------------------------------------------------------
  629. if $game_player.x == event.x and event.y - $game_player.y >= $game_variables[81] and event.y - $game_player.y <=0 and $game_player.direction == 8
  630.     event.animation_id =  @friend_p
  631.   if @ppp_attack <= @enemy_pdef      #当角色攻击小于敌人防御就显示Miss
  632.     $game_switches[31] = true        #显示MISS
  633.     event.damage_pop = true
  634. $game_variables[56] -= 1
  635.     else
  636.     event.damage = @ppp_damage
  637.     event.damage_pop = true
  638.   end
  639.        if @ppp_attack <= @friend_pdef      #当角色攻击小于敌人防御就显示Miss
  640.     $game_switches[31] = true        #显示MISS
  641.     event.damage_pop = true
  642. $game_variables[56] - 1
  643.   end
  644. end
  645. #------
  646. end#for
  647. end#if
  648. end
  649. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  650. #▲△▲▲△▲▲△▲▲△▲▲△★  队友攻击  ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
  651. #〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
  652. for enemy in $game_map.events.values
  653. next if enemy.return_erased2
  654. next if enemy.list == nil
  655. next if enemy.list[0].code != 108
  656. next if enemy.list[1].parameters[0] != "敌人"
  657. for friend in $game_map.events.values
  658. next if friend.return_erased2
  659. next if friend.list == nil
  660. next if friend.list[0].code != 108
  661. next if friend.list[1].parameters[0] != "队友"
  662. #------------------------------------------------------------------------------
  663. #                    ▲队友面向下,设置攻击▲
  664. #------------------------------------------------------------------------------
  665. if friend.x == enemy.x and enemy.y - friend.y <= @friend_h and enemy.y - friend.y >=0 and friend.direction == 2
  666.   $friend_S += 1
  667.   case rand(5)     #减少攻击次数
  668.   when 2
  669.   if $friend_S >= @friend_S #延迟攻击速度  
  670.   friend.animation_id = @friend_animation_id
  671. if @enemy_pdef >= @friend_attack     #当队友攻击少于敌人防御
  672.    $game_switches[31] = true         #显示MISS
  673.    enemy.damage_pop = true
  674.    $friend_S = 0

  675.    else
  676.     enemy.damage = @friend_attack
  677.     enemy.damage_pop = true
  678.     enemy.jump(0,1)
  679.     $friend_S = 0

  680. end #if
  681. end #if
  682. end #case
  683. end #if
  684. #------------------------------------------------------------------------------
  685. #                    ▲队友面向左,设置攻击▲
  686. #------------------------------------------------------------------------------
  687. if friend.x - enemy.x <= @friend_h and friend.x - enemy.x>=0 and enemy.y == friend.y and friend.direction == 4
  688.   $friend_S += 1
  689.   case rand(5)     #减少攻击次数
  690.   when 2
  691.   if $friend_S >= @friend_S #延迟攻击速度  
  692.   friend.animation_id = @friend_animation_id + 1
  693. if @enemy_pdef >= @friend_attack     #当队友攻击少于敌人防御
  694.    $game_switches[31] = true         #显示MISS
  695.    enemy.damage_pop = true
  696.    $friend_S = 0
  697.    
  698.    else
  699.     enemy.damage = @friend_attack
  700.     enemy.damage_pop = true
  701.     enemy.jump(0,1)
  702.     $friend_S = 0
  703.    
  704. end #if
  705. end #if
  706. end #case
  707. end #if
  708. #------------------------------------------------------------------------------
  709. #                    ▲队友面向右,设置攻击▲
  710. #------------------------------------------------------------------------------
  711. if friend.x - enemy.x >= @friend_h2 and friend.x - enemy.x<=0 and enemy.y == friend.y and friend.direction == 6
  712.   $friend_S += 1
  713.   case rand(5)     #减少攻击次数
  714.   when 2
  715.   if $friend_S >= @friend_S #延迟攻击速度  
  716.   friend.animation_id = @friend_animation_id + 2
  717. if @enemy_pdef >= @friend_attack     #当队友攻击少于敌人防御
  718.    $game_switches[31] = true         #显示MISS
  719.    enemy.damage_pop = true
  720.    $friend_S = 0
  721.    
  722.    else
  723.     enemy.damage = @friend_attack
  724.     enemy.damage_pop = true
  725.     enemy.jump(0,1)
  726.     $friend_S = 0
  727.    
  728. end #if
  729. end #if
  730. end #case
  731. end #if
  732. #------------------------------------------------------------------------------
  733. #                    ▲队友面向上,设置攻击▲
  734. #------------------------------------------------------------------------------
  735. if friend.x == enemy.x and enemy.y - friend.y >= @friend_h2 and  enemy.y - friend.y<=0 and friend.direction == 8
  736.   $friend_S += 1
  737.   case rand(5)     #减少攻击次数
  738.   when 2
  739.   if $friend_S >= @friend_S #延迟攻击速度  
  740.   friend.animation_id = @friend_animation_id + 3
  741. if @enemy_pdef >= @friend_attack     #当队友攻击少于敌人防御
  742.    $game_switches[31] = true         #显示MISS
  743.    enemy.damage_pop = true
  744.    $friend_S = 0
  745.   
  746.    else
  747.     enemy.damage = @friend_attack
  748.     enemy.damage_pop = true
  749.     enemy.jump(0,1)
  750.     $friend_S = 0
  751.    
  752. end #if
  753. end #if
  754. end #case
  755. end #if
  756. end#for
  757. end#for
  758. #------------------------------------------------------------------------------
  759. #普通箭的判断
  760. #------------------------------------------------------------------------------
  761. for arr in $game_map.events.values
  762. next if arr.return_erased2
  763. next if arr.list == nil
  764. next if arr.list[0].code != 108
  765. next if arr.list[0].parameters[0] != "箭"
  766. for event in $game_map.events.values
  767. next if event.return_erased2
  768. next if event.list == nil
  769. next if event.list[0].code != 108
  770. next if event.list[1].parameters[0] != "敌人"
  771. if arr.x == event.x and arr.y == event.y
  772.   if @arrow_damage <= @enemy_pdef        #当角色攻击小于敌人防御就显示Miss
  773.     $game_switches[31] = true            #显示MISS
  774.     event.damage_pop = true
  775.    
  776.   else
  777.     event.damage = @arrow_damage
  778.     event.damage_pop = true
  779.     arr.moveto(0,0)
  780.     arr.opacity = 0
  781.      
  782. end
  783. end
  784. end
  785. end
  786. #------------------------------------------------------------------------------
  787. #技能箭的判断
  788. #------------------------------------------------------------------------------
  789. for brr in $game_map.events.values
  790. next if brr.return_erased2
  791. next if brr.list == nil
  792. next if brr.list[0].code != 108
  793. next if brr.list[0].parameters[0] != "冰箭"
  794. for event in $game_map.events.values
  795. next if event.return_erased2
  796. next if event.list == nil
  797. next if event.list[0].code != 108
  798. next if event.list[1].parameters[0] != "敌人"
  799. if brr.x == event.x and brr.y == event.y
  800.   if @arrow_skill_damage <= @enemy_pdef     #当角色攻击小于敌人防御就显示Miss
  801.     $game_switches[31] = true               #显示MISS
  802.     event.damage_pop = true

  803.   else
  804.     event.damage = @arrow_skill_damage
  805.     event.damage_pop = true
  806.     brr.moveto(0,0)
  807.     brr.opacity = 0
  808.   
  809. end
  810. end
  811. end
  812. end
  813. end#update
  814. #--------------------------------------------------------------------------
  815. # ● 物品炸弹
  816. #--------------------------------------------------------------------------
  817. def item_bomb
  818. for bomb in $game_map.events.values
  819. next if bomb.list == nil
  820. next if bomb.list[0].code != 108
  821. next if bomb.list[0].parameters[0] != "bomb"
  822. bomb.animation_id = 99
  823. for event in $game_map.events.values
  824. next if event.return_erased2
  825. next if event.list == nil
  826. next if event.list[0].code != 108
  827. next if event.list[1].parameters[0] != "敌人"
  828. if (bomb.x - event.x).abs <= 1 and (bomb.y - event.y).abs <= 2
  829.       event.damage = (@ppp_attack + @ppp.int/2)*2 + 500
  830.       event.damage_pop = true
  831. case $game_player.direction
  832. when 2
  833. event.jump(0, 1)
  834. when 4
  835. event.jump(-1, 0)
  836. when 6
  837. event.jump(1, 0)
  838. when 8
  839. event.jump(0, -1)
  840. end

  841. end
  842. end
  843. end
  844. end #def item_bomb
  845. end#class
复制代码

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
2
发表于 2011-6-11 19:08:16 | 只看该作者
表示直接找pudding要新的范例吧
旧范例是偶这个问题的,新范例我重装电脑后找不到了- -

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
44
在线时间
237 小时
注册时间
2011-2-27
帖子
1008
3
 楼主| 发表于 2011-6-11 19:46:16 | 只看该作者
我下过。。。。找他的话他又没空。。。:'(

点评

等他QQ上线我提醒下他更新吧- -  发表于 2011-6-11 20:20
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-26 06:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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