幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1406|回复: 5

[RM2K&2K3] [求助]攻击放大脚本问题

[复制链接]

1

主题

3

帖子

35

积分

②入门

积分
35
发表于 2006-9-10 23:23:14 | 显示全部楼层 |阅读模式
下面如果我要加入我攻击敌人也会放大倍率要怎么加呢?
因为我完全不懂软件语法 慢慢看到好象是这边在控制的
有高手可以帮我写一下吗  谢谢


# ● フレーム更新 (アクターコマンドフェーズ : エネミー選擇)
#--------------------------------------------------------------------------

alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
def update_phase3_enemy_select
# カメラ:敵ターゲットをズームアップ
@xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
@xcam_z_destination = 175 #选择敌人放大倍率
# 戾す
xrxs_bp8_update_phase3_enemy_select
end
#--------------------------------------------------------------------------
# ● エネミー選擇終了
#--------------------------------------------------------------------------

alias xrxs_bp8_end_enemy_select end_enemy_select
def end_enemy_select
# カメラ:中心へ
@xcam_x_destination = 0
@xcam_z_destination = 185
# 戾す
xrxs_bp8_end_enemy_select
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------

alias xrxs_bp8_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 戾す
xrxs_bp8_update_phase4_step2
# ステップ 3 に移行する場合
if @phase4_step == 3
if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
# カメラ:行動バトラーへのズームアップを予約
@xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
@xcam_z_destination = 120 #敌人攻击放大倍率
end
# 最低 20 フレーム待つ
@wait_count = 20
end
end
回复

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-9-11 10:24:24 | 显示全部楼层
。。。都有中文注明了啊。。。把那个数字改改就知道了。 [s:5]
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

1

主题

3

帖子

35

积分

②入门

积分
35
 楼主| 发表于 2006-9-11 11:39:01 | 显示全部楼层
不是呀~里面就缺个”我攻击敌人放大倍率呀”
那些蓝色的字是我自己加的……
我加过结果都是我攻击前会放大一下 然后会回复原尺寸打敌人
而不是放大打敌人
帮帮忙吧~大哥

附上原本rgss的网址  先谢了

http://home.pchome.com.tw/star/s912204/77/123/44.htm
  1. # ▼▲▼ XRXS_BP 8. バトルバック?Full-View+可動カメラ ver..05d ▼▲▼
  2. # by 櫻雅 在土
  3. #==============================================================================
  4. # ■ Game_Battler
  5. #==============================================================================
  6. class Game_Battler
  7. #--------------------------------------------------------------------------
  8. # ● 追加?公開インスタンス變數
  9. #--------------------------------------------------------------------------
  10. attr_accessor :x_pos # バトルフィールド 橫 位置(+が右 )
  11. attr_accessor :y_pos # バトルフィールド 高さ 位置(+が上 )
  12. attr_accessor :z_pos # バトルフィールド奧行き位置(+が手前)
  13. attr_accessor :zoom # 現在のズーム倍率
  14. end
  15. #==============================================================================
  16. # ■ Game_Actor
  17. #==============================================================================
  18. class Game_Actor < Game_Battler
  19. #--------------------------------------------------------------------------
  20. # ● 追加?公開インスタンス變數
  21. #--------------------------------------------------------------------------
  22. attr_reader :actor_in_battlefield # アクターもフィールドに
  23. #--------------------------------------------------------------------------
  24. # ● セットアップ
  25. #--------------------------------------------------------------------------
  26. alias xrxs_bp8_setup setup
  27. def setup(actor_id)
  28. xrxs_bp8_setup(actor_id)
  29. # 機能"アクターもフィールドに"
  30. # trueを優先する
  31. @actor_in_battlefield = false if @actor_in_battlefield != true
  32. end
  33. end
  34. #==============================================================================
  35. # ■ Game_Enemy
  36. #==============================================================================
  37. class Game_Enemy < Game_Battler
  38. #--------------------------------------------------------------------------
  39. # ● 追加?公開インスタンス變數
  40. #--------------------------------------------------------------------------
  41. attr_reader :actor_in_battlefield # アクターもフィールドに
  42. #--------------------------------------------------------------------------
  43. # ● オブジェクト初期化
  44. #--------------------------------------------------------------------------
  45. alias xrxs_bp8_initialize initialize
  46. def initialize(troop_id, member_index)
  47. @actor_in_battlefield = false
  48. @x_pos = $data_troops[troop_id].members[member_index].x - 320
  49. @y_pos = -($data_troops[troop_id].members[member_index].y - 304)
  50. @field_x_offset = -192
  51. @field_y_offset = -144
  52. @z_pos = 0
  53. @zoom = 1.00
  54. xrxs_bp8_initialize(troop_id, member_index)
  55. end
  56. #--------------------------------------------------------------------------
  57. # ● バトル畫面 X 座標の取得
  58. #--------------------------------------------------------------------------
  59. def screen_x
  60. $xcam_x = 0 if $xcam_x == nil
  61. return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x) * @zoom
  62. end
  63. #--------------------------------------------------------------------------
  64. # ● バトル畫面 Y 座標の取得
  65. #--------------------------------------------------------------------------
  66. def screen_y
  67. $xcam_y = 0 if $xcam_y == nil
  68. return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y) * @zoom
  69. end
  70. end
  71. #==============================================================================
  72. # ■ Sprite_Battler
  73. #==============================================================================
  74. class Sprite_Battler < RPG::Sprite
  75. #--------------------------------------------------------------------------
  76. # ● フレーム更新
  77. #--------------------------------------------------------------------------
  78. alias xrxs_bp8_update update
  79. def update
  80. # 初期化
  81. @z_offset = 0
  82. # 戾す
  83. xrxs_bp8_update
  84. # バトラーが nil の場合戾る
  85. return if @battler == nil
  86. # 敵のみにカメラが影響。
  87. # 見方もバトルフィールドにいる場合ここの if を外す。
  88. if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
  89. # ズーム率
  90. zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
  91. self.zoom_x = zoom
  92. self.zoom_y = zoom
  93. @battler.zoom = zoom
  94. # スプライトの座標を設定
  95. self.x = @battler.screen_x
  96. self.y = @battler.screen_y
  97. self.z = @battler.screen_z
  98. end
  99. end
  100. end
  101. #==============================================================================
  102. # ■ Spriteset_Battle
  103. #==============================================================================
  104. class Spriteset_Battle
  105. #--------------------------------------------------------------------------
  106. # ● オブジェクト初期化
  107. #--------------------------------------------------------------------------
  108. alias xrxs_bp8_initialize initialize
  109. def initialize
  110. # 初期化
  111. @now_bg_x = -1
  112. @now_bg_y = -1
  113. @now_bg_z = -1
  114. # 通常時の實行
  115. xrxs_bp8_initialize
  116. # ビューポートを作成
  117. @viewport1 = Viewport.new(-192, -144, 1024, 768)
  118. # バトルバックスプライトを作成
  119. @battleback_sprite = Sprite.new(@viewport1)
  120. @battleback_name = ""
  121. # エネミースプライトを作成
  122. @enemy_sprites = []
  123. for enemy in $game_troop.enemies.reverse
  124. @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  125. end
  126. # 天候を作成
  127. @weather = RPG::Weather.new(@viewport1)
  128. # フレーム更新
  129. update
  130. end
  131. #--------------------------------------------------------------------------
  132. # ● フレーム更新
  133. #--------------------------------------------------------------------------
  134. alias xrxs_bp8_update update
  135. def update
  136. # バトルバックのファイル名が現在のものと違う場合
  137. if @battleback_name != $game_temp.battleback_name
  138. @battleback_name = $game_temp.battleback_name
  139. if @battleback_sprite.bitmap != nil
  140. @battleback_sprite.bitmap.dispose
  141. end
  142. bg_bitmap = RPG::Cache.battleback(@battleback_name)
  143. bg_bitmap_stretch = Bitmap.new(1024, 768)
  144. bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
  145. @battleback_sprite.bitmap = bg_bitmap_stretch
  146. end
  147. # カメラ位置が動いた場合
  148. if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
  149. # ズーム率
  150. zoom = 1.00 * 185 / $xcam_z
  151. @battleback_sprite.zoom_x = zoom
  152. @battleback_sprite.zoom_y = zoom
  153. # カメラzによる位置の修正
  154. maximum = 192 * (296 - $xcam_z) / 111
  155. $xcam_x = [[$xcam_x, -maximum].max, maximum].min
  156. # 背景位置更新
  157. @battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
  158. @battleback_sprite.y = $xcam_y * zoom - 384 * (zoom - 1)
  159. # 值更新
  160. @now_bg_x = $xcam_x
  161. @now_bg_y = $xcam_y
  162. @now_bg_z = $xcam_z
  163. end
  164. # 戾す
  165. xrxs_bp8_update
  166. end
  167. end
  168. #==============================================================================
  169. # ■ Scene_Battle
  170. #==============================================================================
  171. class Scene_Battle
  172. #--------------------------------------------------------------------------
  173. # ● メイン處理
  174. #--------------------------------------------------------------------------
  175. alias xrxs_bp8_main main
  176. def main
  177. # カメラ初期位置決定
  178. $xcam_x = 0
  179. $xcam_y = 0
  180. $xcam_z = 295
  181. # カメラの最初の目的值
  182. @xcam_x_destination = 0
  183. @xcam_y_destination = 0
  184. @xcam_z_destination = 185
  185. # 今、注目バトラーは無し。
  186. @xcam_watch_battler = nil
  187. # 初期化
  188. @wait_count_xcam = 0
  189. # 戾す
  190. xrxs_bp8_main
  191. end
  192. #--------------------------------------------------------------------------
  193. # ● フレーム更新
  194. #--------------------------------------------------------------------------
  195. alias xrxs_bp8_update update
  196. def update
  197. # カメラ位置の更新。
  198. if @wait_count_xcam > 0
  199. # ウェイトカウントを減らす
  200. @wait_count_xcam -= 1
  201. else
  202. # カメラ: Z 座標
  203. if $xcam_z != @xcam_z_destination
  204. if $xcam_z < @xcam_z_destination
  205. distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
  206. else
  207. distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
  208. end
  209. $xcam_z = [[$xcam_z + distance, 74].max, 296].min
  210. end
  211. # カメラ: X 座標
  212. if @xcam_watch_battler != nil
  213. if $xcam_x != @xcam_watch_battler.x_pos
  214. if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
  215. distance = @xcam_watch_battler.x_pos - $xcam_x
  216. elsif $xcam_x < @xcam_watch_battler.x_pos
  217. distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
  218. else
  219. distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
  220. end
  221. maximum = 192 * (296 - $xcam_z) / 111
  222. $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
  223. end
  224. elsif $xcam_x != @xcam_x_destination
  225. if ($xcam_x - @xcam_x_destination).abs < 8
  226. distance = @xcam_x_destination - $xcam_x
  227. elsif $xcam_x < @xcam_x_destination
  228. distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
  229. else
  230. distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
  231. end
  232. maximum = 192 * (296 - $xcam_z) / 111
  233. $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
  234. end
  235. # カメラ: Y 座標
  236. if @xcam_watch_battler != nil
  237. y = @xcam_watch_battler.y_pos/2
  238. if $xcam_y != y
  239. if ($xcam_y - y).abs < 8
  240. distance = y - $xcam_y
  241. elsif $xcam_y < y
  242. distance = [(y - $xcam_y)/8, 8].max
  243. else
  244. distance = [(y - $xcam_y)/8, -8].min
  245. end
  246. maximum = 144 * (296 - $xcam_z) / 111
  247. $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
  248. end
  249. elsif $xcam_y != @xcam_y_destination
  250. if $xcam_y < @xcam_y_destination
  251. distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
  252. else
  253. distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
  254. end
  255. maximum = 164 * (296 - $xcam_z) / 111
  256. $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
  257. end
  258. end
  259. # 通常實行
  260. xrxs_bp8_update
  261. end
  262. #--------------------------------------------------------------------------
  263. # ● パーティコマンドフェーズ開始
  264. #--------------------------------------------------------------------------
  265. alias xrxs_bp8_start_phase2 start_phase2
  266. def start_phase2
  267. # カメラ:センタリング
  268. @xcam_watch_battler = nil
  269. @xcam_x_destination = 0
  270. @xcam_z_destination = 185
  271. # 戾す
  272. xrxs_bp8_start_phase2
  273. end
  274. #--------------------------------------------------------------------------
  275. # ● フレーム更新 (アクターコマンドフェーズ)
  276. #--------------------------------------------------------------------------
  277. alias xrxs_bp8_update_phase3 update_phase3
  278. def update_phase3
  279. # カメラをキャラ位置へ
  280. if @active_battler != nil and @active_battler.actor_in_battlefield
  281. @xcam_x_destination = @active_battler.x_pos
  282. @xcam_z_destination = 175
  283. end
  284. xrxs_bp8_update_phase3
  285. end
  286. #--------------------------------------------------------------------------
  287. # ● フレーム更新 (アクターコマンドフェーズ : エネミー選擇)
  288. #--------------------------------------------------------------------------
  289. alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  290. def update_phase3_enemy_select
  291. # カメラ:敵ターゲットをズームアップ
  292. @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
  293. @xcam_z_destination = 175
  294. # 戾す
  295. xrxs_bp8_update_phase3_enemy_select
  296. end
  297. #--------------------------------------------------------------------------
  298. # ● エネミー選擇終了
  299. #--------------------------------------------------------------------------
  300. alias xrxs_bp8_end_enemy_select end_enemy_select
  301. def end_enemy_select
  302. # カメラ:中心へ
  303. @xcam_x_destination = 0
  304. @xcam_z_destination = 185
  305. # 戾す
  306. xrxs_bp8_end_enemy_select
  307. end
  308. #--------------------------------------------------------------------------
  309. # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  310. #--------------------------------------------------------------------------
  311. alias xrxs_bp8_update_phase4_step2 update_phase4_step2
  312. def update_phase4_step2
  313. # 戾す
  314. xrxs_bp8_update_phase4_step2
  315. # ステップ 3 に移行する場合
  316. if @phase4_step == 3
  317. if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
  318. # カメラ:行動バトラーへのズームアップを予約
  319. @xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
  320. @xcam_z_destination = 175
  321. end
  322. # 最低 20 フレーム待つ
  323. @wait_count = 20
  324. end
  325. end
  326. #--------------------------------------------------------------------------
  327. # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  328. #--------------------------------------------------------------------------
  329. alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  330. def update_phase4_step3
  331. # 戾す
  332. xrxs_bp8_update_phase4_step3
  333. if @target_battlers.size > 0 and
  334. (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
  335. # カメラ:ターゲットへのズームアップを予約
  336. @xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
  337. @xcam_z_destination = 185
  338. # もし對像アニメが「位置:畫面」のものの場合
  339. if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
  340. # カメラをセンタリング
  341. @xcam_x_destination = 0
  342. # ズームアウトまでやっちゃう?w?
  343. @xcam_z_destination = 222
  344. end
  345. end
  346. # 最低 20 フレーム待つ
  347. @wait_count = 20
  348. end
  349. #--------------------------------------------------------------------------
  350. # ● アフターバトルフェーズ開始
  351. #--------------------------------------------------------------------------
  352. alias xrxs_bp8_start_phase5 start_phase5
  353. def start_phase5
  354. @xcam_z_destination = 185
  355. xrxs_bp8_start_phase5
  356. end
  357. end
  358. #==============================================================================
  359. # ◇ RPG::再定義「戰鬥中の"畫面"アニメの位置修正」
  360. #==============================================================================
  361. module RPG
  362. class Sprite < ::Sprite
  363. def animation_set_sprites(sprites, cell_data, position)
  364. for i in 0..15
  365. sprite = sprites[i]
  366. pattern = cell_data[i, 0]
  367. if sprite == nil or pattern == nil or pattern == -1
  368. sprite.visible = false if sprite != nil
  369. next
  370. end
  371. sprite.visible = true
  372. sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  373. if position == 3
  374. if self.viewport != nil
  375. if $scene.is_a?(Scene_Battle)
  376. sprite.x = self.viewport.rect.width / 2
  377. sprite.y = 304
  378. else
  379. sprite.x = self.viewport.rect.width / 2
  380. sprite.y = self.viewport.rect.height - 160
  381. end
  382. else
  383. sprite.x = 320
  384. sprite.y = 240
  385. end
  386. else
  387. sprite.x = self.x - self.ox + self.src_rect.width / 2
  388. sprite.y = self.y - self.oy + self.src_rect.height / 2
  389. sprite.y -= self.src_rect.height / 4 if position == 0
  390. sprite.y += self.src_rect.height / 4 if position == 2
  391. end
  392. sprite.x += cell_data[i, 1]
  393. sprite.y += cell_data[i, 2]
  394. sprite.z = 2000
  395. sprite.ox = 96
  396. sprite.oy = 96
  397. sprite.zoom_x = cell_data[i, 3] / 100.0
  398. sprite.zoom_y = cell_data[i, 3] / 100.0
  399. sprite.angle = cell_data[i, 4]
  400. sprite.mirror = (cell_data[i, 5] == 1)
  401. sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  402. sprite.blend_type = cell_data[i, 7]
  403. end
  404. end
  405. end
  406. end
复制代码
回复 支持 反对

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-9-11 13:14:50 | 显示全部楼层
地址连接不上-。-|||。 [s:5]
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-9-11 14:06:19 | 显示全部楼层
把有这样类似数字的地方都改改吧。总共出现了X次,默认放大率是185。
出现处:
271行,283行,294行,305行,321行,344行,355行。
其中294和305是控制选择攻击目标时的放大率,而321行以后的都是控制攻击时候的放大。
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

1

主题

3

帖子

35

积分

②入门

积分
35
 楼主| 发表于 2006-9-11 14:34:22 | 显示全部楼层
我找到了  是338那行  谢谢盗帅冬瓜大哥
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-29 12:48 , Processed in 0.011748 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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