幻想森林

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

[求助]超级横版战斗问题.

[复制链接]

42

主题

167

帖子

857

积分

⑤进阶

good job!

积分
857
QQ
发表于 2007-2-9 01:25:11 | 显示全部楼层 |阅读模式
我用的是超级横版战斗的脚本,其他方面一切正常,就是战斗结束后,不会显示得到的EXP和金钱,请问这个在哪里改.

该脚本如下:

  1. 超级横版战斗脚本简要说明:
  2. #默认情况下,把一张战斗图截成4列,>8行,如果感觉4列4帧的动画还不能满足要求,看
  3. #def pose(number,frame = 4),更改=4,以及相关部分。
  4.   
  5. #战斗图从上到下:前进图,等待图,防御图,挨打图,普通攻击图(默认的武器),施展魔法,
  6. #倒地不行了,胜利姿势,自定义武器1,自定义武器2……
  7. #这个脚本的模型是老外编写的,其中参考了XMXS的一个方法,我添加了一些功能,去掉素材限制。
  8. #不同职业拥有的图片数可以不一样,参考工程和录像教学
  9. #==============================================================================
  10. # □ RPG::Class
  11. #==============================================================================
  12. module RPG
  13.   class Class
  14.     def name
  15.       name = @name.split(/,/)[0]
  16.       return name != nil ? name : ''
  17.     end
  18.     def name2
  19.       name = @name.split(/,/)[1]
  20.       return name != nil ? name : ''
  21.     end
  22.   end
  23.   class Weapon
  24.     def name
  25.       name = @name.split(/,/)[0]
  26.       return name != nil ? name : ''
  27.     end
  28.     def name2
  29.       name = @name.split(/,/)[1]
  30.       return name != nil ? name : ''
  31.     end   
  32.   end  
  33. end
  34. class Game_Actor
  35.   #--------------------------------------------------------------------------
  36.   # ● 更改名称
  37.   #     name : 新的名称
  38.   #--------------------------------------------------------------------------
  39.   def picturephase
  40.     name = $data_classes[class_id].name2
  41.     return name != nil ? name : "66RPG"
  42.   end
  43. end
  44. class Game_Enemy
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取名称
  47.   #--------------------------------------------------------------------------
  48.   def name
  49.     name = $data_enemies[@enemy_id].name.split(/,/)[0]
  50.     return name != nil ? name : ''
  51.   end
  52.   def picturephase
  53.     name = $data_enemies[@enemy_id].name.split(/,/)[1]
  54.     return name != nil ? name : "66RPG"
  55.   end  
  56. end
  57. class Animated_Sprite < RPG::Sprite
  58. #--------------------------------------------------------------------------
  59. # - Accessible instance variables.
  60. #--------------------------------------------------------------------------
  61. attr_accessor :frames        # Number of animation frames
  62. attr_accessor :delay         # Delay time between frames (speed)
  63. attr_accessor :frame_width   # Width of each frame
  64. attr_accessor :frame_height  # Height of each frame
  65. attr_accessor :offset_x      # X coordinate of the 1st frame
  66. attr_accessor :offset_y      # Y coordinate of all frames
  67. attr_accessor :current_frame # Current animation frame
  68. attr_accessor :moving        # Is the sprite moving?
  69. #--------------------------------------------------------------------------
  70. # - Initialize an animated sprite
  71. #   viewport : Sprite viewport
  72. #--------------------------------------------------------------------------
  73. def initialize(viewport = nil)
  74.    super(viewport)
  75.    @frame_width, @frame_height = 0, 0
  76.    change    # A basic change to set initial variables
  77.    @old = Graphics.frame_count  # For the delay method
  78.    @goingup = true    # Increasing animation? (if @rm2k_mode is true)
  79.    @once = false      # Is the animation only played once?
  80.    @animated = true   # Used to stop animation when @once is true
  81. end
  82. #--------------------------------------------------------------------------
  83. # Comment by RPG
  84. #   - Change the source rect (change the animation)
  85. #   frames : Number of animation frames
  86. #   delay : Frame delay, controls animation speed
  87. #   offx : X coordinate of the 1st frame
  88. #   offy : Y coordinate of all frames
  89. #   startf : Starting frame for animation
  90. #   once : Is the animation only played once?
  91. #   rm2k_mode : Animation pattern: 1-2-3-2 if true, 1-2-3-1 if false
  92. #
  93. # Comment by cybersam
  94. #
  95. # the rm2k_mode isnt pressent anymore...
  96. # if you want that feature then use rm2k or use RPG's scrîpt...
  97. #--------------------------------------------------------------------------
  98. def change(frames = 0, delay = 0, offx = 0, offy = 0,
  99.             startf = 0, once = false)
  100.    @frames = frames
  101.    @delay = delay
  102.    @offset_x, @offset_y = offx, offy
  103.    @current_frame = startf
  104.    @once = once
  105.    x = @current_frame * @frame_width + @offset_x
  106.    self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
  107.    @goingup = true
  108.    @animated = true
  109. end
  110.   
  111. #--------------------------------------------------------------------------
  112. # - Update animation and movement
  113. #--------------------------------------------------------------------------
  114. def update
  115.    super
  116.    if self.bitmap != nil and delay(@delay) and @animated
  117.      x = @current_frame * @frame_width + @offset_x
  118.      self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
  119.        @current_frame = (@current_frame + 1) unless @frames == 0
  120.        @animated = false if @current_frame == @frames and @once
  121.        @current_frame %= @frames
  122.    end
  123. end
  124.   
  125. #--------------------------------------------------------------------------
  126. # - Move the sprite
  127. #   x : X coordinate of the destination point
  128. #   y : Y coordinate of the destination point
  129. #   speed : Speed of movement (0 = delayed, 1+ = faster)
  130. #   delay : Movement delay if speed is at 0
  131. #--------------------------------------------------------------------------
  132. def move(x, y, speed = 1, delay = 0)
  133.    @destx = x
  134.    @desty = y
  135.    @move_speed = speed
  136.    @move_delay = delay
  137.    @move_old = Graphics.frame_count
  138.    @moving = true
  139. end
  140.   
  141. #--------------------------------------------------------------------------
  142. # - Move sprite to destx and desty
  143. #--------------------------------------------------------------------------
  144. def update_move
  145.    return unless @moving
  146.    movinc = @move_speed == 0 ? 1 : @move_speed
  147.    if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
  148.      self.x += movinc if self.x < @destx
  149.      self.x -= movinc if self.x > @destx
  150.      self.y += movinc if self.y < @desty
  151.      self.y -= movinc if self.y > @desty
  152.      @move_old = Graphics.frame_count
  153.    end
  154.    if @move_speed > 1  # Check if sprite can't reach that point
  155.      self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
  156.                         (@destx - self.x).abs <= @move_speed
  157.      self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
  158.                         (@desty - self.y).abs <= @move_speed
  159.    end
  160.    if self.x == @destx and self.y == @desty
  161.      @moving = false
  162.    end
  163. end
  164.   
  165. #--------------------------------------------------------------------------
  166. # - Pause animation, but still updates movement
  167. #   frames : Number of frames
  168. #--------------------------------------------------------------------------
  169. def delay(frames)
  170.    update_move
  171.    if (Graphics.frame_count - @old >= frames)
  172.      @old = Graphics.frame_count
  173.      return true
  174.    end
  175.    return false
  176. end
  177. end
  178. #=============================================================================
  179. #
  180. # here we go...
  181. # this makes the scrîpt very easy to implement
  182. # just add a new scrîpt above the "Main" scrîpt
  183. # and insert this whole thing in there
  184. #
  185. # as you can see the sprite changing code is from the japanese scrîpt
  186. # so the credits for the sprite changin goes to them....
  187. # i edit it a little so it can show more sprites and sprite animations
  188. # and added some other stuff... the next things are player movement...
  189. #
  190. #
  191. #
  192. # i got the battler changing scrîpt in this scrîpt...
  193. # the credits for this goes to the guy who made this...
  194. #
  195. # ▼▲▼ XRXS11. 戦闘・バトラーモーション ver.0 ▼▲▼
  196. #
  197. # since this isnt used anymore... it isnt need for credit anymore...
  198. # but i'll let it here since it helped me a lot...
  199. #
  200. #
  201. # as for the ideas... missy provided me with really good ideas
  202. # that helped me alot when i didnt find a way to some of these features...
  203. #
  204. # here one more Credit to place...
  205. # its RPG's scrîpt...
  206. # not the whole thing here...
  207. # but some snipplet you'll know witch one when read the comments
  208. #
  209. #
  210. # if you want some more explaines about this scrîpt...
  211. # the most stuff are commented... but if you still have questions or
  212. # sugestions then you can contact me
  213. #
  214. # how or where you can contact me...
  215. # at the [url]http://www.rmxp.net[/url] forum via pm, email: [email]cybersam@club-anime.de[/email]
  216. # or via AIM: cych4n or ICQ: 73130840
  217. #
  218. # remember this is still in testing phase...
  219. # and i'm trying to work on some other additions... like character movements...
  220. # but that wont be added now... couse i need to figure it out first...
  221. #
  222. #
  223. #
  224. # oh hehe.... before i forget...
  225. # sorry for the bad english... ^-^''''
  226. #
  227. #
  228. #==============================================================================
  229. #
  230. # here i'm going to tell you what names you need to give for your chara
  231. # battle sprites....
  232. #
  233. # ok... here... since i'm using RPG's movement scrîpt...
  234. # there are a lot of changes...
  235. #
  236. # when you look at the scrîpt you'll find line with "pose(n)" or "enemy_pose(n)"
  237. # since i want my sprites have different sprites... i added one more option
  238. # to these...
  239. # so now if you add a number after the n (the n stands for witch sprite is used)
  240. # fo example 8... ("pose(4, 8)") this will tell the scrîpt that the 4th animation
  241. # have 8 frames...
  242. # pose is used for the player... and enemy_pose for the enemy...
  243. # there is nothing more to this...
  244. # i used my old sprite numbers... (this time in only one sprite...)
  245. #
  246. # explains about the animation sprites... (the digits)
  247. #
  248. #
  249. # 0 = move (during battle)
  250. # 1 = standby
  251. # 2 = defend
  252. # 3 = hit (being attacked)
  253. # 4 = attack
  254. # 5 = skill use
  255. # 6 = dead
  256. # 7 = winning pose... this idea is from RPG....
  257. #
  258. #
  259. # of course this is just the begining of the code...
  260. # so more animations can be implemented...
  261. # but for now this should be enough...
  262. #
  263. # alot has changed here... and now it looks like it is done...
  264. # of course the fine edit needs to be done so it looks and works great with your
  265. # game too...
  266. #
  267. #
  268. #
  269. # 1st character movement...                             done
  270. # 2nd character movement during attack...               done
  271. # 3rd character apears at the enemy while attacking...  done
  272. #
  273. # 4th enemies movement...                               done
  274. # 5th enemy movement during attack...                   done
  275. # 6th enemy apears at the enemy while attacking...      done
  276. #
  277. # 7th each weapon has its own animation...              done
  278. # 8th each skill has its own animation...               done
  279. #
  280. #
  281. #
  282. # for the ones interisted... my nex project is an Movie player
  283. # (that actualy plays avi, mpgs and such...
  284. # but dont think this will be done soon... ^-^''
  285. #
  286. # but i'll may be try something else before i begin to code that one...
  287. #==============================================================================
  288. class Game_Actor < Game_Battler
  289.   
  290. # you dont have to change your game actor to let the characters schows
  291. # from the side...
  292. # this will do it for you... ^-^
  293. def screen_x
  294.    if self.index != nil
  295.      return self.index * 30 + 430
  296.    else
  297.      return 0
  298.    end
  299. end
  300. def screen_y
  301.     case self.index
  302.     when 0
  303.       return 170
  304.     when 1
  305.       return 220
  306.     when 2
  307.       return 270
  308.     when 3
  309.       return 320
  310.     else
  311.       return 1000
  312.     end
  313.   end
  314.   
  315. def screen_z
  316.    if self.index != nil
  317.      return self.index
  318.    else
  319.      return 0
  320.    end
  321. end
  322. end
  323. # RPG's snipplet...
  324. class Spriteset_Battle
  325. attr_accessor :actor_sprites
  326. attr_accessor :enemy_sprites
  327.   
  328.   
  329. alias original_initialize initialize
  330. def initialize
  331.    #@start_party_number = $game_party.actors.size
  332.    # ビューポートを作成
  333.    @viewport0 = Viewport.new(0, 0, 640, 480)
  334.    @viewport1 = Viewport.new(0, 0, 640, 320)
  335.    @viewport2 = Viewport.new(0, 0, 640, 480)
  336.    @viewport3 = Viewport.new(0, 0, 640, 480)
  337.    @viewport4 = Viewport.new(0, 0, 640, 480)
  338.    @viewport1.z = 50
  339.    @viewport2.z = 50
  340.    @viewport3.z = 200
  341.    @viewport4.z = 5000
  342.    @battleback_sprite = Sprite.new(@viewport0)
  343.    
  344.    @enemy_sprites = []
  345.    for enemy in $game_troop.enemies #.reverse
  346.      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  347.    end
  348.    
  349.    @actor_sprites = []
  350.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[0]))
  351.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[1]))
  352.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[2]))
  353.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[3]))
  354.    
  355.    @weather = RPG::Weather.new(@viewport1)
  356.    @picture_sprites = []
  357.    for i in 51..100
  358.      @picture_sprites.push(Sprite_Picture.new(@viewport3,
  359.        $game_screen.pictures[i]))
  360.    end
  361.    @timer_sprite = Sprite_Timer.new
  362.    update
  363. end
  364.   
  365.   
  366.   
  367. alias original_update update
  368. def update
  369.    @viewport1.z = 50 and @viewport2.z = 51 if $actor_on_top == true
  370.    @viewport1.z = 51 and @viewport2.z = 50 if $actor_on_top == false
  371.     # 刷新角色的活动块 (对应角色的替换)
  372.     @actor_sprites[0].battler = $game_party.actors[0]
  373.     @actor_sprites[1].battler = $game_party.actors[1]
  374.     @actor_sprites[2].battler = $game_party.actors[2]
  375.     @actor_sprites[3].battler = $game_party.actors[3]
  376.     # 战斗背景的文件名与现在情况有差异的情况下
  377.     if @battleback_name != $game_temp.battleback_name
  378.       @battleback_name = $game_temp.battleback_name
  379.       if @battleback_sprite.bitmap != nil
  380.         @battleback_sprite.bitmap.dispose
  381.       end
  382.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  383.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  384.     end
  385.     # 刷新战斗者的活动块
  386.     for sprite in @enemy_sprites + @actor_sprites
  387.       sprite.update
  388.     end
  389.     # 刷新天气图形
  390.     @weather.type = $game_screen.weather_type
  391.     @weather.max = $game_screen.weather_max
  392.     @weather.update
  393.     # 刷新图片活动块
  394.     for sprite in @picture_sprites
  395.       sprite.update
  396.     end
  397.     # 刷新计时器活动块
  398.     @timer_sprite.update
  399.     # 设置画面的色调与震动位置
  400.     @viewport1.tone = $game_screen.tone
  401.     @viewport1.ox = $game_screen.shake
  402.     # 设置画面的闪烁色
  403.     @viewport4.color = $game_screen.flash_color
  404.     # 刷新显示端口
  405.     @viewport1.update
  406.     @viewport2.update
  407.     @viewport4.update
  408. end
  409. end
  410. # end
  411. #==============================================================================
  412. # Sprite Battler for the Costum Battle System
  413. #==============================================================================
  414. # here we are making some animations and stuff...
  415. # i know its not the best way...
  416. # but this is the first working way that i found....
  417. # this needs propper understanding how the animation works...
  418. # if you want to change some stuff...
  419. # in this i'll not explain much couse its realy easy if you know what you do
  420. # otherwise it will take you time to understand it, but i think the one who
  421. # is trying to edit this will know what he/she do... ^-^
  422. #
  423. #
  424. #
  425. # here i'll completely replace the "Sprite_Battler" class...
  426. # so if you've changed something in there you need to change it here as well
  427. # (i think... i didnt tested it... so its up to you)
  428. # i'll mark the stuff i added just with --> #
  429. # something that need to be explained have a comment...
  430. # but its not all commented...
  431. # so if you dont know what it means or you just want to know why it is there and
  432. # what it does then you need to contact me or anyone who understand this... ^-^
  433. # how you can contact me see above... at the top of this scrîpt...
  434. class Sprite_Battler < Animated_Sprite
  435. attr_accessor :battler
  436. attr_reader   :index
  437. attr_accessor :target_index
  438. attr_accessor :frame_width
  439.   
  440. def initialize(viewport, battler = nil)
  441.    super(viewport)
  442.    @battler = battler
  443.    @pattern_b = 0 #
  444.    @counter_b = 0 #
  445.    @index = 0     #
  446.    if @battler != nil
  447.      tempbitmap = RPG::Cache.battler(@battler.battler_name, @battler.battler_hue)
  448.      @frame_width = tempbitmap.width/4
  449.      picturephase = @battler.picturephase
  450.      if picturephase == "66RPG"
  451.        @frame_height = tempbitmap.height/8
  452.      else
  453.        @frame_height = tempbitmap.height/picturephase.to_i
  454.      end     
  455.    else
  456.      @frame_width, @frame_height = 1,1
  457.    end   
  458.    # start sprite
  459.    @battler.is_a?(Game_Enemy) ? enemy_pose(1) : pose(1)
  460.    @battler_visible = false
  461.    if $target_index == nil
  462.      $target_index = 0
  463.    end
  464. end
  465.   
  466. def index=(index) #
  467.    @index = index  #
  468.    update          #
  469. end               #
  470.   
  471. def dispose
  472.    if self.bitmap != nil
  473.      self.bitmap.dispose
  474.    end
  475.    super
  476. end
  477.   
  478. def enemy                                             #
  479.    $target_index += $game_troop.enemies.size
  480.    $target_index %= $game_troop.enemies.size
  481.    return $game_troop.enemies[$target_index]           #
  482. end                                                   #
  483.   
  484. def actor                                             #
  485.    $target_index += $game_party.actors.size
  486.    $target_index %= $game_party.actors.size
  487.    return $game_party.actors[$target_index]            #
  488. end            
  489. #==============================================================================
  490. # here is a snipplet from RPG's scrîpt...
  491. # i changed only to lines from this...
  492. #
  493. # here you can add more sprite poses... if you have more... ^-^
  494. #==============================================================================
  495. def pose(number, frames = 4)
  496.     case number
  497.     when 0  # run
  498.     change(frames, 5, 0, 0, 0)
  499.     when 1  # standby
  500.     change(frames, 5, 0, @frame_height)
  501.     when 2 # defend
  502.     change(frames, 5, 0, @frame_height * 2)
  503.     when 3 # Hurt, loops
  504.     change(frames, 5, 0, @frame_height * 3)
  505.     when 4 # attack no loop
  506.     change(frames, 5, 0, @frame_height * 4, 0, true)
  507.     when 5 # skill
  508.     change(frames, 5, 0, @frame_height * 5)
  509.     when 6 # death
  510.     change(frames, 5, 0, @frame_height * 6)
  511.     when 7 # winning pose
  512.     change(frames, 5, 0, @frame_height * 7)
  513.     when 8 # no sprite
  514.     change(frames, 5, 0, @frame_height * 8)
  515.     when 9 # no sprite
  516.     change(frames, 5, 0, @frame_height * 9)
  517.     when 10 # no sprite
  518.     change(frames, 5, 0, @frame_height * 10)
  519.     when 11 # no sprite
  520.     change(frames, 5, 0, @frame_height * 11)
  521.     when 12 # no sprite
  522.     change(frames, 5, 0, @frame_height * 12)
  523.     when 13 # no sprite
  524.     change(frames, 5, 0, @frame_height * 13)
  525.     when 14 # no sprite
  526.     change(frames, 5, 0, @frame_height * 14)
  527.     when 15 # no sprite
  528.     change(frames, 5, 0, @frame_height * 15)
  529.     when 16 # no sprite
  530.     change(frames, 5, 0, @frame_height * 16)
  531.     when 17 # no sprite
  532.     change(frames, 5, 0, @frame_height * 17)
  533.     when 18 # no sprite
  534.     change(frames, 5, 0, @frame_height * 18)
  535.     when 19 # no sprite
  536.     change(frames, 5, 0, @frame_height * 19)
  537.     when 20 # no sprite
  538.     change(frames, 5, 0, @frame_height * 20)
  539.     # ...etc.
  540.    else
  541.      change(frames, 5, 0, @frame_height * number, 0)
  542.    end
  543. end
  544.   
  545. #--------------------------------------------------------------------------
  546. # - Change the battle pose for an enemy
  547. #   number : pose' number
  548. #--------------------------------------------------------------------------
  549. def enemy_pose(number ,enemy_frames = 4)
  550.    case number
  551.    when 0  # run
  552.      change(enemy_frames, 5, 0, 0, 0)
  553.    when 1  # standby
  554.      change(enemy_frames, 5, 0, @frame_height)
  555.    when 2 # defend
  556.      change(enemy_frames, 5, 0, @frame_height * 2)
  557.    when 3 # Hurt, loops
  558.      change(enemy_frames, 5, 0, @frame_height * 3)
  559.    when 4 # attack
  560.      change(enemy_frames, 5, 0, @frame_height * 4, 0, true)
  561.    when 5 # skill
  562.      change(enemy_frames, 5, 0, @frame_height * 5)
  563.    when 6 # death
  564.      change(enemy_frames, 5, 0, @frame_height * 6)
  565.    when 7 # no sprite
  566.      change(enemy_frames, 5, 0, @frame_height * 7)
  567.      # ...etc.
  568.    else
  569.      change(enemy_frames, 5, 0, @frame_height * number, 0)
  570.    end
  571. end
  572. #==============================================================================
  573. # sniplet end...
  574. #==============================================================================  
  575.   
  576.   
  577. def update
  578.    super
  579.    
  580.    if @battler == nil                                                      
  581.      self.bitmap = nil                                                      
  582.      loop_animation(nil)                                                   
  583.      return                                                               
  584.    end                                                                     
  585.    if @battler.battler_name != @battler_name or
  586.       @battler.battler_hue != @battler_hue
  587.      @battler_name = @battler.battler_name
  588.      @battler_hue = @battler.battler_hue
  589.      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  590.      @width = bitmap.width
  591.      @height = bitmap.height
  592.      self.ox = @frame_width / 2
  593.      self.oy = @frame_height
  594.      if @battler.dead? or @battler.hidden
  595.        self.opacity = 0
  596.      end
  597.      self.x =  @battler.screen_x
  598.      self.y =  @battler.screen_y
  599.      self.z = @battler.screen_z
  600.    end
  601.    if @battler.damage == nil and
  602.       @battler.state_animation_id != @state_animation_id
  603.      @state_animation_id = @battler.state_animation_id
  604.      loop_animation($data_animations[@state_animation_id])
  605.    end
  606.    if @battler.is_a?(Game_Actor) and @battler_visible
  607.      if $game_temp.battle_main_phase
  608.        self.opacity += 3 if self.opacity < 255
  609.      else
  610.        self.opacity -= 3 if self.opacity > 207
  611.      end
  612.    end
  613.    if @battler.blink
  614.      blink_on
  615.    else
  616.      blink_off
  617.    end
  618.    unless @battler_visible
  619.      if not @battler.hidden and not @battler.dead? and
  620.         (@battler.damage == nil or @battler.damage_pop)
  621.        appear
  622.        @battler_visible = true
  623.      end
  624.      if not @battler.hidden and
  625.         (@battler.damage == nil or @battler.damage_pop) and
  626.         @battler.is_a?(Game_Actor)
  627.        appear
  628.        @battler_visible = true
  629.      end
  630.    end
  631.    if @battler_visible
  632.      if @battler.hidden
  633.        $game_system.se_play($data_system.escape_se)
  634.        escape
  635.        @battler_visible = false
  636.      end
  637.      if @battler.white_flash
  638.        whiten
  639.        @battler.white_flash = false
  640.      end
  641.      if @battler.animation_id != 0
  642.        animation = $data_animations[@battler.animation_id]
  643.        animation(animation, @battler.animation_hit)
  644.        @battler.animation_id = 0
  645.      end
  646.      if @battler.damage_pop
  647.        damage(@battler.damage, @battler.critical)
  648.        @battler.damage = nil
  649.        @battler.critical = false
  650.        @battler.damage_pop = false
  651.      end
  652.      if @battler.damage == nil and @battler.dead?
  653.        if @battler.is_a?(Game_Enemy)
  654.          $game_system.se_play($data_system.enemy_collapse_se)
  655.          collapse
  656.          @battler_visible = false
  657.        else
  658.          $game_system.se_play($data_system.actor_collapse_se) unless @dead
  659.          @dead = true
  660.          pose(6)
  661.        end
  662.      else
  663.        @dead = false
  664.      end
  665.    end                                                                #
  666. end
  667. end
  668. #==============================================================================
  669. # Scene_Battle Costum  Battle System
  670. #==============================================================================
  671. class Scene_Battle
  672.   
  673.   
  674. def update_phase4
  675.    case @phase4_step
  676.    when 1
  677.      update_phase4_step1
  678.    when 2
  679.      update_phase4_step2
  680.    when 3
  681.      update_phase4_step3
  682.    when 4
  683.      update_phase4_step4
  684.    when 5
  685.      update_phase4_step5
  686.    when 6
  687.      update_phase4_step6
  688.    when 7
  689.      update_phase4_step7
  690.    when 8
  691.     update_phase4_step8   
  692.    end
  693. end
  694.   
  695.   
  696. def make_basic_action_result
  697.    
  698.    if @active_battler.is_a?(Game_Actor)
  699.      $actor_on_top = true
  700.    elsif @active_battler.is_a?(Game_Enemy)
  701.      $actor_on_top = false
  702.    end
  703.    
  704.    if @active_battler.current_action.basic == 0
  705. #============================================================================
  706. # WEAPONS START...
  707. #============================================================================
  708. #
  709. #================================= Different Weapons with different animations
  710. #
  711. # this is quite simple as you can see...
  712. # if you want to add a weapon to the animation list then look at the scrîpt below...
  713. # and i hope you'll find out how this works...
  714. #
  715. #
  716. # if not...
  717. # here is the way...
  718. # first thing...
  719. # just copy and paste "elseif @active_battler_enemy.weapon_id == ID..."
  720. # just after the last @weapon_sprite....
  721. #
  722. # here the ID is you need to look in you game databse the number that stands before
  723. # your weapon name is the ID you need to input here...
  724. #
  725. # same thing goes for the monster party... ^-^
  726. # monster normaly dont need more sprites for weapons....
  727. #
  728. # if you want to use more... then replace the "@weapon_sprite_enemy = 4"
  729. # with these lines... (but you need to edit them)
  730. #
  731. #        if @active_battler.weapon_id == 1 # <--  weapon ID number
  732. #          @weapon_sprite_enemy = 4 # <-- battle animation
  733. #        elsif @active_battler.weapon_id == 5 # <-- weapon ID number
  734. #          @weapon_sprite_enemy = 2 # <-- battle animation
  735. #        elsif @active_battler.weapon_id == 9 # <-- weapon ID number
  736. #          @weapon_sprite_enemy = 0 # <-- battle animation
  737. #        elsif @active_battler.weapon_id == 13 # <-- weapon ID number
  738. #          @weapon_sprite_enemy = 6 # <-- battle animation
  739. #        else
  740. #          @weapon_sprite_enemy = 4
  741. #        end
  742. #
  743. #================================= END
  744.      if @active_battler.is_a?(Game_Actor)
  745.        if $data_weapons[@active_battler.weapon_id] == nil
  746.          @weapon_sprite = 4
  747.        else
  748.          if $data_weapons[@active_battler.weapon_id].name2 == nil or
  749.            $data_weapons[@active_battler.weapon_id].name2 == ""
  750.            @weapon_sprite = 4
  751.          else
  752.            @weapon_sprite = $data_weapons[@active_battler.weapon_id].name2.to_i
  753.          end
  754.        end
  755.         
  756. # monster section is here... ^-^
  757.      else # @active_battler.is_a?(Game_Enemy)
  758.          @weapon_sprite_enemy = 4
  759.      end
  760.         
  761. #
  762. #=============================================================================
  763. # WEAPONS END....
  764. #=============================================================================
  765.       
  766.       
  767.      @animation1_id = @active_battler.animation1_id
  768.      @animation2_id = @active_battler.animation2_id
  769.      if @active_battler.is_a?(Game_Enemy)
  770.        if @active_battler.restriction == 3
  771.          target = $game_troop.random_target_enemy
  772.        elsif @active_battler.restriction == 2
  773.          target = $game_party.random_target_actor
  774.        else
  775.          index = @active_battler.current_action.target_index
  776.          target = $game_party.smooth_target_actor(index)
  777.        end
  778. #======== here is the setting for the movement & animation...
  779.          x = target.screen_x - RPG::Cache.battler(@active_battler.battler_name, @active_battler.battler_hue).width/6
  780.          @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
  781.          @spriteset.enemy_sprites[@active_battler.index].move(x, target.screen_y, 10)
  782. #========= here if you look at the RPG's movement settings you'll see
  783. #========= that he takes the number 40 for the speed of the animation...
  784. #========= i thing thats too fast so i settet it down to 10 so looks smoother...
  785.      end
  786.      if @active_battler.is_a?(Game_Actor)
  787.        if @active_battler.restriction == 3
  788.          target = $game_party.random_target_actor
  789.        elsif @active_battler.restriction == 2
  790.          target = $game_troop.random_target_enemy
  791.        else
  792.          index = @active_battler.current_action.target_index
  793.          target = $game_troop.smooth_target_enemy(index)
  794.        end
  795. #======= the same thing for the player... ^-^
  796.        x = target.screen_x + RPG::Cache.battler(@active_battler.battler_name, @active_battler.battler_hue).width/8
  797.        @spriteset.actor_sprites[@active_battler.index].pose(0)
  798.        @spriteset.actor_sprites[@active_battler.index].move(x, target.screen_y, 10)
  799.      end
  800.      @target_battlers = [target]
  801.      for target in @target_battlers
  802.        target.attack_effect(@active_battler)
  803.      end
  804.      return
  805.    end
  806.    if @active_battler.current_action.basic == 1
  807.      if @active_battler.is_a?(Game_Actor)
  808.        @spriteset.actor_sprites[@active_battler.index].pose(2) #defence
  809.      else
  810.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(2) #defence
  811.      end
  812.      @help_window.set_text($data_system.words.guard, 1)
  813.      return
  814.    end
  815.    if @active_battler.is_a?(Game_Enemy) and
  816.       @active_battler.current_action.basic == 2
  817.      @help_window.set_text("逃走", 1)
  818.      @active_battler.escape
  819.      return
  820.    end
  821.    if @active_battler.current_action.basic == 3
  822.      $game_temp.forcing_battler = nil
  823.      @phase4_step = 1
  824.      return
  825.    end
  826.    
  827.    if @active_battler.current_action.basic == 4
  828.      if $game_temp.battle_can_escape == false
  829.        $game_system.se_play($data_system.buzzer_se)
  830.        return
  831.      end
  832.      $game_system.se_play($data_system.decision_se)
  833.      update_phase2_escape
  834.      return
  835.    end
  836. end
  837. #--------------------------------------------------------------------------
  838. # skill aktion...
  839. #--------------------------------------------------------------------------
  840. def make_skill_action_result
  841.    @skill = $data_skills[@active_battler.current_action.skill_id]
  842.    unless @active_battler.current_action.forcing
  843.      unless @active_battler.skill_can_use?(@skill.id)
  844.        $game_temp.forcing_battler = nil
  845.        @phase4_step = 1
  846.        return
  847.      end
  848.    end
  849.    @active_battler.sp -= @skill.sp_cost
  850.    @status_window.refresh
  851.    @help_window.set_text(@skill.name, 1)
  852.    
  853. #=============================================================================
  854. # SKILL SPRITES START
  855. #=============================================================================
  856. # this one is the same as the one for the weapons...
  857. # for the one who have this for the first time
  858. # look at the scrîpt i hope it is easy to understand...
  859. #
  860. # the other one that have the earlier versions of this scrîpt they dont need explenation
  861. # ... i think....
  862. # the think that changed is the line where the animation ID is given to the sprite...
  863. # the number after the "pose" is the animation ID... it goes for every other animation as well..
  864. # if you have an animation for a skill that have more frames...
  865. # then just insert the number of frames after the first number...
  866. # so it looks like this.... "pose(5, 8)" <-- 5 is the animation...
  867. # 8 is the max frame (that means your animation have 8 frames...) ^-^
  868.    
  869.    if @active_battler.is_a?(Game_Actor)
  870.      if @skill.name != "one of the skills" # <--skill doesn't exist => all the skills have the skill animation!
  871.        @spriteset.actor_sprites[@active_battler.index].pose(5) # <-- sprite number
  872.      end
  873.    else
  874.      if @skill.name != "one of the skills" # <-- first skill name
  875.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(5) # <-- sprite number
  876.      end
  877.    end
  878. #=============================================================================
  879. # SKILL SPRITES END
  880. #=============================================================================
  881.    
  882.    @animation1_id = @skill.animation1_id
  883.    @animation2_id = @skill.animation2_id
  884.    @common_event_id = @skill.common_event_id
  885.    set_target_battlers(@skill.scope)
  886.    for target in @target_battlers
  887.      target.skill_effect(@active_battler, @skill)
  888.    end
  889. end
  890. #--------------------------------------------------------------------------
  891. # how here we make the item use aktions
  892. #--------------------------------------------------------------------------
  893. def make_item_action_result
  894.    # sorry i didnt work on this...
  895.    # couse i dont have a sprite that uses items....
  896.    # so i just added the standby sprite here...
  897.    # when i get more time for this i'll try what i can do for this one... ^-^
  898.    # its the same as the ones above...
  899.    if @active_battler.is_a?(Game_Actor)
  900.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  901.    else
  902.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  903.    end
  904.    
  905.    @item = $data_items[@active_battler.current_action.item_id]
  906.    unless $game_party.item_can_use?(@item.id)
  907.      @phase4_step = 1
  908.      return
  909.    end
  910.    if @item.consumable
  911.      $game_party.lose_item(@item.id, 1)
  912.    end
  913.    @help_window.set_text(@item.name, 1)
  914.    @animation1_id = @item.animation1_id
  915.    @animation2_id = @item.animation2_id
  916.    @common_event_id = @item.common_event_id
  917.    index = @active_battler.current_action.target_index
  918.    target = $game_party.smooth_target_actor(index)
  919.    set_target_battlers(@item.scope)
  920.    for target in @target_battlers
  921.      target.item_effect(@item)
  922.    end
  923. end
  924.   
  925. #==============================================================================
  926. # here again.... snipplet from RPG's scrîpt
  927. #==============================================================================
  928. # this one here is for the winning pose...
  929. # if you happen to use my old costum level scrîpt then you need to add the
  930. # marked line to you "def start_phase5" in  "Scene_Battle 2" and delete this one...
  931. # the ->  =*****=
  932. # marks the end where you need to delete...
  933. # and -> {=====}
  934. # marks the line you need to copy and paste in the other one...
  935. # you need to add it at the same position...
  936. def start_phase5
  937.    @phase = 5
  938.    $game_system.me_play($game_system.battle_end_me)
  939.    $game_system.bgm_play($game_temp.map_bgm)
  940.    exp = 0
  941.    gold = 0
  942.    treasures = []
  943.    for enemy in $game_troop.enemies
  944.      unless enemy.hidden
  945.        exp += enemy.exp
  946.        gold += enemy.gold
  947.        if rand(100) < enemy.treasure_prob
  948.          if enemy.item_id > 0
  949.            treasures.push($data_items[enemy.item_id])
  950.          end
  951.          if enemy.weapon_id > 0
  952.            treasures.push($data_weapons[enemy.weapon_id])
  953.          end
  954.          if enemy.armor_id > 0
  955.            treasures.push($data_armors[enemy.armor_id])
  956.          end
  957.        end
  958.      end
  959.    end
  960.    treasures = treasures[0..5]
  961.    for i in 0...$game_party.actors.size
  962.      actor = $game_party.actors[i]
  963.      @spriteset.actor_sprites[i].pose(7) unless actor.dead? # {=====}
  964.      if actor.cant_get_exp? == false
  965.        last_level = actor.level
  966.        actor.exp += exp
  967.        if actor.level > last_level
  968.          @status_window.level_up(i)
  969.        end
  970.      end
  971.    end
  972.    $game_party.gain_gold(gold)
  973.    for item in treasures
  974.      case item
  975.      when RPG::Item
  976.        $game_party.gain_item(item.id, 1)
  977.      when RPG::Weapon
  978.        $game_party.gain_weapon(item.id, 1)
  979.      when RPG::Armor
  980.        $game_party.gain_armor(item.id, 1)
  981.      end
  982.    end
  983.    @result_window = Window_BattleResult.new(exp, gold, treasures)
  984.    @phase5_wait_count = 100
  985. end
  986. #   =*****=
  987. #--------------------------------------------------------------------------
  988. # updating the movement
  989. # since RPG isnt used to comments... i'll comment it again...
  990. #--------------------------------------------------------------------------
  991. def update_phase4_step3
  992.    if @active_battler.current_action.kind == 0 and
  993.       @active_battler.current_action.basic == 0
  994.       # in this one... we have our weapon animations... for player and monster
  995.      if @active_battler.is_a?(Game_Actor)
  996.        @spriteset.actor_sprites[@active_battler.index].pose(@weapon_sprite)
  997.      elsif @active_battler.is_a?(Game_Enemy)
  998.        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(@weapon_sprite_enemy)
  999.      end
  1000.    end
  1001.    if @animation1_id == 0
  1002.      @active_battler.white_flash = true
  1003.    else
  1004.      @active_battler.animation_id = @animation1_id
  1005.      @active_battler.animation_hit = true
  1006.    end
  1007.    @phase4_step = 4
  1008. end
  1009. def update_phase4_step4
  1010.    # this here is for the hit animation...
  1011.    for target in @target_battlers
  1012.      if target.is_a?(Game_Actor) and !@active_battler.is_a?(Game_Actor)
  1013.        if target.guarding?
  1014.          @spriteset.actor_sprites[target.index].pose(2)
  1015.        else
  1016.          @spriteset.actor_sprites[target.index].pose(3)
  1017.        end
  1018.        elsif target.is_a?(Game_Enemy) and !@active_battler.is_a?(Game_Enemy)
  1019.        if target.guarding?
  1020.          @spriteset.enemy_sprites[target.index].enemy_pose(2)
  1021.        else
  1022.          @spriteset.enemy_sprites[target.index].enemy_pose(3)
  1023.        end
  1024.      end
  1025.      target.animation_id = @animation2_id
  1026.      target.animation_hit = (target.damage != "Miss")
  1027.    end
  1028.    @wait_count = 8
  1029.    @phase4_step = 5
  1030. end
  1031. def update_phase4_step5
  1032.    if @active_battler.hp > 0 and @active_battler.slip_damage?
  1033.      @active_battler.slip_damage_effect
  1034.      @active_battler.damage_pop = true
  1035.    end
  1036.    @help_window.visible = false
  1037.    @status_window.refresh
  1038.    # here comes the guard animations....
  1039.    if @active_battler.is_a?(Game_Actor)
  1040.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  1041.    else
  1042.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1043.    end
  1044.    for target in @target_battlers
  1045.      if target.damage != nil
  1046.        target.damage_pop = true
  1047.        if @active_battler.is_a?(Game_Actor)
  1048.          @spriteset.actor_sprites[@active_battler.index].pose(1)
  1049.        else
  1050.          @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1051.        end
  1052.      end
  1053.    end
  1054.    @phase4_step = 6
  1055. end
  1056. #--------------------------------------------------------------------------
  1057. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  1058. #--------------------------------------------------------------------------
  1059. def update_phase4_step6
  1060.    
  1061.    # here we are asking if the player is dead and is a player or an enemy...
  1062.    # these lines are for the running back and standby animation....
  1063.    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
  1064.      @spriteset.actor_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
  1065.      @spriteset.actor_sprites[@active_battler.index].pose(0)
  1066.    elsif !@active_battler.dead?
  1067.      @spriteset.enemy_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
  1068.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
  1069.    end
  1070.    for target in @target_battlers
  1071.      if target.is_a?(Game_Actor) and !target.dead?
  1072.          @spriteset.actor_sprites[target.index].pose(1)
  1073.        elsif !target.dead?
  1074.          @spriteset.enemy_sprites[target.index].enemy_pose(1)
  1075.      end
  1076.    end
  1077.    $game_temp.forcing_battler = nil
  1078.    if @common_event_id > 0
  1079.      common_event = $data_common_events[@common_event_id]
  1080.      $game_system.battle_interpreter.setup(common_event.list, 0)
  1081.    end
  1082.    @phase4_step = 7
  1083. end
  1084. def update_phase4_step7
  1085.    
  1086.    # here we are asking if the player is dead and is a player or an enemy...
  1087.    # these lines are for the running back and standby animation....
  1088.    if @active_battler.is_a?(Game_Actor) and !@active_battler.dead?
  1089.      @spriteset.actor_sprites[@active_battler.index].pose(1)
  1090.    elsif !@active_battler.dead?
  1091.      @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
  1092.    end
  1093.    $game_temp.forcing_battler = nil
  1094.    if @common_event_id > 0
  1095.      common_event = $data_common_events[@common_event_id]
  1096.      $game_system.battle_interpreter.setup(common_event.list, 0)
  1097.    end
  1098.    @phase4_step = 1
  1099. end
  1100.   
  1101. # this one is an extra... without this the animation whill not work correctly...
  1102. def update
  1103.    if $game_system.battle_interpreter.running?
  1104.      $game_system.battle_interpreter.update
  1105.      if $game_temp.forcing_battler == nil
  1106.        unless $game_system.battle_interpreter.running?
  1107.          unless judge
  1108.            setup_battle_event
  1109.          end
  1110.        end
  1111.        if @phase != 5
  1112.          @status_window.refresh
  1113.        end
  1114.      end
  1115.    end
  1116.    $game_system.update
  1117.    $game_screen.update
  1118.    if $game_system.timer_working and $game_system.timer == 0
  1119.      $game_temp.battle_abort = true
  1120.    end
  1121.    @help_window.update
  1122.    @party_command_window.update
  1123.    @actor_command_window.update
  1124.    @status_window.update
  1125.    @message_window.update
  1126.    @spriteset.update
  1127.    if $game_temp.transition_processing
  1128.      $game_temp.transition_processing = false
  1129.      if $game_temp.transition_name == ""
  1130.        Graphics.transition(20)
  1131.      else
  1132.        Graphics.transition(40, "Graphics/Transitions/" +
  1133.          $game_temp.transition_name)
  1134.      end
  1135.    end
  1136.    if $game_temp.message_window_showing
  1137.      return
  1138.    end
  1139.    if @spriteset.effect?
  1140.      return
  1141.    end
  1142.    if $game_temp.gameover
  1143.      $scene = Scene_Gameover.new
  1144.      return
  1145.    end
  1146.    if $game_temp.to_title
  1147.      $scene = Scene_Title.new
  1148.      return
  1149.    end
  1150.    if $game_temp.battle_abort
  1151.      $game_system.bgm_play($game_temp.map_bgm)
  1152.      battle_end(1)
  1153.      return
  1154.    end
  1155.    if @wait_count > 0
  1156.      @wait_count -= 1
  1157.      return
  1158.    end
  1159.    # this one holds the battle while the player moves
  1160.    for actor in @spriteset.actor_sprites
  1161.      if actor.moving
  1162.        return
  1163.      end
  1164.    end
  1165.    # and this one is for the enemy...
  1166.    for enemy in @spriteset.enemy_sprites
  1167.      if enemy.moving# and $game_system.animated_enemy
  1168.        return
  1169.      end
  1170.    end
  1171.    
  1172.    if $game_temp.forcing_battler == nil and
  1173.       $game_system.battle_interpreter.running?
  1174.      return
  1175.    end
  1176.    case @phase
  1177.    when 1
  1178.      update_phase1
  1179.    when 2
  1180.      update_phase2
  1181.    when 3
  1182.      update_phase3
  1183.    when 4
  1184.      update_phase4
  1185.    when 5
  1186.      update_phase5
  1187.    end
  1188. end
  1189.   
  1190. #==============================================================================
  1191. # end of the snipplet
  1192. # if you want the comments that where here just look at the scene_battle 4...
  1193. # i added some comments since RPG hasnt add any....
  1194. #==============================================================================
  1195. end
复制代码
回复

使用道具 举报

18

主题

87

帖子

1007

积分

⑥精研

积分
1007
QQ
发表于 2007-2-9 02:04:10 | 显示全部楼层
[s:8]  我已经眼花了
本人最擅长把复杂的事想简单.反之亦然... <METAL--MAX-RETURNS>
回复 支持 反对

使用道具 举报

11

主题

48

帖子

1万

积分

⑧专业

积分
18322
发表于 2007-2-9 02:46:08 | 显示全部楼层
同上.. [s:6]
能人快来帮帮此人...
这年头不邪恶不行... ... 好记一点:http://blog.sina.com.cn/u/1277442425
回复 支持 反对

使用道具 举报

好人卡的 该用户已被删除
发表于 2007-2-9 03:45:35 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

88

主题

5419

帖子

214748万

积分

版主

S素世上最伟大最华丽

Rank: 7Rank: 7Rank: 7

积分
2147483647
QQ
发表于 2007-2-9 11:44:49 | 显示全部楼层
测试了下可以显示,的确是和其它XE物冲突了~~
回复 支持 反对

使用道具 举报

42

主题

167

帖子

857

积分

⑤进阶

good job!

积分
857
QQ
 楼主| 发表于 2007-2-23 15:28:23 | 显示全部楼层
晕......
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-25 04:58 , Processed in 0.013200 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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