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

Project1

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

[已经解决] 立繪顯示的問題(\f[檔名])

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
158 小时
注册时间
2016-1-7
帖子
129
跳转到指定楼层
1
发表于 2016-3-2 02:24:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 燕征 于 2016-5-25 23:12 编辑

解決方法參照此篇: [已经解决] 臉圖使用方式

首先,我參考站內這篇[已经解决] 立繪顯示在對話框前下去做

接著主述我的問題:
因為我有選角問題,像是之前名字的顯示靠的是\n[\v[變數]]這個做法(詳見之前的此篇問答 事件的文字顯示能判定當前主角是誰來顯示名字嗎?)
先試著正常的做法確認了立繪用\f[檔名]可以顯示後,我就試著也用顯示名字的做法寫看看,結果果然不行

嘗試後果然不行的作法:
我之前在貼出來的腳本裡的 # 加入選擇的角色 下面寫了這些 ,大意是選完角色後要把它相關的東西用另外的變數存起來
RUBY 代码复制
  1. # 用來存放角色名字提供對話事件使用,51是日常,52是全名,53存立繪名
  2.       case id
  3.       when 1  #阿萊查
  4.         $game_variables[51] = 3
  5.         $game_variables[52] = 1
  6.         $game_variables[53] = "阿萊查‧尤雅波"
  7.         $game_variables[54] = "立繪_阿萊查"
  8.       when 2  #亞藍娃
  9.         $game_variables[51] = 4
  10.         $game_variables[52] = 2
  11.         $game_variables[53] = "亞藍娃‧尤雅波"
  12.         $game_variables[54] = "立繪_亞藍娃"
  13.       end

我在文字顯示時試圖用 \f[\v[54]]讓他可以顯示立繪,可是失敗了 → 執行時會顯示 \n[立繪_XXX] 而不是圖片

到底為什麼不能這麼做呢?不能這麼做我又可以怎麼做呢?

(習慣性把覺得相關的問題都做個連結放在一起: [已经解决] 如何控制臉圖(立繪)大小)

Lv1.梦旅人

梦石
0
星屑
50
在线时间
158 小时
注册时间
2016-1-7
帖子
129
2
 楼主| 发表于 2016-3-8 02:52:37 | 只看该作者
我就是,讓問題浮上來下求個解不是想賺經驗和發廢文QQ
然後補上面片段的整個腳本,就不讓大家輾轉透過連結去看了(因為連結裡的腳本還不是現在更動的那樣)。

上面的片段是在 229~240
  1. #==============================================================================

  2. #----------人物選擇 1.00版----------#
  3. #─版權屬於Agoの軌道物語和RM咖啡館(先行者)所有─
  4. #Agoの軌道物語:https://sites.google.com/site/agonoguidaowuyu
  5. #RM咖啡館:https://sites.google.com/site/hoctorrmfactory

  6. #--------------------------------------------------------------------------
  7. # 可用來作為遊戲一開始的角色選擇和劇情分歧時的角色選擇,
  8. # 爲了不讓FPS下滑,所以幾乎都是在Scene場景類描繪,
  9. # 其實效果滿陽春的,自己可以操作看看。
  10. #--------------------------------------------------------------------------

  11. #Agoの軌道物語:https://sites.google.com/site/agonoguidaowuyu
  12. #RM咖啡館:https://sites.google.com/site/hoctorrmfactory
  13. #─版權屬於Agoの軌道物語和RM咖啡館(先行者)所有─
  14. #----------人物選擇 1.00版----------#

  15. #==============================================================================
  16.   #--------------------------------------------------------------------------
  17.   # ● 人物選擇自定義區
  18.   #--------------------------------------------------------------------------
  19.   # 設定參與選擇的角色ID,最多為四人
  20.   ## 參考: 資料庫 >> 角色
  21.   ACTORS = [1,2]
  22.   # 顯示選擇角色的圖像,0為行走圖、1為戰鬥圖、2為自定義
  23.   PICTRUE = 1
  24.   
  25.   # 角色說明,格式為ACTORS_HELP[角色ID] = "字串"
  26.   ACTORS_HELP = [] # 初始化角色說明
  27.   ACTORS_HELP[1] = "男"
  28.   ACTORS_HELP[2] = "女"
  29.   # 設定說明字串的大小
  30.   ACTORS_HELP_FONT_SIZE = 18
  31.   
  32.   # 顯示背景,0為地圖、1為自定義
  33.   BACK = 0
  34.   # 若使用自訂義時設定圖片路徑
  35.   #BACK_PICTRUE = RPG::Cache.picture("人物選擇[背景]")
  36. #==============================================================================

  37. class Scene_SelectActor_Start
  38.   #--------------------------------------------------------------------------
  39.   # ● 初始化目標
  40.   #     menu_index : 命令游標的初期位置
  41.   #--------------------------------------------------------------------------
  42.   def initialize(select_actor_index = 0)
  43.     @select_actor_index = select_actor_index
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 主處理
  47.   #--------------------------------------------------------------------------
  48.   def main
  49.     @actors_index = 0 # 初始化選項
  50.     @pictrues = [] # 初始化圖像
  51.     @actors_pic = [] # 初始化立繪
  52.     @actors_help = [] # 初始化角色名稱
  53.     # 描繪角色說明的外框
  54.     @help = Sprite.new
  55.     @help.bitmap = Bitmap.new(640,480)
  56.     @help.y = 412
  57.     @help.z = 9998
  58.     for i in 0...164
  59.       @help.bitmap.fill_rect(i*2,0,2,1,Color.new(255,255,255,5*i))
  60.       @help.bitmap.fill_rect(652-i*2,0,2,1,Color.new(255,255,255,5*i))
  61.       @help.bitmap.fill_rect(i*2,39,2,1,Color.new(255,255,255,5*i))
  62.       @help.bitmap.fill_rect(652-i*2,39,2,1,Color.new(255,255,255,5*i))
  63.       @help.bitmap.fill_rect(i*2,1,2,37,Color.new(0,0,0,5*i))
  64.       @help.bitmap.fill_rect(652-i*2,1,2,37,Color.new(0,0,0,5*i))
  65.     end
  66.     # 判定BACK的數值做背景的描繪
  67.     if BACK == 0
  68.       @back = Spriteset_Map.new
  69.     elsif BACK == 1
  70.       @back = RPG::Sprite.new
  71.       @back.bitmap = BACK_PICTRUE
  72.     end
  73.     # 初始化說明視窗
  74.     @help_window = Window_Help.new
  75.     @help_window.x = 0
  76.     @help_window.y = 400
  77.     @help_window.width = 640
  78.     @help_window.z = 9999
  79.     @help_window.opacity = 0
  80.     @help_window.back_opacity = 0
  81.     @help_window.contents.font.size = ACTORS_HELP_FONT_SIZE
  82.     # 讀取使用者所設定的角色
  83.     for i in 0...ACTORS.size
  84.       # 處理角色名字顯示
  85.       actor = $game_actors[ACTORS[i]]
  86.       @actors_help[i] = RPG::Sprite.new
  87.       @actors_help[i].bitmap = Bitmap.new(640,480)
  88.       @actors_help[i].x =  i * 160
  89.       for c in 0...180
  90.         @actors_help[i].bitmap.fill_rect(i, c*1,160 ,3 ,Color.new(0,0,0,255-c*1.5))
  91.         @actors_help[i].bitmap.fill_rect(i, 300+c*1,160 ,3 ,Color.new(0,0,0,c*2))
  92.       end
  93.       @actors_help[i].z = 999
  94.       @actors_help[i].bitmap.draw_text(0, 10,120, 32, actor.name, 2)  
  95.       # 偵測角色的圖像為何
  96.       case PICTRUE
  97.       # 設定的角色圖像為行走圖時
  98.       when 0
  99.         # 處理角色行走圖的內容
  100.         @pictrues[i] = RPG::Sprite.new
  101.         @pictrues[i].bitmap = Bitmap.new(640,480)
  102.         bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  103.         @pictrues[i].bitmap.blt(75+i*160,230,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4),255)
  104.         for b in 0...240
  105.           @pictrues[i].bitmap.fill_rect(9+i*160,b*1,1,2,Color.new(255,255,255,b*5))
  106.           @pictrues[i].bitmap.fill_rect(9+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  107.           @pictrues[i].bitmap.fill_rect(170+i*160,b*1,1,2,Color.new(255,255,255,b*5))
  108.           @pictrues[i].bitmap.fill_rect(170+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  109.         end
  110.       # 設定的角色圖像為戰鬥圖時
  111.       when 1
  112.         # 處理角色戰鬥圖的內容
  113.         @pictrues[i] = RPG::Sprite.new
  114.         @pictrues[i].bitmap = Bitmap.new(640,480)
  115.         bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  116.         @pictrues[i].bitmap.blt(30+i*175,160,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
  117.         for b in 0...240
  118.           @pictrues[i].bitmap.fill_rect(9+i*160,b*1,1,2,Color.new(255,255,255,b*5))
  119.           @pictrues[i].bitmap.fill_rect(9+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  120.           @pictrues[i].bitmap.fill_rect(170+i*160,b*1,1,2,Color.new(255,255,255,b*5))
  121.           @pictrues[i].bitmap.fill_rect(170+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  122.         end
  123.       # 設定的角色圖像為自定義時
  124.       when 2
  125.         # 處理角色自定義圖形的內容
  126.         @pictrues[i] = RPG::Sprite.new
  127.         @pictrues[i].bitmap = Bitmap.new(640,480)
  128.         @pictrues[i].opacity = 100
  129.         bitmap = RPG::Cache.picture(actor.name.to_s+"I")
  130.         @pictrues[i].bitmap.blt(i*160,30,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
  131.         for b in 0...240
  132.           @pictrues[i].bitmap.fill_rect(i*160,b*1,1,2,Color.new(255,255,255,b*5))
  133.           @pictrues[i].bitmap.fill_rect(i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  134.           @pictrues[i].bitmap.fill_rect(160+i*160,b*1,1,2,Color.new(255,255,255,b*5))
  135.           @pictrues[i].bitmap.fill_rect(160+i*160,480-b*1,1,2,Color.new(255,255,255,b*5))
  136.         end
  137.         # 處理角色人數若未超過 3 時的立繪
  138.         @actors_pic[i] = RPG::Sprite.new
  139.         @actors_pic[i].bitmap = Bitmap.new(640,480)
  140.         bitmap = RPG::Cache.picture(actor.name.to_s)
  141.         @actors_pic[i].bitmap.blt(i*160,30,bitmap,Rect.new(0,0,bitmap.width,bitmap.height),255)
  142.         @actors_pic[i].x = 1200
  143.         @actors_pic[i].y = 250
  144.         @actors_pic[i].ox = @actors_pic[i].bitmap.width / 2
  145.         @actors_pic[i].oy = @actors_pic[i].bitmap.height / 2
  146.       end
  147.     end
  148.     # 執行過渡
  149.     Graphics.transition
  150.     # 主循環
  151.     loop do
  152.       # 更新遊戲畫面
  153.       Graphics.update
  154.       # 更新輸入訊息
  155.       Input.update
  156.       # 更新畫面
  157.       update
  158.       # 如果切換畫面就中斷循環
  159.       if $scene != self
  160.         break
  161.       end
  162.     end
  163.     # 準備過渡
  164.     Graphics.freeze
  165.     # 釋放角色相關圖形
  166.     for i in 0...ACTORS.size
  167.       @actors_help[i].dispose
  168.       @actors_help[i].bitmap.dispose
  169.       @pictrues[i].dispose
  170.       @pictrues[i].bitmap.dispose
  171.       if PICTRUE == 2
  172.         @actors_pic[i].dispose
  173.         @actors_pic[i].bitmap.dispose
  174.       end
  175.     end
  176.     # 釋放背景
  177.     @back.dispose
  178.     # 釋放說明視窗
  179.     @help_window.dispose
  180.     # 釋放描繪說明視窗圖形
  181.     @help.dispose
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 更新畫面
  185.   #--------------------------------------------------------------------------
  186.   def update
  187.     # 更新選項
  188.     command_index   
  189.     # 更新說明視窗
  190.     @help_window_update
  191.     actor_id = ACTORS[@actors_index]
  192.     # 沒被選中的角色
  193.     unchose_actor_id = 0
  194.     text = ACTORS_HELP[actor_id].to_s
  195.     @help_window.set_text(text,1) if text != nil
  196.     # 如果按上的情況
  197.     if Input.trigger?(Input::C)
  198.       # 播放確定音效
  199.       $game_system.se_play($data_system.decision_se)
  200.       # 讀取角色
  201.       for i in 0...$game_party.actors.size
  202.         id = $game_party.actors[i].id
  203.         
  204.         # 判斷選定角色id用以判斷 unchose_actor_id
  205.         case i
  206.         when 0
  207.           unchose_actor_id = $game_party.actors[1].id
  208.         when 1
  209.           unchose_actor_id = $game_party.actors[0].id
  210.         end
  211.         
  212.         actors_id = [] if actors_id == nil
  213.         actors_id.push(id)
  214.       end
  215.       # 刪除角色
  216.       #actors_id.each do |i|
  217.         #$game_party.remove_actor(i)
  218.       #end
  219.       # 加入選擇的角色
  220.       id = ACTORS[@actors_index]
  221.       $game_party.add_actor(id)
  222.       
  223.       # 用來存放角色名字提供對話事件使用,51是日常,52是全名
  224.       case id
  225.       when 1  #阿萊查
  226.         $game_variables[51] = 3
  227.         $game_variables[52] = 1
  228.         $game_variables[53] = "阿萊查‧尤雅波"
  229.         $game_variables[54] = "立繪_阿萊查"
  230.       when 2  #亞藍娃
  231.         $game_variables[51] = 4
  232.         $game_variables[52] = 2
  233.         $game_variables[53] = "亞藍娃‧尤雅波"
  234.         $game_variables[54] = "立繪_亞藍娃"
  235.       end
  236.       
  237.       
  238.       # 刪除另一隻主角
  239.       $game_party.remove_actor(unchose_actor_id)
  240.       
  241.       $scene = Scene_Map.new
  242.     end
  243.     # 判定是否使用自訂角色圖
  244.     if PICTRUE == 2
  245.       # 如果角色人數小於 3 時
  246.       if ACTORS.size < 3
  247.         # 讀取選項
  248.         case @actors_index
  249.         when 0
  250.           @actors_pic[0].x -= 20 if @actors_pic[0].x != 600
  251.           @actors_pic[0].x = 600 if @actors_pic[0].x < 600
  252.           @actors_pic[0].opacity += 30
  253.           @actors_pic[1].x += 20 if @actors_pic[1].x != 1200
  254.           @actors_pic[1].x = 1200 if @actors_pic[1].x > 1200
  255.           @actors_pic[1].opacity -= 30
  256.         when 1
  257.           @actors_pic[1].x -= 20 if @actors_pic[1].x != 450
  258.           @actors_pic[1].x = 450 if @actors_pic[1].x < 450
  259.           @actors_pic[1].opacity += 30
  260.           @actors_pic[0].x += 20 if @actors_pic[0].x != 1200
  261.           @actors_pic[0].x = 1200 if @actors_pic[0].x > 1200
  262.           @actors_pic[0].opacity -= 30
  263.         end
  264.       end
  265.     end
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 更新選項
  269.   #--------------------------------------------------------------------------
  270.   def command_index
  271.     # 如果按取消時
  272.     if Input.trigger?(Input::B)
  273.       # 演奏取消 SE
  274.       $game_system.se_play($data_system.cancel_se)
  275.       # 切換到地圖畫面
  276.       $scene = Scene_Map.new
  277.       return
  278.     end
  279.     case ACTORS.size
  280.     when 1
  281.       @actors_index = 0
  282.     when 2
  283.     # 如果按←時
  284.       if Input.trigger?(Input::LEFT)
  285.         @actors_index -= 1
  286.         if @actors_index < 0
  287.           @actors_index = 1
  288.         end
  289.         $game_system.se_play($data_system.cursor_se)
  290.       end
  291.       # 如果按→時
  292.       if Input.trigger?(Input::RIGHT)
  293.         @actors_index += 1
  294.         if @actors_index > 1
  295.           @actors_index = 0
  296.         end
  297.         $game_system.se_play($data_system.cursor_se)
  298.       end
  299.     when 3
  300.     # 如果按←時
  301.       if Input.trigger?(Input::LEFT)
  302.         @actors_index -= 1
  303.         if @actors_index < 0
  304.           @actors_index = 2
  305.         end
  306.         $game_system.se_play($data_system.cursor_se)
  307.       end
  308.       # 如果按→時
  309.       if Input.trigger?(Input::RIGHT)
  310.         @actors_index += 1
  311.         if @actors_index > 2
  312.           @actors_index = 0
  313.         end
  314.         $game_system.se_play($data_system.cursor_se)
  315.       end
  316.     when 4
  317.     # 如果按←時
  318.       if Input.trigger?(Input::LEFT)
  319.         @actors_index -= 1
  320.         if @actors_index < 0
  321.           @actors_index = 3
  322.         end
  323.         $game_system.se_play($data_system.cursor_se)
  324.       end
  325.       # 如果按→時
  326.       if Input.trigger?(Input::RIGHT)
  327.         @actors_index += 1
  328.         if @actors_index > 3
  329.           @actors_index = 0
  330.         end
  331.         $game_system.se_play($data_system.cursor_se)
  332.       end
  333.     end
  334.     case @actors_index
  335.     when 0
  336.       @pictrues[0].opacity = 255
  337.       @pictrues[1].opacity = 100
  338.       if ACTORS.size == 3
  339.         @pictrues[2].opacity = 100
  340.       elsif ACTORS.size == 4
  341.         @pictrues[2].opacity = 100
  342.         @pictrues[3].opacity = 100
  343.       end
  344.     when 1
  345.       @pictrues[0].opacity = 100
  346.       @pictrues[1].opacity = 255
  347.       if ACTORS.size == 3
  348.         @pictrues[2].opacity = 100
  349.       elsif ACTORS.size == 4
  350.         @pictrues[2].opacity = 100
  351.         @pictrues[3].opacity = 100
  352.       end
  353.     when 2
  354.       @pictrues[0].opacity = 100
  355.       @pictrues[1].opacity = 100
  356.       @pictrues[2].opacity = 255
  357.       if ACTORS.size == 4
  358.         @pictrues[3].opacity = 100
  359.       end
  360.     when 3
  361.       @pictrues[0].opacity = 100
  362.       @pictrues[1].opacity = 100
  363.       @pictrues[2].opacity = 100
  364.       @pictrues[3].opacity = 255
  365.     end
  366.   end
  367. end
  368.   #--------------------------------------------------------------------------
  369.   # ● 處理要選擇的人數大於 4 時
  370.   #--------------------------------------------------------------------------
  371.   if ACTORS.size > 4
  372.     print "不好意思,本腳本設定的人數大於4,請刪除人數為5以下"
  373.     exit
  374.   end
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 15:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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