Thế là hết than phiền về cái Message nhé (dành cho ai chưa biết)

Dễ lắm,U thêm vô câu lệnh nầy:
Mã:
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
Vào phía sau:
Mã:
 self.contents = Bitmap.new(width - 32, height - 32)
Ấy chết,nếu như bảng ko hiện gì mới thêm dòng đó,nếu chỉ hi65n table English mà bác muốn nó hiện tables Việt Nam thì:
Sửa cái này lại:
Mã:
def refresh
self.contents.clear
for i in 0..134
x = 4 + i / 5 / 9 * 152 + i % 5 * 28
y = i / 5 % 9 * 32
if @mode == 1
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, [B]ENGLISH_TABLE[/B][i], 1)
end
end
end
Thành
Mã:
def refresh
self.contents.clear
for i in 0...[B]VIETNAMES_TABLE.size[/B]
x = 4 + i / 5 / 9 * 152 + i % 5 * 28
y = i / 5 % 9 * 32
if @mode == 1
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, [B] VIETNAMES_TABLE[/B][i], 1)
end
end
end
Được ko báo mình ngay nhé.
 
Vô tác dụng ông ạ. Để tí nữa về nàh tui post cái lỗi của nó lên ch ;;) Xem thử cái Script này:
if @mode == 1
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, 30 CHAR, 1)
end
end
end
 
Á,em xin lỗi,có` lẽ thêm
if @mode == 2
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, VIETNAMES_TABLE,1)
end
Còn nữa:Làm gì có dãy nào là CHAR mà dùng Char,vả lại
self.contents.draw_text(x, y, 28, 32, 30 CHAR, 1)

Làm gì có chỗ đậm đó
Nên thế này:
Mã:
def refresh
self.contents.clear
for i in 0..134
x = 4 + i / 5 / 9 * 152 + i % 5 * 28
y = i / 5 % 9 * 32
if @mode == 1
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, ENGLISH_TABLE[i], 1)
elsif @mode == 2
self.contents.font.name = ".VnTime"
self.contents.font.size = 24
self.contents.draw_text(x, y, 28, 32, VIETNAMES_TABLE[i], 1)
end
end
end
 
Ok, thanks, hôm nọ mới thử cách mới của ông nhưng quên thêm cái els trước if @mode == 2 :D
Còn cái kia thì là 30 char ấy mà, bắt trước kiểu ông (ở 1 topic nào đó, quên rùi) :P
 
À ^_^,cám ơn,nhờ ông bắt chước tui có chút MP ^_^,làm được rồi phải ko?(nhưng mà ông bắt chước lỗi ko :p)
ID nói:
VẦy mới đúng:
for i in 1...31
if i<=30
print "Char:"+i.to_s
else
p "Finished 30 char"
end
end
 
Sử dụng những Script này như thế nào ạ ? Em mới vào nghề chưa rành lắm mấy anh hướng dẫn dùm !
 
Mình làm rồi ! đúng như vậy luôn , sao đặt tên lại ko được , hiện ra bảng chữ đàng hoàng luôn , nhưng nó ko cho mình chọn chữ , nhấn enter wá trời luôn nó vẫn ko cho chọn chữ để đặt . Sẵn hỏi luôn , sau khi đặt tên thì trong đoạn văn mình nhấn cái gì để hiện tên mình đặt trong suốt quá trình chơi . Cám ơn
 
\n[n]
n là thành viên c6àn hiện tên
Trong script dùng:
$game_actor[n].name
n là thành viên c6àn hiện tên
Còn cái vụ ko cho đ8ạt bạn nói rõ chút đi,sửa tạm vầy xem:
def character
if @mode == 1
return ENGLISH_TABLE[@index]
elsif @mode == 2
return HIRAGANA_TABLE[@index]
end
end
Thay thành
def character
if @mode == 1
return VIETNAMESE_TABLE[@index]
elsif @mode == 2
return VIETNAMESE_TABLE[@index]
end
end
 
Ồh Cám ơn bạn mình làm được gòi . ^^. Sẵn hỏi tiếp , bi giờ mình muốn tạo một cái thùng đồ riêng , dùng để cất đồ , và giới hạn việc đem theo các item thì mình phải làm sao vậy bạn ?
Ờ sẵn đây giúp mình tắt cái save mọi lúc mọi nơi trong RPG XP đi
 
Xạo,có được đâu,mình thử rồi,giờ dùng cái này nè,đỡ phiền:
Mã:
 class Window_NameInput < Window_Base
# ----------------------------------
attr_accessor :mode
# ----------------------------------
ENGLISH_TABLE =
[
"A","B","C","D","E",
"F","G","H","I","J",
"K","L","M","N","O",
"P","Q","R","S","T",
"U","V","W","X","Y",
"Z","","","","",
"0","1","2","3","4",
"5", "6" ,"7", "8" ,"9",
"","","","","",
"a", "b" ,"c", "d" ,"e",
"f","g","h","i","j",
"k","l","m","n","o",
"p","q","r","s","t",
"u","v","w","x","y",
"z","","","","",
".",",","?","!","/",
"\\","<",">",";",":",
"","", "" , "" , "" ,
"@","#","$","%","^",
"&","*","(",")","",
"[","]","'","\"","~",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"", "" ,"", "" ,"",
"","","","","",
]
VIETNAMES_TABLE =
[
"1","2","3","4","5",
"6","7","8","9","#",
"A","¡","¢","¸","µ",
"¶","·","¹","","",
"","","","","",
"-","-","-","-","-",
"b","¹","n","","",
"t","ù","","","",
"t","h","ª","m",""
]
TABLE=[VIETNAMES_TABLE,ENGLISH_TABLE]
# ----------------------------------
def initialize(tabletype=0)
super(0, 128, 640, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@index = 0
@mode = tabletype
refresh
update_cursor_rect
end
# ----------------------------------
def index=(value)
@index = value
update_cursor_rect
end
#--------------------------------------
def character
return TABLE[@mode][@index]
end
# ----------------------------------
def refresh
  self.contents.clear
  for i in 0..TABLE[@mode].size-1
      x = 4 + i / 5 / 9 * 152 + i % 5 * 28
      y = i / 5 % 9 * 32
          self.contents.font.name = ".VnTime"
          self.contents.font.size = 24
          self.contents.draw_text(x, y, 28, 32, TABLE[@mode][i], 1)
    end
        self.contents.draw_text(544, 9 * 32, 64, 32, "Confirm", 1)
end
# ----------------------------------
def update_cursor_rect
    if @index >= 180
      self.cursor_rect.set(544, 9 * 32, 64, 32)
    else
      x = 4 + @index / 5 / 9 * 152 + @index % 5 * 28
      y = @index / 5 % 9 * 32
      self.cursor_rect.set(x, y, 28, 32)
    end
end
# ----------------------------------
def update
    super
    # カーソル位置が [決定] の場合
    if @index >= 180
      # カーソル下
      if Input.trigger?(Input::DOWN)
        $game_system.se_play($data_system.cursor_se)
        @index -= 180
      end
      # カーソル上
      if Input.repeat?(Input::UP)
        $game_system.se_play($data_system.cursor_se)
        @index -= 180 - 40
      end
    # カーソル位置が [決定] 以外の場合
    else
      # 方向ボタンの右が押された場合
      if Input.repeat?(Input::RIGHT)
        # 押下状態がリピートでない場合か、
        # カーソル位置が右端ではない場合
        if Input.trigger?(Input::RIGHT) or
           @index / 45 < 3 or @index % 5 < 4
          # カーソルを右に移動
          $game_system.se_play($data_system.cursor_se)
          if @index % 5 < 4
            @index += 1
          else
            @index += 45 - 4
          end
          if @index >= 180
            @index -= 180
          end
        end
      end
      # 方向ボタンの左が押された場合
      if Input.repeat?(Input::LEFT)
        # 押下状態がリピートでない場合か、
        # カーソル位置が左端ではない場合
        if Input.trigger?(Input::LEFT) or
           @index / 45 > 0 or @index % 5 > 0
          # カーソルを左に移動
          $game_system.se_play($data_system.cursor_se)
          if @index % 5 > 0
            @index -= 1
          else
            @index -= 45 - 4
          end
          if @index < 0
            @index += 180
          end
        end
      end
      # 方向ボタンの下が押された場合
      if Input.repeat?(Input::DOWN)
        # カーソルを下に移動
        $game_system.se_play($data_system.cursor_se)
        if @index % 45 < 40
          @index += 5
        else
          @index += 180 - 40
        end
      end
      # 方向ボタンの上が押された場合
      if Input.repeat?(Input::UP)
        # 押下状態がリピートでない場合か、
        # カーソル位置が上端ではない場合
        if Input.trigger?(Input::UP) or @index % 45 >= 5
          # カーソルを上に移動
          $game_system.se_play($data_system.cursor_se)
          if @index % 45 >= 5
            @index -= 5
          else
            @index += 180
          end
        end
      end
      # L ボタンか R ボタンが押された場合
      if Input.repeat?(Input::L) or Input.repeat?(Input::R)
        # ひらがな / カタカナ 移動
        $game_system.se_play($data_system.cursor_se)
        if @index / 45 < 2
          @index += 90
        else
          @index -= 90
        end
      end
    end
    update_cursor_rect
  end
end
Mã:
#==============================================================================
# ■ Scene_Name
#------------------------------------------------------------------------------
#  名前入力画面の処理を行うクラスです。
#==============================================================================

class Scene_Name
  def initialize(tabletype=0)
    @tabletype=tabletype
    end  
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  def main
    # アクターを取得
    @actor = $game_actors[$game_temp.name_actor_id]
    # ウィンドウを作成
    @edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char)
    @input_window = Window_NameInput.new(@tabletype)
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # ウィンドウを解放
    @edit_window.dispose
    @input_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # ウィンドウを更新
    @edit_window.update
    @input_window.update
    # B ボタンが押された場合
    if Input.repeat?(Input::B)
      # カーソル位置が 0 の場合
      if @edit_window.index == 0
        return
      end
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # 文字を削除
      @edit_window.back
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # カーソル位置が [決定] の場合
      if @input_window.character == nil
        # 名前が空の場合
        if @edit_window.name == ""
          # デフォルトの名前に戻す
          @edit_window.restore_default
          # 名前が空の場合
          if @edit_window.name == ""
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # 決定 SE を演奏
          $game_system.se_play($data_system.decision_se)
          return
        end
        # アクターの名前を変更
        @actor.name = @edit_window.name
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # マップ画面に切り替え
        $scene = Scene_Map.new
        return
      end
      # カーソル位置が最大の場合
      if @edit_window.index == $game_temp.name_max_char
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 文字が空の場合
      if @input_window.character == ""
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # 文字を追加
      @edit_window.add(@input_window.character)
      return
    end
  end
end

Khi nào muốn mở cửa sổ Input Name dùng
$scene = Scene_Name.new(n)

n tương ứng là:
English:1
Vietnamese:0
Nếu là mở bảng Viet Nam thì dùng Entẻ hero name cũng được,mún mở bảng english mới cần $scene = Scene_Name.new(1)
Tui sẽ viết mã để thay các bảng sau ^_^
 
Back
Top