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

Project1

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

[已经解决] LIVING STATUS MENU 出错

[复制链接]

Lv1.梦旅人

梦石
0
星屑
209
在线时间
104 小时
注册时间
2014-2-23
帖子
60
跳转到指定楼层
1
发表于 2014-2-24 16:29:42 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 huct08 于 2014-2-24 17:56 编辑

RUBY 代码复制
  1. =begin
  2.  ■ Information      ╒═════════════════════════════════════════════════════════╛
  3.  EST - LIVING STATUS MENU v1.2
  4.  by Estriole
  5.  
  6.  ■ License          ╒═════════════════════════════════════════════════════════╛
  7.  Free to use in all project (except the one containing pornography)
  8.  as long as i credited (ESTRIOLE).
  9.  
  10.  ■ Support          ╒═════════════════════════════════════════════════════════╛
  11.  While I'm flattered and I'm glad that people have been sharing and asking
  12.  support for scripts in other RPG Maker communities, I would like to ask that
  13.  you please avoid posting my scripts outside of where I frequent because it
  14.  would make finding support and fixing bugs difficult for both of you and me.
  15.    
  16.  If you're ever looking for support, I can be reached at the following:
  17.  ╔═════════════════════════════════════════════╗
  18.  ║       [url=http://www.rpgmakervxace.net/]http://www.rpgmakervxace.net/[/url]         ║
  19.  ╚═════════════════════════════════════════════╝
  20.  pm me : Estriole.
  21.  
  22.  ■ Introduction     ╒═════════════════════════════════════════════════════════╛
  23.  This script is requested by Furrari fullbuster from [url=http://www.rpgmakervxace.net/]http://www.rpgmakervxace.net/[/url]
  24.  it change status menu to be more lively and beautiful. first... it will
  25.  use potrait as the actor picture in status (you need to provide your own). if
  26.  the actor didnt have pictures. then it will use rescue picture.
  27.  second... you can use as many pictures of the same actor as you want to make it
  28.  animated. (require the basic knowledge on how to animate pictures and graphic
  29.  editing skills too). all the animating things is done with notetags (will fill
  30.  your notetags if you use a lot of pictures so not recommended for symphony user).
  31.  third... you can make the animation only run once or make it looped.
  32.  fourth... i give you some actor sound feature too. this script will play random
  33.  sound of the actor (you need to put notetags on how many sound this actor has).
  34.  else it will not play sound. combination of ANIMATED and SOUND make me name this
  35.  script LIVING STATUS MENU :D.
  36.  last one... use background image as status menu background.
  37.  
  38.  also... although this script is making your status menu COOL... you have to
  39.  remember that it have potential to increase your project size by quite a lot
  40.  (if you animate the potrait complexly. heck. even rotating magic circle take
  41.  me 12 images to make it not to choppy)
  42.  
  43.  so... WARNING FOR LAZY PEOPLE... don't use this script !!!!
  44.  
  45.  ■ Features         ╒═════════════════════════════════════════════════════════╛
  46.  * use potrait
  47.  * infinite number of potrait per actor to make it animated or just slideshow
  48.  * can do one time only animation or looped animation
  49.  * can play random sound of the actor
  50.  * use image as background
  51.  
  52.  ■ Changelog        ╒═════════════════════════════════════════════════════════╛
  53.  v1.0 2013.05.16           Initial Release
  54.  v1.1 2013.05.23     add compatibility to custom resolution. just change the
  55.                      DESCRIPTION_LINE_MOD in module estriole to change where
  56.                      the description drawn. for images you just need to resize it.
  57.  v1.2 2014.01.01     Happy New Year! add ability to have different background each actor
  58.                      just add another background.jpg (or .png) inside the
  59.                      living_status/actor_x/ folder
  60.                      change x to id of the actor using that background
  61.  
  62.  ■ Compatibility    ╒═════════════════════════════════════════════════════════╛
  63.  Definitely not compatible with YANFLY status menu script. :D.
  64.  tell me if another script not. since this have lots of overwrite in window_status
  65.  this script is expected to not compatible with script that modify that window.
  66.  
  67.  ■ How to use     ╒═════════════════════════════════════════════════════════╛
  68.  i will try to explain how to use this script. this is quite confusing if you
  69.  don't understand basic animation.
  70.  
  71.  >>>>  Graphic related  <<<<<<
  72.  -1) set background image.
  73.  put the image of your status menu background in folder
  74.  /Graphics/Pictures/living_status/
  75.  name it "background"
  76.  
  77.  from below... it's better to use png for potraits since it contain transparency.
  78.  0) set rescue potrait (so the game won't crash when you still didn't have
  79.  complete actor potrait).
  80.  put the image in
  81.  /graphics/pictures/living_status/
  82.  name the image "rescue.png"
  83.  now your game won't crash when you're developing it. so you can slowly adding
  84.  potrait one by one. also when you missing some image when animating. this picture
  85.  will also shown to tell you that image is missing.
  86.  
  87.  1) set actor potrait
  88.  create image size with the max width 325 pixel. (best result is 200 or 325 pixel)
  89.  put it in folder
  90.  /graphics/pictures/living_status/actor_x/
  91.  (change _x to _actorid)
  92.  name the image "1.png" (since png has transparency)
  93.  example
  94.  /graphics/pictures/living_status/actor_1/1.png
  95.  will set that picture as the 'first' picture of the actor 1.
  96.  
  97.  by doing so you already have potrait status menu. if you want it animated
  98.  another step must be done. BUT if you don't understand basic animation/frame/etc
  99.  Stop at this point rather than boiling your head. your status menu is already
  100.  pretty at this point if you done it right...
  101.  
  102.  2) animating actor potrait
  103.  basically you create another image which slightly different from first picture.
  104.  name it in sequence such as 2.png, 3.png, 4.png, etc.
  105.  put the images in they same folder as the 1.png.
  106.  now you have to understand frames before executing this section.
  107.  first define frame max for that actor potrait. by giving the actor notetags:
  108.  
  109.  <frame_max: 60>
  110.  
  111.  it will set the frame 0 to 60. so the animation will occur in 60 frames.
  112.  if you don't set the notetags by default frame max is what you set in module ESTRIOLE.
  113.  
  114.  second define how many pictures that actor animate. give actor notetags:
  115.  
  116.  <anim_max: 12>
  117.  
  118.  it means that actor have 12 pictures to animate
  119.  
  120.  third set the timing of the animation change. give notetags to actor
  121.  <frame_anim_1: 0, 5>
  122.  means 1.png will shown from 0 to 5 frame
  123.  <frame_anim_2: 5, 10>
  124.  means 2.png will shown from 5 to 10 frame
  125.  <frame_anim_3: 10, 15>
  126.  means 3.png will shown from 10 to 15 frame
  127.  <frame_anim_4: 15, 20>
  128.  means 4.png will shown from 15 to 20 frame
  129.  done that until all your pictures given animation set.
  130.  warning... the first number in notetags must be lower than second number.
  131.  also one picture can only used once. (still thinking another way to prevent that
  132.  i have a way already using array and another for. but will make user hard to use).
  133.  also if at that frame no image specified... it will automatically use 1.png.
  134.  
  135.  now you got yourself animated picture.
  136.  
  137.  3) making looped animation
  138.  after setting above. you could give notetags to loop animation. give the actor:
  139.  <loop_to: x>
  140.  x -> frame number
  141.  <loop_to: 0>
  142.  will loop it back to frame 0 continuosly.
  143.  <loop_to: 100>
  144.  will loop it back to frame 100 continuosly. useful when you want to make actor
  145.  talking animation + another animation. then loop without the talking animation.
  146.  
  147.  >>>>  Sound related  <<<<<<
  148.  1) put the actor voice files in
  149.  /Audio/SE/living_status/actor_#/
  150.  name it sequentialy.
  151.  ex:
  152.  /Audio/SE/living_status/actor_1/1.ogg
  153.  /Audio/SE/living_status/actor_1/2.ogg
  154.  /Audio/SE/living_status/actor_1/3.ogg
  155.  will give the actor 3 sounds.
  156.  2) set the notetags telling that this actor has three sounds
  157.  <op_voices_num: 3>
  158.  here you go... now your actor will tell random sound everytime you view their
  159.  status menu :D.
  160.  
  161.  if you're confused. just look at the demo project folder.
  162.  
  163.  ■ Author's Notes   ╒═════════════════════════════════════════════════════════╛
  164.  This script is quite hard to use. need to understand basic of animating
  165.  pictures. also only one layer provided so it's limited animation.
  166.  future patch plan (if i'm not busy)
  167.  - sound effect in animation
  168.  - tell me...
  169.    
  170. =end
  171.  
  172. ###       CONFIGURATION       ##################################################
  173. module ESTRIOLE
  174.   module STATUS
  175.     USE_DESCRIPTION = true #true will show actor description   
  176.     DEFAULT_FRAME_MAX = 300 #default frame max of actor animation
  177.     DESCRIPTION_LINE_MOD = 14 #change this if you're using custom resolution.
  178.                               #if not 14 is ok. 14 means you draw the description
  179.                               #at 14th line
  180.   end
  181. end
  182.  
  183. class RPG::Actor < RPG::BaseItem
  184.   def frame_max
  185.     return nil if !note[/<frame_max:(.*)>/i]
  186.     a = note[/<frame_max:(.*)>/i].scan(/:(.*)/).flatten[0].scan(/(?:"(.*?)"| (\w+)|(\w+),|,(\w+))/).flatten.compact
  187.     return noteargs = a[0].to_i
  188.   end
  189.   def anim_max
  190.     return 1 if !note[/<anim_max:(.*)>/i]
  191.     a = note[/<anim_max:(.*)>/i].scan(/:(.*)/).flatten[0].scan(/(?:"(.*?)"| (\w+)|(\w+),|,(\w+))/).flatten.compact
  192.     return noteargs = a[0].to_i
  193.   end
  194.   def frame_change(index)
  195.     return nil if !note[/<frame_anim_#{index}:(.*)>/i]
  196.     a = note[/<frame_anim_#{index}:(.*)>/i].scan(/:(.*)/).flatten[0].scan(/(?:"(.*?)"| (\w+)|(\w+),|,(\w+))/).flatten.compact
  197.     return noteargs = [a[0].to_i,a[1].to_i]
  198.   end
  199.   def anim_loop_to?
  200.     return nil if !note[/<loop_to:(.*)>/i]
  201.     a = note[/<loop_to:(.*)>/i].scan(/:(.*)/).flatten[0].scan(/(?:"(.*?)"| (\w+)|(\w+),|,(\w+))/).flatten.compact
  202.     return noteargs = a[0].to_i   
  203.   end
  204.   def voices_num
  205.     return nil if !note[/<op_voices_num:(.*)>/i]
  206.     a = note[/<op_voices_num:(.*)>/i].scan(/:(.*)/).flatten[0].scan(/(?:"(.*?)"| (\w+)|(\w+),|,(\w+))/).flatten.compact
  207.     return noteargs = a[0].to_i
  208.   end
  209. end
  210.  
  211. class Scene_Status < Scene_MenuBase
  212.   include ESTRIOLE::STATUS
  213.   alias est_living_status_start start
  214.   def start
  215.     est_living_status_start
  216.     @frame_count = 0
  217.     play_random_actor_sound
  218.   end
  219.   alias est_living_status_next_actor next_actor
  220.   def next_actor
  221.     @status_window.actor_anim_index = 1
  222.     @frame_count = 0
  223.     est_living_status_next_actor
  224.     4.times do update end
  225.     RPG::SE.stop
  226.     play_random_actor_sound
  227.   end
  228.   alias est_living_status_prev_actor prev_actor  
  229.   def prev_actor
  230.     @status_window.actor_anim_index = 1
  231.     @frame_count = 0
  232.     est_living_status_prev_actor
  233.     4.times do update end
  234.     RPG::SE.stop
  235.     play_random_actor_sound
  236.   end
  237.   def play_random_actor_sound
  238.     return unless @actor.actor.voices_num
  239.     a = ([url=mailto:1..@actor.actor.voices_num]1..@actor.actor.voices_num[/url]).to_a.sample
  240.     RPG::SE.new("/living_status/actor_#{@actor.actor.id}/#{a}", 100, 100).play
  241.   end
  242.  
  243.   def update
  244.     super
  245.     frame_max = DEFAULT_FRAME_MAX
  246.     frame_max = @actor.actor.frame_max if @actor.actor.frame_max
  247.     old_index = @status_window.actor_anim_index
  248.     @frame_count = @actor.actor.anim_loop_to? if @frame_count == frame_max && @actor.actor.anim_loop_to?
  249.     @frame_count += 1
  250.     @frame_count = [@frame_count,frame_max].min
  251.     @status_window.actor_anim_index = 1
  252.     anim_max = 3
  253.     anim_max = @actor.actor.anim_max if @actor.actor.anim_max
  254.     for i in 1..anim_max
  255.       @status_window.actor_anim_index = i if @actor.actor.frame_change(i) &&
  256.                                              @frame_count >= @actor.actor.frame_change(i)[0] &&
  257.                                              @frame_count <= @actor.actor.frame_change(i)[1]
  258.     end   
  259.     @status_window.refresh if old_index != @status_window.actor_anim_index
  260.   end
  261. end
  262.  
  263. class Window_Status < Window_Selectable
  264.   include ESTRIOLE::STATUS
  265.   attr_accessor :actor_anim_index
  266.   attr_reader :actor_potrait
  267.   def initialize(actor)
  268.     super(0, 0, Graphics.width, Graphics.height)
  269.     @actor = actor
  270.     create_background
  271.     create_potrait
  272.     refresh
  273.     activate
  274.   end
  275.   def terminate
  276.     super
  277.     dispose_background
  278.     dispose_potrait
  279.   end
  280.   def create_potrait
  281.     @actor_potrait = Sprite.new
  282.     @actor_potrait.x = 304 - 50
  283.     @actor_potrait.y = line_height * 3
  284.     @actor_potrait.z = self.z if !USE_DESCRIPTION
  285.     @actor_anim_index = 1
  286.   end
  287.   def create_background
  288.     @background_sprite = Sprite.new
  289.     @background_sprite.bitmap = Cache.picture("/living_status/actor_#{@actor.actor.id}/background") rescue Cache.picture("/living_status/background") rescue nil
  290.     self.opacity = 0 if @background_sprite.bitmap
  291.     @background_sprite.bitmap = SceneManager.background_bitmap if @background_sprite.bitmap == nil
  292.   end
  293.   def dispose_background
  294.     @background_sprite.dispose
  295.   end  
  296.   def dispose_potrait
  297.     @actor_potrait.dispose
  298.   end
  299.   def actor=(actor)
  300.     return if @actor == actor
  301.     @actor = actor
  302.     dispose_background
  303.     create_background
  304.     refresh
  305.   end
  306.   def refresh
  307.     contents.clear
  308.     draw_block1   (line_height * 0)
  309.     draw_horz_line(line_height * 2)
  310.     draw_block2   (line_height * 3)
  311.     draw_custom_horz_line(line_height * 6,200)
  312.     draw_block3   (line_height * 7)
  313.     draw_horz_line(line_height * (DESCRIPTION_LINE_MOD-1)) if USE_DESCRIPTION
  314.     draw_block4   (line_height * DESCRIPTION_LINE_MOD) if USE_DESCRIPTION
  315.   end
  316.   def draw_actor_name(actor, x, y, width = 325)
  317.     change_color(system_color)
  318.     draw_text(x, y, width, line_height, "Name  ")   
  319.     change_color(normal_color)
  320.     draw_text(x+80, y, width-80, line_height, actor.name)
  321.   end  
  322.   def draw_actor_class(actor, x, y, width = 325)
  323.     if $imported["YEA-ClassSystem"] && !actor.subclass.nil?
  324.       fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT
  325.       text = sprintf(fmt, actor.class.name, actor.subclass.name)
  326.     else
  327.       text = actor.class.name
  328.     end
  329.     change_color(system_color)
  330.     draw_text(x, y, width, line_height, "Class ")
  331.     change_color(normal_color)
  332.     draw_text(x+80, y, width-80, line_height, text)
  333.   end
  334.   def draw_basic_info(x, y)
  335.     draw_actor_level(@actor, x, y + line_height * 0)
  336.     draw_actor_icons(@actor, x + 70, y + line_height * 0)
  337.     draw_actor_hp(@actor, x, y + line_height * 1,170)
  338.     draw_actor_mp(@actor, x, y + line_height * 2,170)
  339.   end  
  340.   def draw_exp_info(x, y)
  341.     s1 = @actor.max_level? ? "-------" : @actor.exp
  342.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  343.     change_color(system_color)
  344.     draw_text(x, y + line_height * 0, 180, line_height, "EXP")
  345.     draw_text(x, y + line_height * 1, 180, line_height, "Next")
  346.     change_color(normal_color)
  347.     draw_text(x, y + line_height * 0, 180, line_height, s1, 2)
  348.     draw_text(x, y + line_height * 1, 180, line_height, s2, 2)
  349.   end
  350.   def draw_parameters(x, y)
  351.     6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
  352.   end
  353.   def draw_actor_param(actor, x, y, param_id)
  354.     change_color(system_color)
  355.     draw_text(x, y, 120, line_height, Vocab::param(param_id))
  356.     change_color(normal_color)
  357.     draw_text(x + 100, y, 36, line_height, actor.param(param_id), 2)
  358.   end
  359.   def draw_block1(y)
  360.     draw_actor_name(@actor, 20, y)
  361.     draw_actor_class(@actor, 20, y + line_height)
  362.     draw_exp_info(304, y)
  363.   end
  364.   def draw_block2(y)
  365.     draw_basic_info(20, y)
  366.     draw_potraits(288, y)
  367.   end
  368.   def draw_potraits(x,y)
  369.     @actor_potrait.bitmap = Cache.picture("/living_status/actor_#{@actor.actor.id}/#{@actor_anim_index}") rescue rescue_potrait
  370.   end
  371.   def rescue_potrait
  372.     Cache.picture("/living_status/rescue")
  373.   end
  374.   def draw_block3(y)
  375.     draw_parameters(20, y)
  376.   end
  377.   def draw_block4(y)
  378.     draw_description(4, y)
  379.   end
  380.   def draw_horz_line(y)
  381.     line_y = y + line_height / 2 - 1
  382.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  383.   end
  384.   def draw_custom_horz_line(y,w)
  385.     line_y = y + line_height / 2 - 1
  386.     contents.fill_rect(0, line_y, w, 2, line_color)
  387.   end
  388.   def line_color
  389.     color = normal_color
  390.     color.alpha = 48
  391.     color
  392.   end
  393.   def draw_description(x, y)
  394.     draw_text_ex(x, y, @actor.description)
  395.   end
  396. end




我按照说明把背景图片和rescue图片都准备好了,但是一进状态栏还是跳出错误



Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21845
在线时间
9438 小时
注册时间
2012-6-19
帖子
7120

开拓者短篇九导演组冠军

2
发表于 2014-2-24 16:43:03 | 只看该作者
虽然不知道为什么出错,不过如果你没有使用YEA的脚本的话
把323~328行的下面这些代码
RUBY 代码复制
  1. if $imported["YEA-ClassSystem"] && !actor.subclass.nil?
  2.       fmt = YEA::CLASS_SYSTEM::SUBCLASS_TEXT
  3.       text = sprintf(fmt, actor.class.name, actor.subclass.name)
  4.     else
  5.       text = actor.class.name
  6.     end

改成这个:
RUBY 代码复制
  1. text = actor.class.name

试试看
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
209
在线时间
104 小时
注册时间
2014-2-23
帖子
60
3
 楼主| 发表于 2014-2-24 17:26:12 | 只看该作者
喵呜喵5 发表于 2014-2-24 16:43
虽然不知道为什么出错,不过如果你没有使用YEA的脚本的话
把323~328行的下面这些代码
if $imported["YEA-Cl ...

谢谢{:2_249:}  不过又出现新的问题了

回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21845
在线时间
9438 小时
注册时间
2012-6-19
帖子
7120

开拓者短篇九导演组冠军

4
发表于 2014-2-24 17:44:53 | 只看该作者
本帖最后由 喵呜喵5 于 2014-2-24 17:47 编辑
huct08 发表于 2014-2-24 17:26
谢谢  不过又出现新的问题了


又见论坛代码强制改脚本……= =

原始代码怎么样的我不知道,试着改成这样:
a = ([email protected]_num).to_a.sample

点评

请无视被论坛强行加入进去的[email]  发表于 2014-2-24 17:48
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
209
在线时间
104 小时
注册时间
2014-2-23
帖子
60
5
 楼主| 发表于 2014-2-24 17:56:31 | 只看该作者
喵呜喵5 发表于 2014-2-24 17:44
又见论坛代码强制改脚本……= =

原始代码怎么样的我不知道,试着改成这样:

十分感谢!{:2_249:}
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-27 04:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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