Project1

标题: 超级横版战斗脚与摁键连技的结合?? [打印本页]

作者: yeyi771    时间: 2009-5-2 00:59
标题: 超级横版战斗脚与摁键连技的结合??
我看到这两个脚本,想把他们结合,可不太会!!我学过一点C++,
可这些脚本言语又不太一样。我只看到了脚本的声明,但却没找到
他的函数等是在哪儿调用的!!求前辈指点一下!!

两个脚本如下:
  1. #==============================================================================
  2. #   组合键连续特技系统 By 绿发的Eclair
  3. #==============================================================================
  4. #   仿传说系列的效果,在使用一个特技中按照一定的顺序摁键可以再使用一个特技。
  5. #   使用方法:在下面的自定义部分里设定特技对应的组合键和连接上的特技。
  6. #   为了避免玩家二周目或者提前知道的情况下一开始就是用强力连续技能的事情发生,
  7. #   特别做了判断,只有$chain这个数组包括的技能才会被连出来。
  8. #   事件脚本中使用 add_chain(可以连出来的特技ID) 可以给这个数组添加新特技。
  9. #   就好像“学会新的”一样。
  10. #==============================================================================
  11. $chain = [ ]#可以使用的连续技
  12. module RPG
  13. class Skill
  14.   def chain
  15.   ############################################################自定义部分
  16.   case id
  17.    when 57                #有连续效果技能的ID,57就是"十字斩"
  18.     chain = ["A","A","A"] #连续技能的摁键,一定要写成数组,用英文半角逗号来隔开
  19.     chain_id = 81         #连接技能的ID,81就是"千裂斩"
  20.   when 81                 #使用技能为千裂斩
  21.     chain = ["上","上","下" ,"下","左","右","左","右","B","A"] #输入魂斗罗的作弊码 :)
  22.     chain_id = 82         #连接技能,"灵魂裂隙"                                   
  23.   when 82                 #使用技能为灵魂裂隙
  24.     chain = ["上","下","左","右"] #输入键顺序为"上下左右"
  25.     chain_id = 82         #连接技能还是"灵魂裂隙"
  26.   #在这里按照上面的格式添加  
  27.   #when n  
  28.   #chain = ["第一个摁键","第二个摁键","第三个摁键"]
  29.   #chain_id = 连接技能的ID
  30.   
  31.   
  32.   ############################################################
  33.   else
  34.     chain = []
  35.     chain_id = 0
  36.   end
  37.    return [chain,chain_id]
  38.   end
  39. end
  40. end
  41. class Interpreter
  42.   def add_chain(id)
  43.     $chain.push(id)
  44.   end
  45. end
  46. class Scene_Battle
  47.   alias update_phase4_step1_2 :update_phase4_step1
  48.   def update_phase4_step1
  49.     @result = [] if @result == nil
  50.     update_phase4_step1_2
  51.   end
  52.   alias update_e :update
  53.   def update
  54.     if (@phase4_step == 3 or @phase4_step == 4 or @phase4_step == 5) && @active_battler.current_action.kind == 1
  55.       @use = @active_battler.current_action.kind == 1 && $data_skills[@active_battler.current_action.skill_id].chain != [[],0] && $chain.include?($data_skills[@active_battler.current_action.skill_id].chain[1])
  56.     if @use == true and $data_skills[@active_battler.current_action.skill_id].chain != [[],0]
  57.        @use = $data_skills[$data_skills[@active_battler.current_action.skill_id].chain[1]].sp_cost <= @active_battler.sp
  58.     end
  59.     if @use == true
  60.    if Input.trigger?(Input::A)
  61.      @result.push("A")
  62.    end
  63.    if Input.trigger?(Input::B)
  64.      @result.push("B")
  65.    end
  66.    if Input.trigger?(Input::C)
  67.      @result.push("C")
  68.    end
  69.    if Input.trigger?(Input::X)
  70.      @result.push("X")
  71.    end
  72.    if Input.trigger?(Input::Y)
  73.      @result.push("Y")
  74.    end
  75.    if Input.trigger?(Input::Z)
  76.      @result.push("Z")
  77.    end
  78.    if Input.trigger?(Input::L)
  79.      @result.push("L")
  80.    end
  81.    if Input.trigger?(Input::R)
  82.      @result.push("R")
  83.    end
  84.    if Input.trigger?(Input::UP)
  85.      @result.push("上")
  86.    end
  87.    if Input.trigger?(Input::DOWN)
  88.      @result.push("下")
  89.    end
  90.    if Input.trigger?(Input::LEFT)
  91.      @result.push("左")
  92.    end
  93.    if Input.trigger?(Input::RIGHT)
  94.      @result.push("右")
  95.    end
  96.    end
  97. end
  98.   if @phase == 4 and @phase4_step > 5 and @active_battler.current_action.kind == 1 and @use == true
  99.   if @result == $data_skills[@active_battler.current_action.skill_id].chain[0]
  100.     @active_battler.current_action.kind = 1
  101.     a = $data_skills[@active_battler.current_action.skill_id].chain[1]
  102.     @active_battler.current_action.skill_id = a
  103.     @action_battlers.unshift(@active_battler)
  104.     update_phase4_step1
  105.   end
  106. end
  107. update_e
  108. end
  109.   #--------------------------------------------------------------------------
  110.   # ● 生成特技行动结果
  111.   #--------------------------------------------------------------------------
  112.   def make_skill_action_result
  113.     # 获取特技
  114.     @skill = $data_skills[@active_battler.current_action.skill_id]
  115.     # 如果不是强制行动
  116.     unless @active_battler.current_action.forcing || @result != nil && [] #Eclair
  117.       # 因为 SP 耗尽而无法使用的情况下
  118.       unless @active_battler.skill_can_use?(@skill.id)
  119.         # 清除强制行动对像的战斗者
  120.         $game_temp.forcing_battler = nil
  121.         # 移至步骤 1
  122.         @phase4_step = 1
  123.         return
  124.       end
  125.     end
  126.     @result = [] #Eclair
  127.     # 消耗 SP
  128.     @active_battler.sp -= @skill.sp_cost
  129.     # 刷新状态窗口
  130.     @status_window.refresh
  131.     # 在帮助窗口显示特技名
  132.     @help_window.set_text(@skill.name, 1)
  133.     # 设置动画 ID
  134.     @animation1_id = @skill.animation1_id
  135.     @animation2_id = @skill.animation2_id
  136.     # 设置公共事件 ID
  137.     @common_event_id = @skill.common_event_id
  138.     # 设置对像侧战斗者
  139.     set_target_battlers(@skill.scope)
  140.     # 应用特技效果
  141.     for target in @target_battlers
  142.       target.skill_effect(@active_battler, @skill)
  143.     end
  144.   end
  145. end
  146. #==============================================================================
  147. #   组合键连续特技系统 By 绿发的Eclair
  148. #==============================================================================
复制代码

































下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:





























  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # * Animated_Sprite                                Scripted by: SiR_VaIlHoR
  6. #                                                  Edited by: 柳柳
  7. #------------------------------------------------------------------------------
  8. #  A class for animated sprites.
  9. #==============================================================================

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

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

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

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

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

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

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

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

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

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

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



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

  302. def screen_x
  303.     # 返回计算后的队伍 X 坐标的排列顺序
  304. #   if self.index != nil
  305. #     return self.index * 60 + 360
  306. #   else
  307. #     return 0
  308. #   end
  309. # end
  310.     case self.index
  311.     when 0
  312.       return 500
  313.     when 1
  314.       return 540
  315.     when 2
  316.       return 500
  317.     when 3
  318.       return 540
  319.     else
  320.       return 1000
  321.     end
  322.   end   

  323. def screen_y
  324.    case self.index
  325.     when 0
  326.       return 150
  327.     when 1
  328.       return 200
  329.     when 2
  330.       return 250
  331.     when 3
  332.       return 300
  333.     else
  334.       return 1000
  335.     end
  336.   end

  337. def screen_z
  338.     # 返回计算后的队伍 Z 坐标的排列顺序
  339.     if self.index != nil
  340.       return 104 - self.index
  341.     else
  342.       return 0
  343.     end
  344.   end
  345. end

  346. # RPG's snipplet...
  347. class Spriteset_Battle
  348. attr_accessor :actor_sprites
  349. attr_accessor :enemy_sprites
  350.   
  351.   
  352. alias original_initialize initialize
  353. def initialize
  354.    #@start_party_number = $game_party.actors.size
  355.    # ビューポートを作成
  356.    @viewport0 = Viewport.new(0, 0, 640, 480)
  357.    @viewport1 = Viewport.new(0, 0, 640, 480)
  358.    @viewport2 = Viewport.new(0, 0, 640, 480)
  359.    @viewport3 = Viewport.new(0, 0, 640, 480)
  360.    @viewport4 = Viewport.new(0, 0, 640, 480)
  361.    @viewport1.z = 50
  362.    @viewport2.z = 50
  363.    @viewport3.z = 200
  364.    @viewport4.z = 5000

  365.    @battleback_sprite = Sprite.new(@viewport0)
  366.    
  367.    @enemy_sprites = []
  368.    for enemy in $game_troop.enemies #.reverse
  369.      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  370.    end
  371.    
  372.    @actor_sprites = []
  373.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[0]))
  374.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[1]))
  375.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[2]))
  376.    @actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[3]))
  377.    
  378.    @weather = RPG::Weather.new(@viewport1)
  379.    @picture_sprites = []
  380.    for i in 51..100
  381.      @picture_sprites.push(Sprite_Picture.new(@viewport3,
  382.        $game_screen.pictures[i]))
  383.    end
  384.    @timer_sprite = Sprite_Timer.new
  385.    update
  386. end
  387.   
  388.   
  389.   
  390. alias original_update update
  391. def update
  392.    @viewport1.z = 50 and @viewport2.z = 51 #if $actor_on_top == true
  393. #  @viewport1.z = 51 and @viewport2.z = 50 if $actor_on_top == false
  394.     # 刷新角色的活动块 (对应角色的替换)
  395.     @actor_sprites[0].battler = $game_party.actors[0]
  396.     @actor_sprites[1].battler = $game_party.actors[1]
  397.     @actor_sprites[2].battler = $game_party.actors[2]
  398.     @actor_sprites[3].battler = $game_party.actors[3]
  399.     # 战斗背景的文件名与现在情况有差异的情况下
  400.     if @battleback_name != $game_temp.battleback_name
  401.       @battleback_name = $game_temp.battleback_name
  402.       if @battleback_sprite.bitmap != nil
  403.         @battleback_sprite.bitmap.dispose
  404.       end
  405.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  406.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  407.     end
  408.     # 刷新战斗者的活动块
  409.     for sprite in @enemy_sprites + @actor_sprites
  410.       sprite.update
  411.     end
  412.     # 刷新天气图形
  413.     @weather.type = $game_screen.weather_type
  414.     @weather.max = $game_screen.weather_max
  415.     @weather.update
  416.     # 刷新图片活动块
  417.     for sprite in @picture_sprites
  418.       sprite.update
  419.     end
  420.     # 刷新计时器活动块
  421.     @timer_sprite.update
  422.     # 设置画面的色调与震动位置
  423.     @viewport1.tone = $game_screen.tone
  424.     @viewport1.ox = $game_screen.shake
  425.     # 设置画面的闪烁色
  426.     @viewport4.color = $game_screen.flash_color
  427.     # 刷新显示端口
  428.     @viewport1.update
  429.     @viewport2.update
  430.     @viewport4.update
  431. end
  432. end
  433. # end



  434. #==============================================================================
  435. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  436. #==============================================================================
复制代码
[LINE]1,#dddddd[/LINE]此贴于 2009-5-29 16:04:11 被版主凌辰提醒,请楼主看到后对本贴做出回应。
作者: Tabris_Air    时间: 2009-6-1 03:24

有啥不能结合的?




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