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

Project1

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

[已经过期] 超级横版战斗的攻击设定

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1349
在线时间
185 小时
注册时间
2012-8-26
帖子
110
跳转到指定楼层
1
发表于 2013-8-2 14:57:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
有关xp脚本“超级横版战斗”中,对于角色的远近攻击有无相关设定?
  1. #==============================================================================
  2. # * Animated_Sprite                                Scripted by: SiR_VaIlHoR
  3. #                                                  Edited by: 柳柳
  4. #------------------------------------------------------------------------------
  5. #  A class for animated sprites.
  6. #==============================================================================

  7. #66RPG,超级横版战斗脚本简要说明:

  8. #默认情况下,把一张战斗图截成4列,>8行,如果感觉4列4帧的动画还不能满足要求,看
  9. #def pose(number,frame = 4),更改=4,以及相关部分。
  10.   
  11. #战斗图从上到下:前进图,等待图,防御图,挨打图,普通攻击图(默认的武器),施展魔法,
  12. #倒地不行了,胜利姿势,自定义武器1,自定义武器2……

  13. #这个脚本的模型是老外编写的,其中参考了XMXS的一个方法,我添加了一些功能,去掉素材限制。

  14. #不同职业拥有的图片数可以不一样,参考工程和录像教学

  15. #==============================================================================
  16. # □ RPG::Class
  17. #==============================================================================
  18. module RPG
  19.   class Class
  20.     def name
  21.       name = @name.split(/,/)[0]
  22.       return name != nil ? name : ''
  23.     end
  24.     def name2
  25.       name = @name.split(/,/)[1]
  26.       return name != nil ? name : ''
  27.     end
  28.   end
  29.   class Weapon
  30.     def name
  31.       name = @name.split(/,/)[0]
  32.       return name != nil ? name : ''
  33.     end
  34.     def name2
  35.       name = @name.split(/,/)[1]
  36.       return name != nil ? name : ''
  37.     end   
  38.   end  
  39. end

  40. class Game_Actor
  41.   #--------------------------------------------------------------------------
  42.   # ● 更改名称
  43.   #     name : 新的名称
  44.   #--------------------------------------------------------------------------
  45.   def picturephase
  46.     name = $data_classes[class_id].name2
  47.     return name != nil ? name : "66RPG"
  48.   end
  49. end

  50. class Game_Enemy
  51.   #--------------------------------------------------------------------------
  52.   # ● 获取名称
  53.   #--------------------------------------------------------------------------
  54.   def name
  55.     name = $data_enemies[@enemy_id].name.split(/,/)[0]
  56.     return name != nil ? name : ''
  57.   end
  58.   def picturephase
  59.     name = $data_enemies[@enemy_id].name.split(/,/)[1]
  60.     return name != nil ? name : "66RPG"
  61.   end  
  62. end

  63. class Animated_Sprite < RPG::Sprite
  64. #--------------------------------------------------------------------------
  65. # - Accessible instance variables.
  66. #--------------------------------------------------------------------------
  67. attr_accessor :frames        # Number of animation frames
  68. attr_accessor :delay         # Delay time between frames (speed)
  69. attr_accessor :frame_width   # Width of each frame
  70. attr_accessor :frame_height  # Height of each frame
  71. attr_accessor :offset_x      # X coordinate of the 1st frame
  72. attr_accessor :offset_y      # Y coordinate of all frames
  73. attr_accessor :current_frame # Current animation frame
  74. attr_accessor :moving        # Is the sprite moving?

  75. #--------------------------------------------------------------------------
  76. # - Initialize an animated sprite
  77. #   viewport : Sprite viewport
  78. #--------------------------------------------------------------------------
  79. def initialize(viewport = nil)
  80.    super(viewport)
  81.    @frame_width, @frame_height = 0, 0
  82.    change    # A basic change to set initial variables
  83.    @old = Graphics.frame_count  # For the delay method
  84.    @goingup = true    # Increasing animation? (if @rm2k_mode is true)
  85.    @once = false      # Is the animation only played once?
  86.    @animated = true   # Used to stop animation when @once is true
  87. end

  88. #--------------------------------------------------------------------------
  89. # Comment by RPG
  90. #   - Change the source rect (change the animation)
  91. #   frames : Number of animation frames
  92. #   delay : Frame delay, controls animation speed
  93. #   offx : X coordinate of the 1st frame
  94. #   offy : Y coordinate of all frames
  95. #   startf : Starting frame for animation
  96. #   once : Is the animation only played once?
  97. #   rm2k_mode : Animation pattern: 1-2-3-2 if true, 1-2-3-1 if false
  98. #
  99. # Comment by cybersam
  100. #
  101. # the rm2k_mode isnt pressent anymore...
  102. # if you want that feature then use rm2k or use RPG's scrîpt...
  103. #--------------------------------------------------------------------------
  104. def change(frames = 0, delay = 0, offx = 0, offy = 0,
  105.             startf = 0, once = false)
  106.    @frames = frames
  107.    @delay = delay
  108.    @offset_x, @offset_y = offx, offy
  109.    @current_frame = startf
  110.    @once = once
  111.    x = @current_frame * @frame_width + @offset_x
  112.    self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
  113.    @goingup = true
  114.    @animated = true
  115. end
  116.   
  117. #--------------------------------------------------------------------------
  118. # - Update animation and movement
  119. #--------------------------------------------------------------------------
  120. def update
  121.    super
  122.    if self.bitmap != nil and delay(@delay) and @animated
  123.      x = @current_frame * @frame_width + @offset_x
  124.      self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
  125.        @current_frame = (@current_frame + 1) unless @frames == 0
  126.        @animated = false if @current_frame == @frames and @once
  127.        @current_frame %= @frames
  128.    end
  129. end
  130.   
  131. #--------------------------------------------------------------------------
  132. # - Move the sprite
  133. #   x : X coordinate of the destination point
  134. #   y : Y coordinate of the destination point
  135. #   speed : Speed of movement (0 = delayed, 1+ = faster)
  136. #   delay : Movement delay if speed is at 0
  137. #--------------------------------------------------------------------------
  138. def move(x, y, speed = 1, delay = 0)
  139.    @destx = x
  140.    @desty = y
  141.    @move_speed = speed
  142.    @move_delay = delay
  143.    @move_old = Graphics.frame_count
  144.    @moving = true
  145. end
  146.   
  147. #--------------------------------------------------------------------------
  148. # - Move sprite to destx and desty
  149. #--------------------------------------------------------------------------
  150. def update_move
  151.    return unless @moving
  152.    movinc = @move_speed == 0 ? 1 : @move_speed
  153.    if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
  154.      self.x += movinc if self.x < @destx
  155.      self.x -= movinc if self.x > @destx
  156.      self.y += movinc if self.y < @desty
  157.      self.y -= movinc if self.y > @desty
  158.      @move_old = Graphics.frame_count
  159.    end
  160.    if @move_speed > 1  # Check if sprite can't reach that point
  161.      self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
  162.                         (@destx - self.x).abs <= @move_speed
  163.      self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
  164.                         (@desty - self.y).abs <= @move_speed
  165.    end
  166.    if self.x == @destx and self.y == @desty
  167.      @moving = false
  168.    end
  169. end
  170.   
  171. #--------------------------------------------------------------------------
  172. # - Pause animation, but still updates movement
  173. #   frames : Number of frames
  174. #--------------------------------------------------------------------------
  175. def delay(frames)
  176.    update_move
  177.    if (Graphics.frame_count - @old >= frames)
  178.      @old = Graphics.frame_count
  179.      return true
  180.    end
  181.    return false
  182. end
  183. end

  184. #=============================================================================
  185. #
  186. # here we go...
  187. # this makes the scrîpt very easy to implement
  188. # just add a new scrîpt above the "Main" scrîpt
  189. # and insert this whole thing in there
  190. #
  191. # as you can see the sprite changing code is from the japanese scrîpt
  192. # so the credits for the sprite changin goes to them....
  193. # i edit it a little so it can show more sprites and sprite animations
  194. # and added some other stuff... the next things are player movement...
  195. #
  196. #
  197. #
  198. # i got the battler changing scrîpt in this scrîpt...
  199. # the credits for this goes to the guy who made this...
  200. #
  201. # ▼▲▼ XRXS11. 戦闘・バトラーモーション ver.0 ▼▲▼
  202. #
  203. # since this isnt used anymore... it isnt need for credit anymore...
  204. # but i'll let it here since it helped me a lot...
  205. #
  206. #
  207. # as for the ideas... missy provided me with really good ideas
  208. # that helped me alot when i didnt find a way to some of these features...
  209. #
  210. # here one more Credit to place...
  211. # its RPG's scrîpt...
  212. # not the whole thing here...
  213. # but some snipplet you'll know witch one when read the comments
  214. #
  215. #
  216. # if you want some more explaines about this scrîpt...
  217. # the most stuff are commented... but if you still have questions or
  218. # sugestions then you can contact me
  219. #
  220. # how or where you can contact me...
  221. # at the http://www.rmxp.net forum via pm, email: [email protected]
  222. # or via AIM: cych4n or ICQ: 73130840
  223. #
  224. # remember this is still in testing phase...
  225. # and i'm trying to work on some other additions... like character movements...
  226. # but that wont be added now... couse i need to figure it out first...
  227. #
  228. #
  229. #
  230. # oh hehe.... before i forget...
  231. # sorry for the bad english... ^-^''''
  232. #
  233. #
  234. #==============================================================================
  235. #
  236. # here i'm going to tell you what names you need to give for your chara
  237. # battle sprites....
  238. #
  239. # ok... here... since i'm using RPG's movement scrîpt...
  240. # there are a lot of changes...
  241. #
  242. # when you look at the scrîpt you'll find line with "pose(n)" or "enemy_pose(n)"
  243. # since i want my sprites have different sprites... i added one more option
  244. # to these...
  245. # so now if you add a number after the n (the n stands for witch sprite is used)
  246. # fo example 8... ("pose(4, 8)") this will tell the scrîpt that the 4th animation
  247. # have 8 frames...
  248. # pose is used for the player... and enemy_pose for the enemy...
  249. # there is nothing more to this...
  250. # i used my old sprite numbers... (this time in only one sprite...)
  251. #
  252. # explains about the animation sprites... (the digits)
  253. #
  254. #
  255. # 0 = move (during battle)
  256. # 1 = standby
  257. # 2 = defend
  258. # 3 = hit (being attacked)
  259. # 4 = attack
  260. # 5 = skill use
  261. # 6 = dead
  262. # 7 = winning pose... this idea is from RPG....
  263. #
  264. #
  265. # of course this is just the begining of the code...
  266. # so more animations can be implemented...
  267. # but for now this should be enough...
  268. #
  269. # alot has changed here... and now it looks like it is done...
  270. # of course the fine edit needs to be done so it looks and works great with your
  271. # game too...
  272. #
  273. #
  274. #
  275. # 1st character movement...                             done
  276. # 2nd character movement during attack...               done
  277. # 3rd character apears at the enemy while attacking...  done
  278. #
  279. # 4th enemies movement...                               done
  280. # 5th enemy movement during attack...                   done
  281. # 6th enemy apears at the enemy while attacking...      done
  282. #
  283. # 7th each weapon has its own animation...              done
  284. # 8th each skill has its own animation...               done
  285. #
  286. #
  287. #
  288. # for the ones interisted... my nex project is an Movie player
  289. # (that actualy plays avi, mpgs and such...
  290. # but dont think this will be done soon... ^-^''
  291. #
  292. # but i'll may be try something else before i begin to code that one...
  293. #==============================================================================



  294. class Game_Actor < Game_Battler
  295.   
  296. # you dont have to change your game actor to let the characters schows
  297. # from the side...
  298. # this will do it for you... ^-^

  299. def screen_x
  300.    if self.index != nil
  301.      return self.index * 30 + 430
  302.    else
  303.      return 0
  304.    end
  305. end

  306. def screen_y
  307.    return self.index * 30 + 250
  308. end
  309.   
  310. def screen_z
  311.    if self.index != nil
  312.      return self.index
  313.    else
  314.      return 0
  315.    end
  316. end
  317. end


  318. # RPG's snipplet...
  319. class Spriteset_Battle
  320. attr_accessor :actor_sprites
  321. attr_accessor :enemy_sprites
  322.   
  323.   
  324. alias original_initialize initialize
  325. def initialize
  326.    #@start_party_number = $game_party.actors.size
  327.    # ビューポートを作成
  328.    @viewport0 = Viewport.new(0, 0, 640, 480)
  329.    @viewport1 = Viewport.new(0, 0, 640, 320)
  330.    @viewport2 = Viewport.new(0, 0, 640, 480)
  331.    @viewport3 = Viewport.new(0, 0, 640, 480)
  332.    @viewport4 = Viewport.new(0, 0, 640, 480)
  333.    @viewport1.z = 50
  334.    @viewport2.z = 50
  335.    @viewport3.z = 200
  336.    @viewport4.z = 5000

  337.    @battleback_sprite = Sprite.new(@viewport0)
  338.    
  339.    @enemy_sprites = []
  340.    for enemy in $game_troop.enemies #.reverse
  341.      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  342.    end
  343.    
  344.    @actor_sprites = []
  345.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[0]))
  346.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[1]))
  347.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[2]))
  348.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[3]))
  349.    
  350.    @weather = RPG::Weather.new(@viewport1)
  351.    @picture_sprites = []
  352.    for i in 51..100
  353.      @picture_sprites.push(Sprite_Picture.new(@viewport3,
  354.        $game_screen.pictures[i]))
  355.    end
  356.    @timer_sprite = Sprite_Timer.new
  357.    update
  358. end
  359.   
  360.   
  361.   
  362. alias original_update update
  363. def update
  364.    @viewport1.z = 50 and @viewport2.z = 51 if $actor_on_top == true
  365.    @viewport1.z = 51 and @viewport2.z = 50 if $actor_on_top == false
  366.     # 刷新角色的活动块 (对应角色的替换)
  367.     @actor_sprites[0].battler = $game_party.actors[0]
  368.     @actor_sprites[1].battler = $game_party.actors[1]
  369.     @actor_sprites[2].battler = $game_party.actors[2]
  370.     @actor_sprites[3].battler = $game_party.actors[3]
  371.     # 战斗背景的文件名与现在情况有差异的情况下
  372.     if @battleback_name != $game_temp.battleback_name
  373.       @battleback_name = $game_temp.battleback_name
  374.       if @battleback_sprite.bitmap != nil
  375.         @battleback_sprite.bitmap.dispose
  376.       end
  377.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  378.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  379.     end
  380.     # 刷新战斗者的活动块
  381.     for sprite in @enemy_sprites + @actor_sprites
  382.       sprite.update
  383.     end
  384.     # 刷新天气图形
  385.     @weather.type = $game_screen.weather_type
  386.     @weather.max = $game_screen.weather_max
  387.     @weather.update
  388.     # 刷新图片活动块
  389.     for sprite in @picture_sprites
  390.       sprite.update
  391.     end
  392.     # 刷新计时器活动块
  393.     @timer_sprite.update
  394.     # 设置画面的色调与震动位置
  395.     @viewport1.tone = $game_screen.tone
  396.     @viewport1.ox = $game_screen.shake
  397.     # 设置画面的闪烁色
  398.     @viewport4.color = $game_screen.flash_color
  399.     # 刷新显示端口
  400.     @viewport1.update
  401.     @viewport2.update
  402.     @viewport4.update
  403. end
  404. end
  405. # end

  406. #==============================================================================
  407. # Sprite Battler for the Costum Battle System
  408. #==============================================================================
  409. # here we are making some animations and stuff...
  410. # i know its not the best way...
  411. # but this is the first working way that i found....
  412. # this needs propper understanding how the animation works...
  413. # if you want to change some stuff...
  414. # in this i'll not explain much couse its realy easy if you know what you do
  415. # otherwise it will take you time to understand it, but i think the one who
  416. # is trying to edit this will know what he/she do... ^-^
  417. #
  418. #
  419. #
  420. # here i'll completely replace the "Sprite_Battler" class...
  421. # so if you've changed something in there you need to change it here as well
  422. # (i think... i didnt tested it... so its up to you)
  423. # i'll mark the stuff i added just with --> #
  424. # something that need to be explained have a comment...
  425. # but its not all commented...
  426. # so if you dont know what it means or you just want to know why it is there and
  427. # what it does then you need to contact me or anyone who understand this... ^-^
  428. # how you can contact me see above... at the top of this scrîpt...


  429. class Sprite_Battler < Animated_Sprite

  430. attr_accessor :battler
  431. attr_reader   :index
  432. attr_accessor :target_index
  433. attr_accessor :frame_width

  434.   
  435. def initialize(viewport, battler = nil)
  436.    super(viewport)
  437.    [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  438.    @pattern_b = 0 #
  439.    @counter_b = 0 #
  440.    [url=home.php?mod=space&uid=370741]@Index[/url] = 0     #
  441.    if @battler != nil
  442.      tempbitmap = RPG::Cache.battler(@battler.battler_name, @battler.battler_hue)
  443.      @frame_width = tempbitmap.width/4
  444.      picturephase = @battler.picturephase
  445.      if picturephase == "66RPG"
  446.        @frame_height = tempbitmap.height/8
  447.      else
  448.        @frame_height = tempbitmap.height/8.to_i
  449.      end     
  450.    else
  451.      @frame_width, @frame_height = 1,1
  452.    end   
  453.    # start sprite
  454.    @battler.is_a?(Game_Enemy) ? enemy_pose(1) : pose(1)
  455.    @battler_visible = false
  456.    if $target_index == nil
  457.      $target_index = 0
  458.    end
  459. end
  460.   
  461. def index=(index) #
  462.    @index = index  #
  463.    update          #
  464. end               #
  465.   
  466. def dispose
  467.    if self.bitmap != nil
  468.      self.bitmap.dispose
  469.    end
  470.    super
  471. end
  472.   
  473. def enemy                                             #
  474.    $target_index += $game_troop.enemies.size
  475.    $target_index %= $game_troop.enemies.size
  476.    return $game_troop.enemies[$target_index]           #
  477. end                                                   #
  478.   
  479. def actor                                             #
  480.    $target_index += $game_party.actors.size
  481.    $target_index %= $game_party.actors.size
  482.    return $game_party.actors[$target_index]            #
  483. end            

  484. #==============================================================================
  485. # here is a snipplet from RPG's scrîpt...
  486. # i changed only to lines from this...
  487. #
  488. # here you can add more sprite poses... if you have more... ^-^
  489. #==============================================================================
  490. def pose(number, frames = 4)
  491.     case number
  492.     when 0  # run
  493.     change(frames, 5, 0, 0, 0)
  494.     when 1  # standby
  495.     change(frames, 5, 0, @frame_height)
  496.     when 2 # defend
  497.     change(frames, 5, 0, @frame_height * 2)
  498.     when 3 # Hurt, loops
  499.     change(frames, 5, 0, @frame_height * 3)
  500.     when 4 # attack no loop
  501.     change(frames, 5, 0, @frame_height * 4, 0, true)
  502.     when 5 # skill
  503.     change(frames, 5, 0, @frame_height * 5)
  504.     when 6 # death
  505.     change(frames, 5, 0, @frame_height * 6)
  506.     when 7 # winning pose
  507.     change(frames, 5, 0, @frame_height * 7)
  508.     when 8 # no sprite
  509.     change(frames, 5, 0, @frame_height * 8)
  510.     when 9 # no sprite
  511.     change(frames, 5, 0, @frame_height * 9)
  512.     when 10 # no sprite
  513.     change(frames, 5, 0, @frame_height * 10)
  514.     when 11 # no sprite
  515.     change(frames, 5, 0, @frame_height * 11)
  516.     when 12 # no sprite
  517.     change(frames, 5, 0, @frame_height * 12)
  518.     when 13 # no sprite
  519.     change(frames, 5, 0, @frame_height * 13)
  520.     when 14 # no sprite
  521.     change(frames, 5, 0, @frame_height * 14)
  522.     when 15 # no sprite
  523.     change(frames, 5, 0, @frame_height * 15)
  524.     when 16 # no sprite
  525.     change(frames, 5, 0, @frame_height * 16)
  526.     when 17 # no sprite
  527.     change(frames, 5, 0, @frame_height * 17)
  528.     when 18 # no sprite
  529.     change(frames, 5, 0, @frame_height * 18)
  530.     when 19 # no sprite
  531.     change(frames, 5, 0, @frame_height * 19)
  532.     when 20 # no sprite
  533.     change(frames, 5, 0, @frame_height * 20)
  534.     # ...etc.
  535.    else
  536.      change(frames, 5, 0, @frame_height * number, 0)
  537.    end
  538. end
  539.   
  540. #--------------------------------------------------------------------------
  541. # - Change the battle pose for an enemy
  542. #   number : pose' number
  543. #--------------------------------------------------------------------------
  544. def enemy_pose(number ,enemy_frames = 4)
  545.    case number
  546.    when 0  # run
  547.      change(enemy_frames, 5, 0, 0, 0)
  548.    when 1  # standby
  549.      change(enemy_frames, 5, 0, @frame_height)
  550.    when 2 # defend
  551.      change(enemy_frames, 5, 0, @frame_height * 2)
  552.    when 3 # Hurt, loops
  553.      change(enemy_frames, 5, 0, @frame_height * 3)
  554.    when 4 # attack
  555.      change(enemy_frames, 5, 0, @frame_height * 4, 0, true)
  556.    when 5 # skill
  557.      change(enemy_frames, 5, 0, @frame_height * 5)
  558.    when 6 # death
  559.      change(enemy_frames, 5, 0, @frame_height * 6)
  560.    when 7 # no sprite
  561.      change(enemy_frames, 5, 0, @frame_height * 7)
  562.      # ...etc.
  563.    else
  564.      change(enemy_frames, 5, 0, @frame_height * number, 0)
  565.    end
  566. end
  567. #==============================================================================
  568. # sniplet end...
  569. #==============================================================================  
  570.   
  571.   
  572. def update
  573.    super
  574.    
  575.    if @battler == nil                                                      
  576.      self.bitmap = nil                                                      
  577.      loop_animation(nil)                                                   
  578.      return                                                               
  579.    end                                                                     
  580.    if @battler.battler_name != @battler_name or
  581.       @battler.battler_hue != @battler_hue

  582.      @battler_name = @battler.battler_name
  583.      @battler_hue = @battler.battler_hue
  584.      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  585.      @width = bitmap.width
  586.      [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  587.      self.ox = @frame_width / 2
  588.      self.oy = @frame_height

  589.      if @battler.dead? or @battler.hidden
  590.        self.opacity = 0
  591.      end
  592.      self.x =  @battler.screen_x
  593.      self.y =  @battler.screen_y
  594.      self.z = @battler.screen_z
  595.    end

  596.    if @battler.damage == nil and
  597.       @battler.state_animation_id != @state_animation_id
  598.      @state_animation_id = @battler.state_animation_id
  599.      loop_animation($data_animations[@state_animation_id])
  600.    end

  601.    if @battler.is_a?(Game_Actor) and @battler_visible
  602.      if $game_temp.battle_main_phase
  603.        self.opacity += 3 if self.opacity < 255
  604.      else
  605.        self.opacity -= 3 if self.opacity > 207
  606.      end
  607.    end

  608.    if @battler.blink
  609.      blink_on
  610.    else
  611.      blink_off
  612.    end

  613.    unless @battler_visible
  614.      if not @battler.hidden and not @battler.dead? and
  615.         (@battler.damage == nil or @battler.damage_pop)
  616.        appear
  617.        @battler_visible = true
  618.      end
  619.      if not @battler.hidden and
  620.         (@battler.damage == nil or @battler.damage_pop) and
  621.         @battler.is_a?(Game_Actor)
  622.        appear
  623.        @battler_visible = true
  624.      end
  625.    end
  626.    if @battler_visible
  627.      if @battler.hidden
  628.        $game_system.se_play($data_system.escape_se)
  629.        escape
  630.        @battler_visible = false
  631.      end
  632.      if @battler.white_flash
  633.        whiten
  634.        @battler.white_flash = false
  635.      end
  636.      if @battler.animation_id != 0
  637.        animation = $data_animations[@battler.animation_id]
  638.        animation(animation, @battler.animation_hit)
  639.        @battler.animation_id = 0
  640.      end
  641.      if @battler.damage_pop
  642.        damage(@battler.damage, @battler.critical)
  643.        @battler.damage = nil
  644.        @battler.critical = false
  645.        @battler.damage_pop = false
  646.      end
  647.      if @battler.damage == nil and @battler.dead?
  648.        if @battler.is_a?(Game_Enemy)
  649.          $game_system.se_play($data_system.enemy_collapse_se)
  650.          collapse
  651.          @battler_visible = false
  652.        else
  653.          $game_system.se_play($data_system.actor_collapse_se) unless @dead
  654.          @dead = true
  655.          pose(6)
  656.        end
  657.      else
  658.        @dead = false
  659.      end
  660.    end                                                                #
  661. end
  662. end


  663. #==============================================================================
  664. # Scene_Battle Costum  Battle System
  665. #==============================================================================

  666. class Scene_Battle
  667.   
  668.   
  669. def update_phase4
  670.    case @phase4_step
  671.    when 1
  672.      update_phase4_step1
  673.    when 2
  674.      update_phase4_step2
  675.    when 3
  676.      update_phase4_step3
  677.    when 4
  678.      update_phase4_step4
  679.    when 5
  680.      update_phase4_step5
  681.    when 6
  682.      update_phase4_step6
  683.    when 7
  684.      update_phase4_step7
  685.    when 8
  686.     update_phase4_step8   
  687.    end
  688. end
  689.   
  690.   
  691. def make_basic_action_result
  692.    
  693.    if @active_battler.is_a?(Game_Actor)
  694.      $actor_on_top = true
  695.    elsif @active_battler.is_a?(Game_Enemy)
  696.      $actor_on_top = false
  697.    end
  698.    
  699.    if @active_battler.current_action.basic == 0
  700. #============================================================================
  701. # WEAPONS START...
  702. #============================================================================
  703. #
  704. #================================= Different Weapons with different animations
  705. #
  706. # this is quite simple as you can see...
  707. # if you want to add a weapon to the animation list then look at the scrîpt below...
  708. # and i hope you'll find out how this works...
  709. #
  710. #
  711. # if not...
  712. # here is the way...
  713. # first thing...
  714. # just copy and paste "elseif @active_battler_enemy.weapon_id == ID..."
  715. # just after the last @weapon_sprite....
  716. #
  717. # here the ID is you need to look in you game databse the number that stands before
  718. # your weapon name is the ID you need to input here...
  719. #
  720. # same thing goes for the monster party... ^-^
  721. # monster normaly dont need more sprites for weapons....
  722. #
  723. # if you want to use more... then replace the "@weapon_sprite_enemy = 4"
  724. # with these lines... (but you need to edit them)
  725. #
  726. #        if @active_battler.weapon_id == 1 # <--  weapon ID number
  727. #          @weapon_sprite_enemy = 4 # <-- battle animation
  728. #        elsif @active_battler.weapon_id == 5 # <-- weapon ID number
  729. #          @weapon_sprite_enemy = 2 # <-- battle animation
  730. #        elsif @active_battler.weapon_id == 9 # <-- weapon ID number
  731. #          @weapon_sprite_enemy = 0 # <-- battle animation
  732. #        elsif @active_battler.weapon_id == 13 # <-- weapon ID number
  733. #          @weapon_sprite_enemy = 6 # <-- battle animation
  734. #        else
  735. #          @weapon_sprite_enemy = 4
  736. #        end
  737. #
  738. #================================= END

  739.      if @active_battler.is_a?(Game_Actor)
  740.        if $data_weapons[@active_battler.weapon_id] == nil
  741.          @weapon_sprite = 4
  742.        else
  743.          if $data_weapons[@active_battler.weapon_id].name2 == nil or
  744.            $data_weapons[@active_battler.weapon_id].name2 == ""
  745.            @weapon_sprite = 4
  746.          else
  747.            @weapon_sprite = $data_weapons[@active_battler.weapon_id].name2.to_i
  748.          end
  749.        end
  750.         
  751. # monster section is here... ^-^

  752.      else # @active_battler.is_a?(Game_Enemy)
  753.          @weapon_sprite_enemy = 4
  754.      end
  755.         
  756. #
  757. #=============================================================================
  758. # WEAPONS END....
  759. #=============================================================================
  760.       
  761.       
  762.      @animation1_id = @active_battler.animation1_id
  763.      @animation2_id = @active_battler.animation2_id
  764.      if @active_battler.is_a?(Game_Enemy)
  765.        if @active_battler.restriction == 3
  766.          target = $game_troop.random_target_enemy
  767.        elsif @active_battler.restriction == 2
  768.          target = $game_party.random_target_actor
  769.        else
  770.          index = @active_battler.current_action.target_index
  771.          target = $game_party.smooth_target_actor(index)
  772.        end
  773. #======== here is the setting for the movement & animation...
  774.          x = target.screen_x - RPG::Cache.battler(@active_battler.battler_name, @active_battler.battler_hue).width/6
  775.          @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
  776.          @spriteset.enemy_sprites[@active_battler.index].move(x, target.screen_y, 10)
  777. #========= here if you look at the RPG's movement settings you'll see
  778. #========= that he takes the number 40 for the speed of the animation...
  779. #========= i thing thats too fast so i settet it down to 10 so looks smoother...
  780.      end
  781.      if @active_battler.is_a?(Game_Actor)
  782.        if @active_battler.restriction == 3
  783.          target = $game_party.random_target_actor
  784.        elsif @active_battler.restriction == 2
  785.          target = $game_troop.random_target_enemy
  786.        else
  787.          index = @active_battler.current_action.target_index
  788.          target = $game_troop.smooth_target_enemy(index)
  789.        end
  790. #======= the same thing for the player... ^-^
  791.        x = target.screen_x + RPG::Cache.battler(@active_battler.battler_name, @active_battler.battler_hue).width/8
  792.        @spriteset.actor_sprites[@active_battler.index].pose(0)
  793.        @spriteset.actor_sprites[@active_battler.index].move(x, target.screen_y, 10)
  794.      end
  795.      @target_battlers = [target]
  796.      for target in @target_battlers
  797.        target.attack_effect(@active_battler)
  798.      end
  799.      return
  800.    end
  801.    if @active_battler.current_action.basic == 1
  802.      if @active_battler.is_a?(Game_Actor)
  803.        @spriteset.actor_sprites[@active_battler.index].pose(2) #defence
  804.      else
  805.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(2) #defence
  806.      end
  807.      @help_window.set_text($data_system.words.guard, 1)
  808.      return
  809.    end
  810.    if @active_battler.is_a?(Game_Enemy) and
  811.       @active_battler.current_action.basic == 2
  812.      @help_window.set_text("逃走", 1)
  813.      @active_battler.escape
  814.      return
  815.    end
  816.    if @active_battler.current_action.basic == 3
  817.      $game_temp.forcing_battler = nil
  818.      @phase4_step = 1
  819.      return
  820.    end
  821.    
  822.    if @active_battler.current_action.basic == 4
  823.      if $game_temp.battle_can_escape == false
  824.        $game_system.se_play($data_system.buzzer_se)
  825.        return
  826.      end
  827.      $game_system.se_play($data_system.decision_se)
  828.      update_phase2_escape
  829.      return
  830.    end
  831. end
  832. #--------------------------------------------------------------------------
  833. # skill aktion...
  834. #--------------------------------------------------------------------------
  835. def make_skill_action_result
  836.    @skill = $data_skills[@active_battler.current_action.skill_id]
  837.    unless @active_battler.current_action.forcing
  838.      unless @active_battler.skill_can_use?(@skill.id)
  839.        $game_temp.forcing_battler = nil
  840.        @phase4_step = 1
  841.        return
  842.      end
  843.    end
  844.    @active_battler.sp -= @skill.sp_cost
  845.    @status_window.refresh
  846.    @help_window.set_text(@skill.name, 1)
  847.    
  848. #=============================================================================
  849. # SKILL SPRITES START
  850. #=============================================================================
  851. # this one is the same as the one for the weapons...
  852. # for the one who have this for the first time
  853. # look at the scrîpt i hope it is easy to understand...
  854. #
  855. # the other one that have the earlier versions of this scrîpt they dont need explenation
  856. # ... i think....
  857. # the think that changed is the line where the animation ID is given to the sprite...
  858. # the number after the "pose" is the animation ID... it goes for every other animation as well..
  859. # if you have an animation for a skill that have more frames...
  860. # then just insert the number of frames after the first number...
  861. # so it looks like this.... "pose(5, 8)" <-- 5 is the animation...
  862. # 8 is the max frame (that means your animation have 8 frames...) ^-^
  863.    
  864.    if @active_battler.is_a?(Game_Actor)
  865.      if @skill.name != "one of the skills" # <--skill doesn't exist => all the skills have the skill animation!
  866.        @spriteset.actor_sprites[@active_battler.index].pose(5) # <-- sprite number
  867.      end
  868.    else
  869.      if @skill.name != "one of the skills" # <-- first skill name
  870.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(5) # <-- sprite number
  871.      end
  872.    end
  873. #=============================================================================
  874. # SKILL SPRITES END
  875. #=============================================================================
  876.    
  877.    @animation1_id = @skill.animation1_id
  878.    @animation2_id = @skill.animation2_id
  879.    @common_event_id = @skill.common_event_id
  880.    set_target_battlers(@skill.scope)
  881.    for target in @target_battlers
  882.      target.skill_effect(@active_battler, @skill)
  883.    end
  884. end
  885. #--------------------------------------------------------------------------
  886. # how here we make the item use aktions
  887. #--------------------------------------------------------------------------
  888. def make_item_action_result
  889.    # sorry i didnt work on this...
  890.    # couse i dont have a sprite that uses items....
  891.    # so i just added the standby sprite here...
  892.    # when i get more time for this i'll try what i can do for this one... ^-^
  893.    # its the same as the ones above...
  894.    if @active_battler.is_a?(Game_Actor)
  895.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  896.    else
  897.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  898.    end
  899.    
  900.    @item = $data_items[@active_battler.current_action.item_id]
  901.    unless $game_party.item_can_use?(@item.id)
  902.      @phase4_step = 1
  903.      return
  904.    end
  905.    if @item.consumable
  906.      $game_party.lose_item(@item.id, 1)
  907.    end
  908.    @help_window.set_text(@item.name, 1)
  909.    @animation1_id = @item.animation1_id
  910.    @animation2_id = @item.animation2_id
  911.    @common_event_id = @item.common_event_id
  912.    index = @active_battler.current_action.target_index
  913.    target = $game_party.smooth_target_actor(index)
  914.    set_target_battlers(@item.scope)
  915.    for target in @target_battlers
  916.      target.item_effect(@item)
  917.    end
  918. end
  919.   
  920. #==============================================================================
  921. # here again.... snipplet from RPG's scrîpt
  922. #==============================================================================


  923. # this one here is for the winning pose...
  924. # if you happen to use my old costum level scrîpt then you need to add the
  925. # marked line to you "def start_phase5" in  "Scene_Battle 2" and delete this one...
  926. # the ->  =*****=
  927. # marks the end where you need to delete...
  928. # and -> {=====}
  929. # marks the line you need to copy and paste in the other one...
  930. # you need to add it at the same position...

  931. def start_phase5
  932.    @phase = 5
  933.    $game_system.me_play($game_system.battle_end_me)
  934.    $game_system.bgm_play($game_temp.map_bgm)
  935.    exp = 0
  936.    gold = 0
  937.    treasures = []
  938.    for enemy in $game_troop.enemies
  939.      unless enemy.hidden
  940.        exp += enemy.exp
  941.        gold += enemy.gold
  942.        if rand(100) < enemy.treasure_prob
  943.          if enemy.item_id > 0
  944.            treasures.push($data_items[enemy.item_id])
  945.          end
  946.          if enemy.weapon_id > 0
  947.            treasures.push($data_weapons[enemy.weapon_id])
  948.          end
  949.          if enemy.armor_id > 0
  950.            treasures.push($data_armors[enemy.armor_id])
  951.          end
  952.        end
  953.      end
  954.    end
  955.    treasures = treasures[0..5]
  956.    for i in 0...$game_party.actors.size
  957.      actor = $game_party.actors[i]
  958.      @spriteset.actor_sprites[i].pose(7) unless actor.dead? # {=====}
  959.      if actor.cant_get_exp? == false
  960.        last_level = actor.level
  961.        actor.exp += exp
  962.        if actor.level > last_level
  963.          @status_window.level_up(i)
  964.        end
  965.      end
  966.    end
  967.    $game_party.gain_gold(gold)
  968.    for item in treasures
  969.      case item
  970.      when RPG::Item
  971.        $game_party.gain_item(item.id, 1)
  972.      when RPG::Weapon
  973.        $game_party.gain_weapon(item.id, 1)
  974.      when RPG::Armor
  975.        $game_party.gain_armor(item.id, 1)
  976.      end
  977.    end
  978.    @result_window = Window_BattleResult.new(exp, gold, treasures)
  979.    @phase5_wait_count = 100
  980. end
  981. #   =*****=
  982. #--------------------------------------------------------------------------
  983. # updating the movement
  984. # since RPG isnt used to comments... i'll comment it again...
  985. #--------------------------------------------------------------------------
  986. def update_phase4_step3
  987.    if @active_battler.current_action.kind == 0 and
  988.       @active_battler.current_action.basic == 0
  989.       # in this one... we have our weapon animations... for player and monster
  990.      if @active_battler.is_a?(Game_Actor)
  991.        @spriteset.actor_sprites[@active_battler.index].pose(@weapon_sprite)
  992.      elsif @active_battler.is_a?(Game_Enemy)
  993.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(@weapon_sprite_enemy)
  994.      end
  995.    end
  996.    if @animation1_id == 0
  997.      @active_battler.white_flash = true
  998.    else
  999.      @active_battler.animation_id = @animation1_id
  1000.      @active_battler.animation_hit = true
  1001.    end
  1002.    @phase4_step = 4
  1003. end

  1004. def update_phase4_step4
  1005.    # this here is for the hit animation...
  1006.    for target in @target_battlers
  1007.      if target.is_a?(Game_Actor) and !@active_battler.is_a?(Game_Actor)
  1008.        if target.guarding?
  1009.          @spriteset.actor_sprites[target.index].pose(2)
  1010.        else
  1011.          @spriteset.actor_sprites[target.index].pose(3)
  1012.        end
  1013.        elsif target.is_a?(Game_Enemy) and !@active_battler.is_a?(Game_Enemy)
  1014.        if target.guarding?
  1015.          @spriteset.enemy_sprites[target.index].enemy_pose(2)
  1016.        else
  1017.          @spriteset.enemy_sprites[target.index].enemy_pose(3)
  1018.        end
  1019.      end
  1020.      target.animation_id = @animation2_id
  1021.      target.animation_hit = (target.damage != "Miss")
  1022.    end
  1023.    @wait_count = 8
  1024.    @phase4_step = 5
  1025. end

  1026. def update_phase4_step5
  1027.    if @active_battler.hp > 0 and @active_battler.slip_damage?
  1028.      @active_battler.slip_damage_effect
  1029.      @active_battler.damage_pop = true
  1030.    end

  1031.    @help_window.visible = false
  1032.    @status_window.refresh
  1033.    # here comes the guard animations....
  1034.    if @active_battler.is_a?(Game_Actor)
  1035.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  1036.    else
  1037.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1038.    end
  1039.    for target in @target_battlers
  1040.      if target.damage != nil
  1041.        target.damage_pop = true
  1042.        if @active_battler.is_a?(Game_Actor)
  1043.          @spriteset.actor_sprites[@active_battler.index].pose(1)
  1044.        else
  1045.          @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1046.        end
  1047.      end
  1048.    end
  1049.    @phase4_step = 6
  1050. end
  1051. #--------------------------------------------------------------------------
  1052. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  1053. #--------------------------------------------------------------------------
  1054. def update_phase4_step6
  1055.    
  1056.    # here we are asking if the player is dead and is a player or an enemy...
  1057.    # these lines are for the running back and standby animation....
  1058.    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
  1059.      @spriteset.actor_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
  1060.      @spriteset.actor_sprites[@active_battler.index].pose(0)
  1061.    elsif !@active_battler.dead?
  1062.      @spriteset.enemy_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
  1063.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
  1064.    end
  1065.    for target in @target_battlers
  1066.      if target.is_a?(Game_Actor) and !target.dead?
  1067.          @spriteset.actor_sprites[target.index].pose(1)
  1068.        elsif !target.dead?
  1069.          @spriteset.enemy_sprites[target.index].enemy_pose(1)
  1070.      end
  1071.    end
  1072.    $game_temp.forcing_battler = nil
  1073.    if @common_event_id > 0
  1074.      common_event = $data_common_events[@common_event_id]
  1075.      $game_system.battle_interpreter.setup(common_event.list, 0)
  1076.    end
  1077.    @phase4_step = 7
  1078. end

  1079. def update_phase4_step7
  1080.    
  1081.    # here we are asking if the player is dead and is a player or an enemy...
  1082.    # these lines are for the running back and standby animation....
  1083.    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
  1084.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  1085.    elsif !@active_battler.dead?
  1086.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1087.    end

  1088.    $game_temp.forcing_battler = nil
  1089.    if @common_event_id > 0
  1090.      common_event = $data_common_events[@common_event_id]
  1091.      $game_system.battle_interpreter.setup(common_event.list, 0)
  1092.    end
  1093.    @phase4_step = 1
  1094. end
  1095.   
  1096. # this one is an extra... without this the animation whill not work correctly...

  1097. def update
  1098.    if $game_system.battle_interpreter.running?
  1099.      $game_system.battle_interpreter.update
  1100.      if $game_temp.forcing_battler == nil
  1101.        unless $game_system.battle_interpreter.running?
  1102.          unless judge
  1103.            setup_battle_event
  1104.          end
  1105.        end
  1106.        if @phase != 5
  1107.          @status_window.refresh
  1108.        end
  1109.      end
  1110.    end
  1111.    $game_system.update
  1112.    $game_screen.update
  1113.    if $game_system.timer_working and $game_system.timer == 0
  1114.      $game_temp.battle_abort = true
  1115.    end
  1116.    @help_window.update
  1117.    @party_command_window.update
  1118.    @actor_command_window.update
  1119.    @status_window.update
  1120.    @message_window.update
  1121.    @spriteset.update
  1122.    if $game_temp.transition_processing
  1123.      $game_temp.transition_processing = false
  1124.      if $game_temp.transition_name == ""
  1125.        Graphics.transition(20)
  1126.      else
  1127.        Graphics.transition(40, "Graphics/Transitions/" +
  1128.          $game_temp.transition_name)
  1129.      end
  1130.    end
  1131.    if $game_temp.message_window_showing
  1132.      return
  1133.    end
  1134.    if @spriteset.effect?
  1135.      return
  1136.    end
  1137.    if $game_temp.gameover
  1138.      $scene = Scene_Gameover.new
  1139.      return
  1140.    end
  1141.    if $game_temp.to_title
  1142.      $scene = Scene_Title.new
  1143.      return
  1144.    end
  1145.    if $game_temp.battle_abort
  1146.      $game_system.bgm_play($game_temp.map_bgm)
  1147.      battle_end(1)
  1148.      return
  1149.    end
  1150.    if @wait_count > 0
  1151.      @wait_count -= 1
  1152.      return
  1153.    end

  1154.    # this one holds the battle while the player moves
  1155.    for actor in @spriteset.actor_sprites
  1156.      if actor.moving
  1157.        return
  1158.      end
  1159.    end
  1160.    # and this one is for the enemy...
  1161.    for enemy in @spriteset.enemy_sprites
  1162.      if enemy.moving# and $game_system.animated_enemy
  1163.        return
  1164.      end
  1165.    end
  1166.    
  1167.    if $game_temp.forcing_battler == nil and
  1168.       $game_system.battle_interpreter.running?
  1169.      return
  1170.    end
  1171.    case @phase
  1172.    when 1
  1173.      update_phase1
  1174.    when 2
  1175.      update_phase2
  1176.    when 3
  1177.      update_phase3
  1178.    when 4
  1179.      update_phase4
  1180.    when 5
  1181.      update_phase5
  1182.    end
  1183. end
  1184.   
  1185. #==============================================================================
  1186. # end of the snipplet
  1187. # if you want the comments that where here just look at the scene_battle 4...
  1188. # i added some comments since RPG hasnt add any....
  1189. #==============================================================================
  1190. end



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

本版积分规则

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

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

GMT+8, 2024-11-16 16:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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