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

Project1

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

询问一个脚本上的简单问题(脚本盲等级)

 关闭 [复制链接]

Lv4.逐梦者

梦石
0
星屑
5622
在线时间
1573 小时
注册时间
2006-9-30
帖子
2043

开拓者

跳转到指定楼层
1
发表于 2007-12-29 11:07:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#==============================================================================
# Window_Charactor
#==============================================================================

class Window_Charactor < Window_Base
  #--------------------------------------------------------------------------
  # actor : 初始化的角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_battler_graphics(@actor, 100, 200)
    self.contents.font.color.set(255, 255,50)
    self.contents.draw_text(250, 10, 80, 32, "姓名")
    self.contents.draw_text(250, 50, 80, 32, "年龄")
    self.contents.draw_text(250, 90, 80, 32, "出生地")
    self.contents.draw_text(250, 130, 80, 32, "身高")
    self.contents.draw_text(250, 170, 80, 32, "体重")
    self.contents.font.color = normal_color
    draw_actor_name(@actor, 350, 10)
    draw_actor_age(@actor, 350, 50)
    draw_actor_from(@actor, 350, 90)
    draw_actor_height(@actor, 350, 130)   
    draw_actor_weight(@actor, 350, 170)
    draw_actor_other(@actor, 50, 250)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_battler_graphics(actor, x, y)
    battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    w = battler.width
    h = battler.height
    self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_age(actor, x, y)
    self.contents.draw_text(x, y, 80, 32, CHARA_AGE[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_from(actor, x, y)
    self.contents.draw_text(x, y, 180, 32, CHARA_FROM[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_height(actor, x, y)
    self.contents.draw_text(x, y , 200, 32, CHARA_H[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_weight(actor, x, y)
    self.contents.draw_text(x, y, 250, 32, CHARA_W[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_other(actor, x, y)
    info = CHARA_INFO[actor.id-1]
    for i in 0...info.size
      self.contents.draw_text(x, y+32*i, 600, 32, info)
    end
  end
end


#==============================================================================
# Scene_Charactor
#==============================================================================

class Scene_Charactor
  #--------------------------------------------------------------------------
  #   actor_index :角色编号
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def main
    @actor = $game_party.actors[@actor_index]
    @status_window = Window_Charactor.new(@actor)
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(3)
      return
    end
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
  end
end


#==============================================================================
# Scene_Status
#==============================================================================

class Scene_Status
  alias update_chara update
  def update
    if Input.trigger?(CHENGE_KEY)
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
    update_chara
  end
end

==========================================================================

这是在站上找到的一个人物介绍的脚本

这个脚本是,他默认是显示人物的战斗图,我想改成显示Pictures下与角色战斗名字相

同的图片…… 这个应该只是修改一行脚本就可以的,但我就是惭愧到不会……

哪为懂脚本的朋友帮帮忙~




版务信息:本贴由楼主自主结贴~

Lv4.逐梦者

梦石
0
星屑
5622
在线时间
1573 小时
注册时间
2006-9-30
帖子
2043

开拓者

2
 楼主| 发表于 2007-12-29 11:07:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#==============================================================================
# Window_Charactor
#==============================================================================

class Window_Charactor < Window_Base
  #--------------------------------------------------------------------------
  # actor : 初始化的角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_battler_graphics(@actor, 100, 200)
    self.contents.font.color.set(255, 255,50)
    self.contents.draw_text(250, 10, 80, 32, "姓名")
    self.contents.draw_text(250, 50, 80, 32, "年龄")
    self.contents.draw_text(250, 90, 80, 32, "出生地")
    self.contents.draw_text(250, 130, 80, 32, "身高")
    self.contents.draw_text(250, 170, 80, 32, "体重")
    self.contents.font.color = normal_color
    draw_actor_name(@actor, 350, 10)
    draw_actor_age(@actor, 350, 50)
    draw_actor_from(@actor, 350, 90)
    draw_actor_height(@actor, 350, 130)   
    draw_actor_weight(@actor, 350, 170)
    draw_actor_other(@actor, 50, 250)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_battler_graphics(actor, x, y)
    battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    w = battler.width
    h = battler.height
    self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_age(actor, x, y)
    self.contents.draw_text(x, y, 80, 32, CHARA_AGE[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_from(actor, x, y)
    self.contents.draw_text(x, y, 180, 32, CHARA_FROM[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_height(actor, x, y)
    self.contents.draw_text(x, y , 200, 32, CHARA_H[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_weight(actor, x, y)
    self.contents.draw_text(x, y, 250, 32, CHARA_W[actor.id-1])
  end

  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_actor_other(actor, x, y)
    info = CHARA_INFO[actor.id-1]
    for i in 0...info.size
      self.contents.draw_text(x, y+32*i, 600, 32, info)
    end
  end
end


#==============================================================================
# Scene_Charactor
#==============================================================================

class Scene_Charactor
  #--------------------------------------------------------------------------
  #   actor_index :角色编号
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def main
    @actor = $game_party.actors[@actor_index]
    @status_window = Window_Charactor.new(@actor)
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(3)
      return
    end
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
  end
end


#==============================================================================
# Scene_Status
#==============================================================================

class Scene_Status
  alias update_chara update
  def update
    if Input.trigger?(CHENGE_KEY)
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Charactor.new(@actor_index)
      return
    end
    update_chara
  end
end

==========================================================================

这是在站上找到的一个人物介绍的脚本

这个脚本是,他默认是显示人物的战斗图,我想改成显示Pictures下与角色战斗名字相

同的图片…… 这个应该只是修改一行脚本就可以的,但我就是惭愧到不会……

哪为懂脚本的朋友帮帮忙~




版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

v

梦石
0
星屑
50
在线时间
55 小时
注册时间
2007-12-19
帖子
99
3
发表于 2007-12-29 14:08:11 | 只看该作者
def draw_battler_graphics(actor, x, y)
   battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)
   w = battler.width
   h = battler.height
   self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
end

改成
def draw_battler_graphics(actor, x, y)
   battler=RPG::Cache.picture(actor.battler_name)
   w = battler.width
   h = battler.height
   self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
end

估计这样就可以了吧,没测试{/gg}
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
142
在线时间
264 小时
注册时间
2006-11-22
帖子
1057
4
发表于 2007-12-29 19:13:39 | 只看该作者
def draw_battler_graphics(actor, x, y)
   battler=RPG::Cache.load_bitmap("Graphics/Pictures/", actor.battler_name, actor.battler_hue)
   w = battler.width
   h = battler.height
   self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 12:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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