Project1

标题: 请教一个ARPG脚本攻击范围的设定方法 [打印本页]

作者: iTD    时间: 2011-7-5 14:28
标题: 请教一个ARPG脚本攻击范围的设定方法
本帖最后由 fux2 于 2011-7-5 14:51 编辑

想知道哪里是定义炸弹范围、炸弹时间、炸弹威力····

谢谢!!


脚本内容
  1. #--------------------------------------------------------------------------
  2. # ● 定义ARPG
  3. #--------------------------------------------------------------------------
  4. class ARPG_zhadan
  5. #--------------------------------------------------------------------------
  6. # ● 初始化对象
  7. #--------------------------------------------------------------------------
  8.   def initialize
  9.     @zhadan_ID = $game_variables[152]
  10.     @zhadan_x = $game_map.events[$game_variables[152]].x
  11.     @zhadan_y = $game_map.events[$game_variables[152]].y
  12.     update
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 更新数值变化
  16.   #--------------------------------------------------------------------------
  17.   def refresh(type)
  18.     case type
  19.     when 0
  20.        if $game_switches[21] == true
  21.         if (@zhadan_x - $game_player.x).abs <=10
  22.         if (@zhadan_y - $game_player.y).abs <=10
  23.     if Input.trigger?(Input::UP)
  24.     $game_map.events[$game_variables[152]].move_up
  25. end
  26.     if Input.trigger?(Input::DOWN)
  27.       $game_map.events[$game_variables[152]].move_down
  28.     end
  29.     if Input.trigger?(Input::RIGHT)
  30.     $game_map.events[$game_variables[152]].move_right
  31.     end
  32.     if Input.trigger?(Input::LEFT)
  33.     $game_map.events[$game_variables[152]].move_left
  34.     end
  35.     if Input.trigger?(Input::C)
  36.           x = $game_map.events[$game_variables[152]].x - $game_map.events[$game_variables[151]].x
  37.           y = $game_map.events[$game_variables[152]].y - $game_map.events[$game_variables[151]].y
  38.           $game_map.events[$game_variables[151]].jump(x,y)
  39.           $game_switches[22] = true      
  40.     end
  41.     return
  42.   else
  43.     $game_map.events[$game_variables[152]].move_backward
  44.     end
  45.   else
  46.     $game_map.events[$game_variables[152]].move_backward
  47.   end
  48.   end
  49. end
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 刷新
  53.   #--------------------------------------------------------------------------
  54.   def update
  55.         @zhadan_x = $game_map.events[$game_variables[152]].x
  56.     @zhadan_y = $game_map.events[$game_variables[152]].y
  57.       refresh(0)
  58.   end
  59. end
  60. #--------------------------------------------------------------------------
  61. # ● 定义ARPG
  62. #--------------------------------------------------------------------------
  63. class ARPG_zhadan2
  64. #--------------------------------------------------------------------------
  65. # ● 初始化对象
  66. #--------------------------------------------------------------------------
  67.   def initialize
  68.     @zhadan2_ID = $game_variables[151]
  69.     @zhadan2_x = $game_map.events[$game_variables[151]].x
  70.     @zhadan2_y = $game_map.events[$game_variables[151]].y
  71.     update
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 更新数值变化
  75.   #--------------------------------------------------------------------------
  76.   def refresh(type)
  77.     case type
  78.     when 0
  79. $n2 = 0
  80. $game_map.events[$game_variables[151]].animation_id =7
  81. while $n2 <= $game_variables[123]
  82. $n2 += 1
  83. if $game_variables[200+$n2] >= 0
  84. if ($game_map.events[$n2].x - @zhadan2_x).abs <= 3
  85. if ($game_map.events[$n2].y - @zhadan2_y).abs <= 3
  86. $攻击1=$game_actors[1].str * 4
  87. $攻击1 /= 2
  88. $攻击3 = $攻击1
  89. $攻击3 +=$game_actors[1].atk
  90. $攻击3 -= rand(10)
  91. $攻击3 += rand(10)
  92. $game_map.events[$n2].damage=$攻击3
  93. $game_map.events[$n2].damage_pop = true
  94. $game_variables[200+$n2] -= $攻击3
  95. Audio.se_play("Audio/SE/052-Cannon01",90,100)
  96. end
  97. end
  98. end
  99. end
  100. if ($game_player.x - @zhadan2_x).abs <= 3
  101. if ($game_player.y - @zhadan2_y).abs <= 3
  102. $攻击1=$game_actors[1].str * 4
  103. $攻击1 /= 2
  104. $攻击3 = $攻击1
  105. $攻击3 +=$game_actors[1].atk
  106. $攻击3 -= rand(10)
  107. $攻击3 += rand(10)
  108. $game_player.damage= $攻击3
  109. $game_player.damage_pop = true
  110. $game_actors[1].hp -= $攻击3
  111. Audio.se_play("Audio/SE/052-Cannon01",90,100)
  112. $game_switches[24] = true
  113. end
  114. end
  115.       
  116. end
  117. end
  118.   #--------------------------------------------------------------------------
  119.   # ● 刷新
  120.   #--------------------------------------------------------------------------
  121.   def update
  122.     @zhadan2_x = $game_map.events[$game_variables[151]].x
  123.     @zhadan2_y = $game_map.events[$game_variables[151]].y
  124.       refresh(0)
  125.   end
  126. end
复制代码
dsu_plus_rewardpost_czw
作者: END66RPG    时间: 2011-7-5 14:41
具体等待时间在事件中去设,如等待20秒 — 然后调用这个脚本
杀伤力(威力)$攻击3
范围是3,呈现↑:if ($game_map.events[$n2].x - @zhadan2_x).abs <= 3
                 ← →
                    ↓




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