Project1
标题:
超级横版战斗脚与摁键连技的结合??
[打印本页]
作者:
yeyi771
时间:
2009-5-2 00:59
标题:
超级横版战斗脚与摁键连技的结合??
我看到这两个脚本,想把他们结合,可不太会!!我学过一点C++,
可这些脚本言语又不太一样。我只看到了脚本的声明,但却没找到
他的函数等是在哪儿调用的!!求前辈指点一下!!
两个脚本如下:
#==============================================================================
# 组合键连续特技系统 By 绿发的Eclair
#==============================================================================
# 仿传说系列的效果,在使用一个特技中按照一定的顺序摁键可以再使用一个特技。
# 使用方法:在下面的自定义部分里设定特技对应的组合键和连接上的特技。
# 为了避免玩家二周目或者提前知道的情况下一开始就是用强力连续技能的事情发生,
# 特别做了判断,只有$chain这个数组包括的技能才会被连出来。
# 事件脚本中使用 add_chain(可以连出来的特技ID) 可以给这个数组添加新特技。
# 就好像“学会新的”一样。
#==============================================================================
$chain = [ ]#可以使用的连续技
module RPG
class Skill
def chain
############################################################自定义部分
case id
when 57 #有连续效果技能的ID,57就是"十字斩"
chain = ["A","A","A"] #连续技能的摁键,一定要写成数组,用英文半角逗号来隔开
chain_id = 81 #连接技能的ID,81就是"千裂斩"
when 81 #使用技能为千裂斩
chain = ["上","上","下" ,"下","左","右","左","右","B","A"] #输入魂斗罗的作弊码 :)
chain_id = 82 #连接技能,"灵魂裂隙"
when 82 #使用技能为灵魂裂隙
chain = ["上","下","左","右"] #输入键顺序为"上下左右"
chain_id = 82 #连接技能还是"灵魂裂隙"
#在这里按照上面的格式添加
#when n
#chain = ["第一个摁键","第二个摁键","第三个摁键"]
#chain_id = 连接技能的ID
############################################################
else
chain = []
chain_id = 0
end
return [chain,chain_id]
end
end
end
class Interpreter
def add_chain(id)
$chain.push(id)
end
end
class Scene_Battle
alias update_phase4_step1_2 :update_phase4_step1
def update_phase4_step1
@result = [] if @result == nil
update_phase4_step1_2
end
alias update_e :update
def update
if (@phase4_step == 3 or @phase4_step == 4 or @phase4_step == 5) && @active_battler.current_action.kind == 1
@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])
if @use == true and $data_skills[@active_battler.current_action.skill_id].chain != [[],0]
@use = $data_skills[$data_skills[@active_battler.current_action.skill_id].chain[1]].sp_cost <= @active_battler.sp
end
if @use == true
if Input.trigger?(Input::A)
@result.push("A")
end
if Input.trigger?(Input::B)
@result.push("B")
end
if Input.trigger?(Input::C)
@result.push("C")
end
if Input.trigger?(Input::X)
@result.push("X")
end
if Input.trigger?(Input::Y)
@result.push("Y")
end
if Input.trigger?(Input::Z)
@result.push("Z")
end
if Input.trigger?(Input::L)
@result.push("L")
end
if Input.trigger?(Input::R)
@result.push("R")
end
if Input.trigger?(Input::UP)
@result.push("上")
end
if Input.trigger?(Input::DOWN)
@result.push("下")
end
if Input.trigger?(Input::LEFT)
@result.push("左")
end
if Input.trigger?(Input::RIGHT)
@result.push("右")
end
end
end
if @phase == 4 and @phase4_step > 5 and @active_battler.current_action.kind == 1 and @use == true
if @result == $data_skills[@active_battler.current_action.skill_id].chain[0]
@active_battler.current_action.kind = 1
a = $data_skills[@active_battler.current_action.skill_id].chain[1]
@active_battler.current_action.skill_id = a
@action_battlers.unshift(@active_battler)
update_phase4_step1
end
end
update_e
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing || @result != nil && [] #Eclair
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
@result = [] #Eclair
# 消耗 SP
@active_battler.sp -= @skill.sp_cost
# 刷新状态窗口
@status_window.refresh
# 在帮助窗口显示特技名
@help_window.set_text(@skill.name, 1)
# 设置动画 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 设置公共事件 ID
@common_event_id = @skill.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
#==============================================================================
# 组合键连续特技系统 By 绿发的Eclair
#==============================================================================
复制代码
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
下面是超级横版战斗部分代码,太多了,发不完!!:
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
# * Animated_Sprite Scripted by: SiR_VaIlHoR
# Edited by: 柳柳
#------------------------------------------------------------------------------
# A class for animated sprites.
#==============================================================================
#66RPG,超级横版战斗脚本简要说明:
#默认情况下,把一张战斗图截成4列,>8行,如果感觉4列4帧的动画还不能满足要求,看
#def pose(number,frame = 4),更改=4,以及相关部分。
#战斗图从上到下:前进图,等待图,防御图,挨打图,普通攻击图(默认的武器),施展魔法,
#倒地不行了,胜利姿势,自定义武器1,自定义武器2……
#这个脚本的模型是老外编写的,其中参考了XMXS的一个方法,我添加了一些功能,去掉素材限制。
#不同职业拥有的图片数可以不一样,参考工程和录像教学
#==============================================================================
# □ RPG::Class
#==============================================================================
module RPG
class Class
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def name2
name = @name.split(/,/)[1]
return name != nil ? name : ''
end
end
class Weapon
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def name2
name = @name.split(/,/)[1]
return name != nil ? name : ''
end
end
end
class Game_Actor
#--------------------------------------------------------------------------
# ● 更改名称
# name : 新的名称
#--------------------------------------------------------------------------
def picturephase
name = $data_classes[class_id].name2
return name != nil ? name : "66RPG"
end
end
class Game_Enemy
#--------------------------------------------------------------------------
# ● 获取名称
#--------------------------------------------------------------------------
def name
name = $data_enemies[@enemy_id].name.split(/,/)[0]
return name != nil ? name : ''
end
def picturephase
name = $data_enemies[@enemy_id].name.split(/,/)[1]
return name != nil ? name : "66RPG"
end
end
class Animated_Sprite < RPG::Sprite
#--------------------------------------------------------------------------
# - Accessible instance variables.
#--------------------------------------------------------------------------
attr_accessor :frames # Number of animation frames
attr_accessor :delay # Delay time between frames (speed)
attr_accessor :frame_width # Width of each frame
attr_accessor :frame_height # Height of each frame
attr_accessor :offset_x # X coordinate of the 1st frame
attr_accessor :offset_y # Y coordinate of all frames
attr_accessor :current_frame # Current animation frame
attr_accessor :moving # Is the sprite moving?
#--------------------------------------------------------------------------
# - Initialize an animated sprite
# viewport : Sprite viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
@frame_width, @frame_height = 0, 0
change # A basic change to set initial variables
@old = Graphics.frame_count # For the delay method
@goingup = true # Increasing animation? (if @rm2k_mode is true)
@once = false # Is the animation only played once?
@animated = true # Used to stop animation when @once is true
end
#--------------------------------------------------------------------------
# Comment by RPG
# - Change the source rect (change the animation)
# frames : Number of animation frames
# delay : Frame delay, controls animation speed
# offx : X coordinate of the 1st frame
# offy : Y coordinate of all frames
# startf : Starting frame for animation
# once : Is the animation only played once?
# rm2k_mode : Animation pattern: 1-2-3-2 if true, 1-2-3-1 if false
#
# Comment by cybersam
#
# the rm2k_mode isnt pressent anymore...
# if you want that feature then use rm2k or use RPG's scrîpt...
#--------------------------------------------------------------------------
def change(frames = 0, delay = 0, offx = 0, offy = 0,
startf = 0, once = false)
@frames = frames
@delay = delay
@offset_x, @offset_y = offx, offy
@current_frame = startf
@once = once
x = @current_frame * @frame_width + @offset_x
self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
@goingup = true
@animated = true
end
#--------------------------------------------------------------------------
# - Update animation and movement
#--------------------------------------------------------------------------
def update
super
if self.bitmap != nil and delay(@delay) and @animated
x = @current_frame * @frame_width + @offset_x
self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
@current_frame = (@current_frame + 1) unless @frames == 0
@animated = false if @current_frame == @frames and @once
@current_frame %= @frames
end
end
#--------------------------------------------------------------------------
# - Move the sprite
# x : X coordinate of the destination point
# y : Y coordinate of the destination point
# speed : Speed of movement (0 = delayed, 1+ = faster)
# delay : Movement delay if speed is at 0
#--------------------------------------------------------------------------
def move(x, y, speed = 1, delay = 0)
@destx = x
@desty = y
@move_speed = speed
@move_delay = delay
@move_old = Graphics.frame_count
@moving = true
end
#--------------------------------------------------------------------------
# - Move sprite to destx and desty
#--------------------------------------------------------------------------
def update_move
return unless @moving
movinc = @move_speed == 0 ? 1 : @move_speed
if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
self.x += movinc if self.x < @destx
self.x -= movinc if self.x > @destx
self.y += movinc if self.y < @desty
self.y -= movinc if self.y > @desty
@move_old = Graphics.frame_count
end
if @move_speed > 1 # Check if sprite can't reach that point
self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
(@destx - self.x).abs <= @move_speed
self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
(@desty - self.y).abs <= @move_speed
end
if self.x == @destx and self.y == @desty
@moving = false
end
end
#--------------------------------------------------------------------------
# - Pause animation, but still updates movement
# frames : Number of frames
#--------------------------------------------------------------------------
def delay(frames)
update_move
if (Graphics.frame_count - @old >= frames)
@old = Graphics.frame_count
return true
end
return false
end
end
#=============================================================================
#
# here we go...
# this makes the scrîpt very easy to implement
# just add a new scrîpt above the "Main" scrîpt
# and insert this whole thing in there
#
# as you can see the sprite changing code is from the japanese scrîpt
# so the credits for the sprite changin goes to them....
# i edit it a little so it can show more sprites and sprite animations
# and added some other stuff... the next things are player movement...
#
#
#
# i got the battler changing scrîpt in this scrîpt...
# the credits for this goes to the guy who made this...
#
# ▼▲▼ XRXS11. 戦闘・バトラーモーション ver.0 ▼▲▼
#
# since this isnt used anymore... it isnt need for credit anymore...
# but i'll let it here since it helped me a lot...
#
#
# as for the ideas... missy provided me with really good ideas
# that helped me alot when i didnt find a way to some of these features...
#
# here one more Credit to place...
# its RPG's scrîpt...
# not the whole thing here...
# but some snipplet you'll know witch one when read the comments
#
#
# if you want some more explaines about this scrîpt...
# the most stuff are commented... but if you still have questions or
# sugestions then you can contact me
#
# how or where you can contact me...
# at the http://www.rmxp.net forum via pm, email:
[email protected]
# or via AIM: cych4n or ICQ: 73130840
#
# remember this is still in testing phase...
# and i'm trying to work on some other additions... like character movements...
# but that wont be added now... couse i need to figure it out first...
#
#
#
# oh hehe.... before i forget...
# sorry for the bad english... ^-^''''
#
#
#==============================================================================
#
# here i'm going to tell you what names you need to give for your chara
# battle sprites....
#
# ok... here... since i'm using RPG's movement scrîpt...
# there are a lot of changes...
#
# when you look at the scrîpt you'll find line with "pose(n)" or "enemy_pose(n)"
# since i want my sprites have different sprites... i added one more option
# to these...
# so now if you add a number after the n (the n stands for witch sprite is used)
# fo example 8... ("pose(4, 8)") this will tell the scrîpt that the 4th animation
# have 8 frames...
# pose is used for the player... and enemy_pose for the enemy...
# there is nothing more to this...
# i used my old sprite numbers... (this time in only one sprite...)
#
# explains about the animation sprites... (the digits)
#
#
# 0 = move (during battle)
# 1 = standby
# 2 = defend
# 3 = hit (being attacked)
# 4 = attack
# 5 = skill use
# 6 = dead
# 7 = winning pose... this idea is from RPG....
#
#
# of course this is just the begining of the code...
# so more animations can be implemented...
# but for now this should be enough...
#
# alot has changed here... and now it looks like it is done...
# of course the fine edit needs to be done so it looks and works great with your
# game too...
#
#
#
# 1st character movement... done
# 2nd character movement during attack... done
# 3rd character apears at the enemy while attacking... done
#
# 4th enemies movement... done
# 5th enemy movement during attack... done
# 6th enemy apears at the enemy while attacking... done
#
# 7th each weapon has its own animation... done
# 8th each skill has its own animation... done
#
#
#
# for the ones interisted... my nex project is an Movie player
# (that actualy plays avi, mpgs and such...
# but dont think this will be done soon... ^-^''
#
# but i'll may be try something else before i begin to code that one...
#==============================================================================
class Game_Actor < Game_Battler
# you dont have to change your game actor to let the characters schows
# from the side...
# this will do it for you... ^-^
def screen_x
# 返回计算后的队伍 X 坐标的排列顺序
# if self.index != nil
# return self.index * 60 + 360
# else
# return 0
# end
# end
case self.index
when 0
return 500
when 1
return 540
when 2
return 500
when 3
return 540
else
return 1000
end
end
def screen_y
case self.index
when 0
return 150
when 1
return 200
when 2
return 250
when 3
return 300
else
return 1000
end
end
def screen_z
# 返回计算后的队伍 Z 坐标的排列顺序
if self.index != nil
return 104 - self.index
else
return 0
end
end
end
# RPG's snipplet...
class Spriteset_Battle
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
alias original_initialize initialize
def initialize
#@start_party_number = $game_party.actors.size
# ビューポートを作成
@viewport0 = Viewport.new(0, 0, 640, 480)
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport1.z = 50
@viewport2.z = 50
@viewport3.z = 200
@viewport4.z = 5000
@battleback_sprite = Sprite.new(@viewport0)
@enemy_sprites = []
for enemy in $game_troop.enemies #.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[0]))
@actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[1]))
@actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[2]))
@actor_sprites.push(Sprite_Battler.new(@viewport2,$game_party.actors[3]))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
alias original_update update
def update
@viewport1.z = 50 and @viewport2.z = 51 #if $actor_on_top == true
# @viewport1.z = 51 and @viewport2.z = 50 if $actor_on_top == false
# 刷新角色的活动块 (对应角色的替换)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# 战斗背景的文件名与现在情况有差异的情况下
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 480)
end
# 刷新战斗者的活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# 刷新天气图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# 刷新图片活动块
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器活动块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport4.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport2.update
@viewport4.update
end
end
# end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
[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