幻想森林

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

[战斗系统] [共享脚本]45度战斗脚本

[复制链接]

3

主题

11

帖子

73

积分

②入门

积分
73
QQ
发表于 2008-1-27 23:29:18 | 显示全部楼层 |阅读模式
我看这论坛很少人发脚本,我从66RPG弄来个,谢谢

-------------------------------------------------------------------------------------------------------------------------------------
                                       以下为脚本
-------------------------------------------------------------------------------------------------------------------------------------
# ————————————————————————————————————
# 本脚本来自www.66rpg.com,转载请保留此信息
# ————————————————————————————————————

#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
case self.index
when 0
   return 350
when 1
   return 430
when 2
   return 510
when 3
   return 580
else
   return 600

  end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Y 坐标
#--------------------------------------------------------------------------
def screen_y
case self.index
when 0
   return 430
when 1
   return 395
when 2
   return 360
when 3
   return 325
else
   return 1000
  end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
case self.index
when 0
   return 10
when 1
   return 9
when 2
   return 8
when 3
   return 7
else
   return 0
   end
end
end


#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类。
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
#     actor : 角色
#     x     : 描画目标 X 坐标
#     y     : 描画目标 Y 坐标
#     width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp1(actor, x, y, width = 72)
   # 描绘字符串 "HP"
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
   # 计算描绘 MaxHP 所需的空间
   if width - 24 >= 32
     hp_x = x + 32# + width - 24
   end
   # 描绘 HP
   self.contents.font.color = actor.hp == 0 ? knockout_color :
     actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
   self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘 SP
#     actor : 角色
#     x     : 描画目标 X 坐标
#     y     : 描画目标 Y 坐标
#     width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp1(actor, x, y, width = 72)
   # 描绘字符串 "SP"
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
   # 计算描绘 MaxSP 所需的空间
   if width - 24 >= 32
     sp_x = x + 32# + width - 24
   end
   # 描绘 SP
   self.contents.font.color = actor.sp == 0 ? knockout_color :
     actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
   self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
end
end





#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  显示战斗画面同伴状态的窗口。
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
#$data_system_level_up_me = "Audio/ME/升级音乐"
def initialize
   super(0, 0, 640, 480)
   self.contents = Bitmap.new(width - 10, height - 32)
   self.opacity = 0
   @level_up_flags = [false, false, false, false]
   refresh
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
   super
end
#--------------------------------------------------------------------------
# ● 设置升级标志
#     actor_index : 角色索引
#--------------------------------------------------------------------------
def level_up(actor_index)
   @level_up_flags[actor_index] = true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
     actor = $game_party.actors
     case i
       when 0
        x = 310
        y = 390
       when 1
        x = 390
        y = 340
       when 2
        x = 480
        y = 300
       when 3
        x = 550
        y = 270
      end
     if @level_up_flags
       self.contents.font.color = normal_color
       self.contents.draw_text(x, y, 80, 24, "LEVEL UP!")
       Audio.me_stop
#        Audio.me_play($data_system_level_up_me)
     else
     draw_actor_hp1(actor, x-15, y-15, 80)
     draw_actor_sp1(actor, x-15, y+5, 80)
    end
   end
end

#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
   super
   # 主界面的不透明度下降
   if $game_temp.battle_main_phase
     self.contents_opacity -= 50 if self.contents_opacity > 1
   else
     self.contents_opacity += 50 if self.contents_opacity < 255
   end
end
end





#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
alias xrxs_bp2_refresh refresh
def refresh
   xrxs_bp2_refresh
   @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
     actor = $game_party.actors
     case i
       when 0
        x = 310
        y = 390
       when 1
        x = 390
        y = 340
       when 2
        x = 480
        y = 300
       when 3
        x = 550
        y = 270
      end
     draw_actor_hp_meter(actor, x, y, 50)
     draw_actor_sp_meter(actor, x, y + 8, 50)
   end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP描画
#--------------------------------------------------------------------------
def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
   if type == 1 and actor.hp == 0
     return
   end
   self.contents.font.color = system_color
   self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
   w = width * actor.hp / actor.maxhp
   self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
   self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
   self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
   self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
   
   end
#--------------------------------------------------------------------------
# ● SP描画
#--------------------------------------------------------------------------
def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
   if type == 1 and actor.hp == 0
     return
   end
   self.contents.font.color = system_color
   self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
   w = width * actor.sp / actor.maxsp
   self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
   self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
   self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
   self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
end
end
#==========================================================================
# 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
#==========================================================================

XY_SWITCH = 25 # 当25号开关打开,本脚本才开始工作。

#==============================================================================
# ■ Window_XY
#------------------------------------------------------------------------------
#  显示坐标的窗口。
#==============================================================================
class Window_xy < Window_Base#注意前面那个window_xy是文件名
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
   super(0, 0, 160, 96)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 255  # 这个是背景透明
   self.opacity = 255       # 这个是边框和背景都透明
   self.contents_opacity = 255       # 这个是内容透明
   self.visible = false
   refresh
   @x = $game_player.x
   @y = $game_player.y
   @id = $game_map.map_id
end

#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
   if $game_switches[XY_SWITCH] #确定开关是否打开,可以自己改变开关
     @x = $game_player.x #获取角色X坐标
     @y = $game_player.y #获取角色Y坐标
     @id = $game_map.map_id  #获取地图编号
    self.contents.clear #清除以前的东西
    $mapnames = load_data("Data/MapInfos.rxdata") #读取地图名文件
    map_name = $mapnames[@id].name #获得地图名
    self.contents.font.color = normal_color#颜色,这里是白色~
    self.contents.draw_text(0, 0, 116, 32, map_name,2)
    self.contents.font.color = system_color#颜色,暗蓝色
    self.contents.draw_text(0, 32, 120, 32, "X:")#显示X这个字的位置,引号里面的内容随便改,比如"X坐标地址"
    self.contents.font.color = normal_color#颜色,这里是白色~
    self.contents.draw_text(0, 32, 52, 32, @x.to_s,2)
    self.contents.font.color = system_color#上面那个是X坐标的变量,可以自己更改变量名~
    self.contents.draw_text(64, 32, 128, 32, "Y:")#显示Y这个字~
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 32, 116, 32, @y.to_s,2)
   end
end
#--------------------------------------------------------------------------
# ● 判断文字刷新。节约内存用
#--------------------------------------------------------------------------
def judge
   return true if @x != $game_player.x
   return true if @y != $game_player.y
   return true if @id != $game_map.map_id
   return false
end
end
###########################################################################
#                           下面的东西不需要掌握~                         #
###########################################################################

class Scene_Map
alias xy_66rpg_main main
def main
   @xy_window = Window_xy.new
   @xy_window.x = 640 - 160
   @xy_window.y = 480 - 96
   @xy_window.opacity = 0
   xy_66rpg_main
   @xy_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias xy_66rpg_update update
def update
   xy_66rpg_update
   if $game_switches[XY_SWITCH]
     @xy_window.visible = true      
     @xy_window.refresh if @xy_window.judge
   else
     @xy_window.visible = false
   end
end
end
#==========================================================================
# 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
#==========================================================================
回复

使用道具 举报

32

主题

1176

帖子

10216万

积分

⑥精研

大家都爱好少年

积分
102162186
发表于 2008-1-28 02:42:20 | 显示全部楼层
      
这里MS不提倡直接转载别人的脚本的吧?
战,然后死!
回复 支持 反对

使用道具 举报

0

主题

2

帖子

24

积分

②入门

积分
24
发表于 2008-6-8 11:08:00 | 显示全部楼层
脚本中有错误
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-19 19:22 , Processed in 0.024257 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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