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

Project1

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

[已经解决] 请问怎么做出镜子的效果

[复制链接]

Lv2.观梦者

梦石
0
星屑
585
在线时间
58 小时
注册时间
2020-8-21
帖子
21

极短22参与

跳转到指定楼层
1
发表于 2022-2-27 17:28:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
5星屑
在这个论坛,我能搜到的脚本,不知道为什么都没法用...

最佳答案

查看完整内容

在网址https://galvs-scripts.com/2013/02/21/character-effects/找到的,你试试 #------------------------------------------------------------------------------# # Galv's Character Effects #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 2.1 #------------------------------------------------------------------------------# # 2014-01-16 ...

Lv3.寻梦者

梦石
0
星屑
2436
在线时间
212 小时
注册时间
2022-1-17
帖子
230
2
发表于 2022-2-27 17:28:56 | 只看该作者
在网址https://galvs-scripts.com/2013/02/21/character-effects/找到的,你试试
RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Character Effects
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 2.1
  6. #------------------------------------------------------------------------------#
  7. #  2014-01-16 - Version 2.1 - Fixed double balloon/animation bug with shadows
  8. #  2013-12-07 - Version 2.0 - Added comments to more easily add event effects
  9. #                           - Fixed shadow facing bug
  10. #  2013-02-24 - Version 1.9 - added z level option for reflection and shadows
  11. #  2013-02-23 - Version 1.8 - added multiple light sources for shadows
  12. #  2013-02-22 - Version 1.7 - bug fixes
  13. #  2013-02-22 - Version 1.6 - added icon effect
  14. #  2013-02-22 - Version 1.5 - fixed mirror bug on large maps
  15. #  2013-02-22 - Version 1.4 - added effects to vehicles
  16. #  2013-02-21 - Version 1.3 - fixed jump reflection and other minor tweaks
  17. #  2013-02-21 - Version 1.2 - bug with less than 4 actors (oops)
  18. #  2013-02-21 - Version 1.1 - updated flicker effect
  19. #  2013-02-21 - Version 1.0 - release
  20. #------------------------------------------------------------------------------#
  21. #  This script was made to provide some additional effects for characters such
  22. #  as events, followers and the player on the map.
  23. #  Currently it includes:
  24. #
  25. #  Shadows
  26. #  Shadows that appear under player and events in a directions depending on
  27. #  a light source that you choose.
  28. #
  29. #  Parallax Reflect
  30. #  Reflections that appear on the parallax layer for events and actors to be
  31. #  used for things like reflections in the water or glass floor etc. To get
  32. #  effects like the demo, you need to edit the charset graphic to make the water
  33. #  partially transparent.
  34. #
  35. #  Parallax Mirrors
  36. #  Much like reflect but are instead actors and event are reflected in a mirror
  37. #  on a wall designated by a region. Both mirror and reflect effects can be
  38. #  changed so actors and events can use different charsets for their reflections
  39. #
  40. #------------------------------------------------------------------------------#
  41.  
  42.  
  43. #------------------------------------------------------------------------------#
  44. #  NEW - First event command as a COMMENT
  45. #------------------------------------------------------------------------------#
  46. #  You can add a comment as the first event command on an event page to set if
  47. #  that event has an icon, shadow or reflection active. The tags to use are
  48. #  below, all must be on the same line in the comment.
  49. #
  50. # <icon:id,x,y>      # set the event to display an icon (x,y position offset)
  51. # <shadow>           # set the event to display a shadow
  52. # <reflect>          # set the event to display reflections
  53. #
  54. #------------------------------------------------------------------------------#
  55. #  EXAMPLE:
  56. # <icon:1,0,0><shadow><reflect>    # to show reflect, shadow and icon 1 on event
  57. #------------------------------------------------------------------------------#
  58.  
  59.  
  60. #------------------------------------------------------------------------------#
  61. #  SCRIPT CALLS:
  62. #------------------------------------------------------------------------------#
  63. #
  64. #  char_effects(x,x,x,status)
  65. #
  66. #------------------------------------------------------------------------------#
  67. #  # each effect can be true or false to enable/disable them during the game.
  68. #  # you can change multiples of effects at once, x being the effect number
  69. #  # 0 = reflect    1 = shadows    2 = mirror    3 = icons
  70. #------------------------------------------------------------------------------#
  71. #  EXAMPLES:
  72. #  char_effects(0,true)              # turn reflections on
  73. #  char_effects(0,2,true)            # turn reflections and mirror on
  74. #  char_effects(1,3,false)           # turn shadows and icons off
  75. #------------------------------------------------------------------------------#
  76. #
  77. #  reflect_sprite(actor_id,filename,pos)    # Change actor's reflect charset
  78. #
  79. #  reflect_esprite(event_id,filename,pos)   # Change event's reflect charset
  80. #
  81. #  reflect_vsprite(vehicle_id,filename,pos) # Change vehicle's reflect charset
  82. #
  83. #------------------------------------------------------------------------------#
  84. #  EXAMPLES:
  85. #  reflect_sprite(1,"Actor2",2)      # change actor 1's charset to use sprite
  86. #                                    # in position 2 of "Actor2" charset.
  87. #  reflect_esprite(3,"Actor4",5)     # event 3 will use sprite in position 5 of
  88. #                                    # "Actor4" charset.
  89. #  reflect_vsprite(1,"Vehicle",5)    # Ship will use sprite in position 5 of
  90. #                                    # "Vehicle" charset.
  91. #------------------------------------------------------------------------------#
  92.  
  93. #------------------------------------------------------------------------------#
  94. #  SCRIPT CALLS to turn effects ON or OFF for chosen EVENTS
  95. #------------------------------------------------------------------------------#
  96. #
  97. #  reflect(x,x,x,status)   # status can be true or false to turn on or off
  98. #                          # use this to specify for mirror and reflect.
  99. #  shadow(x,x,x,status)    # where x is the event ids you want to change
  100. #                          # to change all events use :all
  101. #  icon(x,x,x,icon_id)     # set which icon id to appear above character. Make
  102. #                          # it 0 for no icon.
  103. #
  104. #------------------------------------------------------------------------------#
  105. #  EXAMPLES:
  106. #  reflect(14,17,3,1,true) # Turn events 14, 17, 3 and 1 reflections ON
  107. #  shadow(1,false)         # Turn event 1 shadow OFF
  108. #  reflect(:all,true)      # Turn all event reflections ON
  109. #  icon(1,2,3,4,38)        # Events 1,2,3 and 4 will have icon 38 appear
  110. #
  111. #  NOTE: All events will default to NO shadows and NO reflections when entering
  112. #        a map. This is a design decision to try to keep lag to a minimum. You
  113. #        should use these effects sparingly and only activate them on events
  114. #        that require them.
  115. #------------------------------------------------------------------------------#
  116.  
  117. #------------------------------------------------------------------------------#
  118. #  SCRIPT CALLS to turn effects ON or OFF for ACTORS and VEHICLES
  119. #------------------------------------------------------------------------------#
  120. #
  121. #  actor_reflect(actor_id,status)  # reflections and shadows are ON by default
  122. #  actor_shadow(actor_id,status)   # for actors and vehicles. Turning them off
  123. #  actor_icon(actor_id,icon_id)    # or on will permanently change them.
  124. #
  125. #  v_reflect(x,x,x,status)    # use these v_ calls for changing vehicle effects
  126. #  v_shadow(x,x,x,status)     # on and off for vehicles.
  127. #  v_icon(x,x,x,icon_id)
  128. #
  129. #------------------------------------------------------------------------------#
  130.  
  131. #------------------------------------------------------------------------------#
  132. #  SCRIPT CALLS for shadow options
  133. #------------------------------------------------------------------------------#
  134. #
  135. #  shadow_source(x,y,id)       # set the x,y location for the light. id is the
  136. #                              # light source number you wish to change (for
  137. #                              # more than one). These are reset on map change.
  138. #  shadow_source(event_id,id)  # use an event's x,y location for the light.
  139. #                              # This will need to be in parallel process if you
  140. #                              # want it to be a moving light.
  141. #
  142. #  shadow_options(intensity,fade,flicker)    # descriptions below
  143. #
  144. #    # intensity = opacity when standing next to the light source (255 is black)
  145. #    # fade = amount shadow becomes more transparent the further away you are.
  146. #    # flicker = true or false. Shadows will flicker as if being cast by fire.
  147. #
  148. #------------------------------------------------------------------------------#
  149. #  EXAMPLE:
  150. #  shadow_options(80,10,false)    # This is the default setting.
  151. #------------------------------------------------------------------------------#
  152.  
  153. #------------------------------------------------------------------------------#
  154. #  SCRIPT CALLS for reflect options
  155. #------------------------------------------------------------------------------#
  156. #
  157. #  reflect_options(wave_pwr)
  158. #
  159. #    # wave_pwr = how strong the wave movement is. 0 is off
  160. #
  161. #------------------------------------------------------------------------------#
  162. #  EXAMPLE:
  163. #  reflect_options(1) # Turn wave power to 1
  164. #------------------------------------------------------------------------------#
  165.  
  166.  
  167. #------------------------------------------------------------------------------#
  168. #  NOTETAG for ACTORS
  169. #------------------------------------------------------------------------------#
  170. #
  171. #  <no_reflect>    # Actor will not have a reflection (for vampires of course!)
  172. #
  173. #  <reflect_sprite: FileName,pos>  # Actor will use this charset for reflections
  174. #                                  # and use the character in position 'pos'
  175. #
  176. #------------------------------------------------------------------------------#
  177. #  EXAMPLES:
  178. #  <reflect_sprite: Actor2,0>    # The first character from Actor2 charset
  179. #  <reflect_sprite: Actor3,7>    # The last character from Actor2 charset
  180. #------------------------------------------------------------------------------#
  181.  
  182.  
  183. ($imported ||= {})["Galv_Character_Effects"] = true
  184. module Galv_CEffects
  185.  
  186. #------------------------------------------------------------------------------#
  187. #  SETUP OPTIONS
  188. #------------------------------------------------------------------------------#
  189.  
  190.   MIRROR_REGION = 1     # Region ID used to determine mirror walls. Paint the
  191.                         # region on the wall you want to make reflective (and
  192.                         # then use tiles/mapping that make the parallax visible)
  193.  
  194.   ICON_OFFSET = -60     # Y offset for icons that are displayed above characters
  195.  
  196.   REFLECT_Z = -10       # Z level of reflections
  197.   SHADOW_Z = 0          # Z level of shadows
  198.  
  199. #------------------------------------------------------------------------------#
  200. #  END SETUP OPTIONS
  201. #------------------------------------------------------------------------------#
  202. end
  203.  
  204.  
  205.  
  206.  
  207. class Game_Map
  208.   def do_icons(refresh = true)
  209.     @events.values.each { |e|
  210.       next if !e.list
  211.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<icon:(.*),(.*),(.*)>/
  212.         e.icon = $1.to_i
  213.         e.icon_offset = [$2.to_i,$3.to_i]
  214.       else
  215.         e.icon = 0
  216.         e.icon_offset = [0,0]
  217.       end
  218.     }
  219.     SceneManager.scene.spriteset.refresh_effects if refresh
  220.   end
  221.  
  222.  
  223.   def do_shadows(refresh = true)
  224.     @events.values.each { |e|
  225.       next if !e.list
  226.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<shadow>/
  227.         e.shadow = true
  228.       else
  229.         e.shadow = false
  230.       end
  231.     }
  232.     SceneManager.scene.spriteset.refresh_effects if refresh
  233.   end
  234.  
  235.   def do_reflects(refresh = true)
  236.     @events.values.each { |e|
  237.       next if !e.list
  238.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<reflect>/
  239.         e.reflect = true
  240.       else
  241.         e.reflect = false
  242.       end
  243.     }
  244.     SceneManager.scene.spriteset.refresh_effects if refresh
  245.   end
  246.  
  247.   def do_all_chareffects
  248.     do_icons(false)
  249.     do_shadows(false)
  250.     do_reflects(false)
  251.   end
  252.  
  253. end # Game_Map
  254.  
  255.  
  256.  
  257.  
  258. class Game_Interpreter
  259.  
  260.   def remove_icon
  261.     icon(@event_id,0)
  262.   end
  263.  
  264. #-----------------------------------#
  265. #  REFLECTIONS
  266. #-----------------------------------#
  267.  
  268.   # Add/Remove Reflections from selected events
  269.   def reflect(*args,status)
  270.     char_ids = [*args]
  271.     if char_ids == [:all]
  272.       $game_map.events.values.each { |e| e.reflect = status }
  273.     else
  274.       char_ids.each {|c| $game_map.events[c].reflect = status }
  275.     end
  276.     SceneManager.scene.spriteset.refresh_effects
  277.   end
  278.  
  279.   # Change forever actor's reflect status
  280.   def actor_reflect(actor_id,status)
  281.     $game_actors[actor_id].reflect = status
  282.     $game_player.refresh
  283.   end
  284.  
  285.   # Change forever vehicle's reflect status
  286.   def v_reflect(*args,status)
  287.     char_ids = [*args]
  288.     if char_ids == [:all]
  289.       $game_map.vehicles.each { |v| v.reflect = status }
  290.     else
  291.       char_ids.each { |v| $game_map.vehicles[v].reflect = status }
  292.     end
  293.     SceneManager.scene.spriteset.refresh_effects
  294.   end
  295.  
  296.   def reflect_options(*args)
  297.     $game_map.reflect_options = [*args]
  298.     SceneManager.scene.spriteset.refresh_effects
  299.   end
  300.  
  301.   # Actor reflect sprite change
  302.   def reflect_sprite(actor_id,filename,pos)
  303.     $game_actors[actor_id].reflect_sprite = [filename,pos]
  304.     $game_player.refresh
  305.   end
  306.  
  307.   # Event reflect sprite change
  308.   def reflect_esprite(event_id,filename,pos)
  309.     $game_map.events[event_id].reflect_sprite = [filename,pos]
  310.     $game_map.events[event_id].reflect = true
  311.     SceneManager.scene.spriteset.refresh_characters
  312.   end
  313.  
  314.   # Vehicle reflect sprite change
  315.   def reflect_vsprite(v_id,filename,pos)
  316.     $game_map.vehicles[v_id].reflect_sprite = [filename,pos]
  317.     SceneManager.scene.spriteset.refresh_characters
  318.   end
  319.  
  320. #-----------------------------------#
  321. #  SHADOWS
  322. #-----------------------------------#
  323.  
  324.   # Add/Remove Shadows from selected characters
  325.   def shadow(*args,status)
  326.     char_ids = [*args]
  327.     if char_ids == [:all]
  328.       $game_map.events.values.each { |e| e.shadow = status }
  329.     else
  330.       char_ids.each {|c| $game_map.events[c].shadow = status }
  331.     end
  332.     SceneManager.scene.spriteset.refresh_effects
  333.   end
  334.  
  335.   # Change player and follower shadows
  336.   def actor_shadows(status)
  337.     $game_player.shadow = status
  338.     $game_player.followers.each { |f| f.shadow = status }
  339.     SceneManager.scene.spriteset.refresh_effects
  340.   end
  341.  
  342.   # Change vehicle's shadow status
  343.   def v_shadow(*args,status)
  344.     char_ids = [*args]
  345.     if char_ids == [:all]
  346.       $game_map.vehicles.each { |v| v.shadow = status }
  347.     else
  348.       char_ids.each { |v| $game_map.vehicles[v].shadow = status }
  349.     end
  350.     SceneManager.scene.spriteset.refresh_effects
  351.   end
  352.  
  353.   def shadow_options(*args)
  354.     $game_map.shadow_options = [*args]
  355.     SceneManager.scene.spriteset.refresh_effects
  356.   end
  357.  
  358.   def shadow_source(*args,shad_id)
  359.     shadsource = [*args]
  360.  
  361.     if shadsource.count == 1
  362.       $game_map.light_source[shad_id] = [$game_map.events[shadsource[0]].real_x,
  363.         $game_map.events[shadsource[0]].real_y]
  364.     elsif shadsource.count > 1
  365.       $game_map.light_source[shad_id] = shadsource
  366.     else
  367.       $game_map.light_source = []
  368.     end
  369.   end
  370.  
  371.  
  372. #-----------------------------------#
  373. #  ICONS
  374. #-----------------------------------#
  375.  
  376.   # Add/Remove Icons from selected events
  377.   def icon(*args,icon_id)
  378.     char_ids = [*args]
  379.     if char_ids == [:all]
  380.       $game_map.events.values.each { |e|
  381.       if e.icon <= 0
  382.         e.icon = nil
  383.       else
  384.         e.icon = icon_id
  385.       end
  386.     }
  387.     else
  388.       char_ids.each {|c| $game_map.events[c].icon = icon_id }
  389.     end
  390.     SceneManager.scene.spriteset.refresh_effects
  391.   end
  392.  
  393.   # Change forever actor's icon
  394.   def actor_icon(actor_id,icon_id)
  395.     $game_actors[actor_id].icon = icon_id
  396.     $game_player.refresh
  397.   end
  398.  
  399.   # Change forever vehicle's icon
  400.   def v_icon(*args,icon_id)
  401.     char_ids = [*args]
  402.     if char_ids == [:all]
  403.       $game_map.vehicles.each { |v| v.icon = icon_id }
  404.     else
  405.       char_ids.each { |v| $game_map.vehicles[v].icon = icon_id }
  406.     end
  407.     SceneManager.scene.spriteset.refresh_effects
  408.   end
  409.  
  410. #-----------------------------------#
  411. #  GENERAL
  412. #-----------------------------------#
  413.  
  414.   # Turn on/off effects
  415.     # 0 = reflect
  416.     # 1 = shadow
  417.     # 2 = mirror
  418.     # 3 = icon
  419.  
  420.   def char_effects(*args,status)
  421.     [*args].each { |e| $game_map.char_effects[e] = status }
  422.     SceneManager.scene.spriteset.refresh_effects
  423.   end
  424.  
  425.  
  426. end # Game_Interpreter
  427.  
  428.  
  429. #-------------------------------------------------------------------------------
  430. #  Spriteset_Map
  431. #-------------------------------------------------------------------------------
  432.  
  433. class Spriteset_Map
  434.   alias galv_reflect_sm_initialize initialize
  435.   def initialize
  436.     create_effects
  437.     galv_reflect_sm_initialize
  438.     refresh_characters
  439.   end
  440.  
  441.   alias galv_reflect_sm_refresh_characters refresh_characters
  442.   def refresh_characters
  443.     galv_reflect_sm_refresh_characters
  444.     create_effects
  445.   end
  446.  
  447.   def refresh_effects
  448.     dispose_effects
  449.     create_effects
  450.   end
  451.  
  452.   def create_effects
  453.     @shadow_sprites = []
  454.     @reflect_sprites = []
  455.     @mirror_sprites = []
  456.     @icon_sprites = []
  457.  
  458.     # Do reflections
  459.     if $game_map.char_effects[0]
  460.       $game_map.events.values.each { |e|
  461.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, e)) if e.reflect
  462.       }
  463.       $game_player.followers.each { |f|
  464.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, f)) if f.reflect
  465.       }
  466.       if $game_player.reflect
  467.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, $game_player))
  468.       end
  469.       $game_map.vehicles.each { |v|
  470.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, v)) if v.reflect
  471.       }
  472.     end
  473.  
  474.     # Do mirrors
  475.     if $game_map.char_effects[2]
  476.       $game_map.events.values.each { |e|
  477.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, e)) if e.reflect
  478.       }
  479.       $game_player.followers.each { |f|
  480.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, f)) if f.reflect
  481.       }
  482.       if $game_player.reflect
  483.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, $game_player))
  484.       end
  485.       $game_map.vehicles.each { |v|
  486.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, v)) if v.reflect
  487.       }
  488.     end
  489.  
  490.     # Do Shadows
  491.     if $game_map.char_effects[1]
  492.       return if $game_map.light_source.empty?
  493.       $game_map.light_source.count.times { |s|
  494.         $game_map.events.values.each { |e|
  495.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, e, s)) if e.shadow
  496.         }
  497.         $game_player.followers.each { |f|
  498.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, f, s)) if f.shadow
  499.         }
  500.         if $game_player.shadow
  501.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, $game_player, s))
  502.         end
  503.         $game_map.vehicles.each { |v|
  504.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, v, s)) if v.shadow
  505.         }
  506.       }
  507.     end
  508.  
  509.     # Do icons
  510.     if $game_map.char_effects[3]
  511.       $game_map.events.values.each { |e|
  512.         @icon_sprites.push(Sprite_Icon.new(@viewport1, e)) if e.icon
  513.       }
  514.       $game_player.followers.each { |f|
  515.         @icon_sprites.push(Sprite_Icon.new(@viewport1, f)) if f.icon
  516.       }
  517.       if $game_player.icon
  518.         @icon_sprites.push(Sprite_Icon.new(@viewport1, $game_player))
  519.       end
  520.       $game_map.vehicles.each { |v|
  521.         @icon_sprites.push(Sprite_Icon.new(@viewport1, v)) if v.icon
  522.       }
  523.     end
  524.   end
  525.  
  526.   alias galv_reflect_sm_update update
  527.   def update
  528.     galv_reflect_sm_update
  529.     @reflect_sprites.each {|s| s.update} if $game_map.char_effects[0]
  530.     @mirror_sprites.each {|s| s.update} if $game_map.char_effects[2]
  531.     @shadow_sprites.each {|s| s.update} if $game_map.char_effects[1]
  532.     @icon_sprites.each {|s| s.update} if $game_map.char_effects[3]
  533.   end
  534.  
  535.   alias galv_reflect_sm_dispose_characters dispose_characters
  536.   def dispose_characters
  537.     galv_reflect_sm_dispose_characters
  538.     dispose_effects
  539.   end
  540.  
  541.   def dispose_effects
  542.     @reflect_sprites.each {|s| s.dispose}
  543.     @shadow_sprites.each {|s| s.dispose}
  544.     @mirror_sprites.each {|s| s.dispose}
  545.     @icon_sprites.each {|s| s.dispose}
  546.   end
  547. end # Spriteset_Map
  548.  
  549.  
  550. #-------------------------------------------------------------------------------
  551. #  Sprite_Reflect
  552. #-------------------------------------------------------------------------------
  553.  
  554. class Sprite_Reflect < Sprite_Character
  555.   def initialize(viewport, character = nil)
  556.     super(viewport, character)
  557.   end
  558.  
  559.   def update
  560.     super
  561.   end
  562.  
  563.   def update_balloon; end
  564.   def setup_new_effect; end
  565.  
  566.   def set_character_bitmap
  567.     if @character.reflect_sprite
  568.       self.bitmap = Cache.character(@character.reflect_sprite[0])
  569.     else
  570.       self.bitmap = Cache.character(@character_name)
  571.     end
  572.     self.mirror = true
  573.     self.angle = 180
  574.     self.opacity = 220
  575.     self.z = Galv_CEffects::REFLECT_Z
  576.     self.wave_amp = $game_map.reflect_options[0]
  577.  
  578.     sign = @character_name[/^[\!\$]./]
  579.     if sign && sign.include?(')
  580.       @cw = bitmap.width / 3
  581.       @ch = bitmap.height / 4
  582.     else
  583.       @cw = bitmap.width / 12
  584.       @ch = bitmap.height / 8
  585.     end
  586.     self.ox = @cw / 2
  587.     self.oy = @ch
  588.   end
  589.  
  590.   def update_position
  591.     self.x = @character.screen_x
  592.     jump = @character.jumping? ? @character.jump_height * 2 : 0
  593.     alt = @character.altitude ? @character.altitude * 2 : 0
  594.     self.y = @character.screen_y - 3 + jump + alt
  595.   end
  596.  
  597.   def update_other
  598.     self.blend_type = @character.blend_type
  599.     self.visible = [email protected]
  600.   end
  601.  
  602.   def update_src_rect
  603.     if @character.reflect_sprite
  604.       index = @character.reflect_sprite[1]
  605.     else
  606.       index = @character.character_index
  607.     end
  608.     pattern = @character.pattern < 3 ? @character.pattern : 1
  609.     sx = (index % 4 * 3 + pattern) * @cw
  610.     sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
  611.     self.src_rect.set(sx, sy, @cw, @ch)
  612.   end
  613. end # Sprite_Reflect < Sprite_Character
  614.  
  615.  
  616. #-------------------------------------------------------------------------------
  617. #  Sprite_Mirror
  618. #-------------------------------------------------------------------------------
  619.  
  620. class Sprite_Mirror < Sprite_Character
  621.   def initialize(viewport, character = nil)
  622.     @distance = 0
  623.     super(viewport, character)
  624.   end
  625.  
  626.   def update
  627.     super
  628.   end
  629.  
  630.   def update_balloon; end
  631.   def setup_new_effect; end
  632.  
  633.   def set_character_bitmap
  634.     if @character.reflect_sprite
  635.       self.bitmap = Cache.character(@character.reflect_sprite[0])
  636.     else
  637.       self.bitmap = Cache.character(@character_name)
  638.     end
  639.     self.mirror = true
  640.     self.opacity = 255
  641.     self.z = Galv_CEffects::REFLECT_Z
  642.  
  643.     sign = @character_name[/^[\!\$]./]
  644.     if sign && sign.include?(')
  645.       @cw = bitmap.width / 3
  646.       @ch = bitmap.height / 4
  647.     else
  648.       @cw = bitmap.width / 12
  649.       @ch = bitmap.height / 8
  650.     end
  651.     self.ox = @cw / 2
  652.     self.oy = @ch
  653.   end
  654.  
  655.   def update_src_rect
  656.     if @character.reflect_sprite
  657.       index = @character.reflect_sprite[1]
  658.     else
  659.       index = @character.character_index
  660.     end
  661.     pattern = @character.pattern < 3 ? @character.pattern : 1
  662.     sx = (index % 4 * 3 + pattern) * @cw
  663.     sy = (index / 4 * 4 + (10 - @character.direction - 2) / 2) * @ch
  664.     self.src_rect.set(sx, sy, @cw, @ch)
  665.   end
  666.  
  667.   def get_mirror_y
  668.     20.times {|i|
  669.       if $game_map.region_id(@character.x, @character.y - i) == Galv_CEffects::MIRROR_REGION
  670.         @distance = (i - 1) * 0.05
  671.         [url=home.php?mod=space&uid=502659]@DISPLAY[/url] = @character.y - i - $game_map.display_y + $game_map.height
  672.         self.opacity = 255
  673.         return (@character.y - i + 1 - $game_map.display_y) * 32 - i * 4
  674.       end
  675.     }
  676.     self.opacity = 0
  677.     return @ch
  678.   end
  679.  
  680.   def update_position
  681.     self.x = @character.screen_x
  682.     self.y = get_mirror_y - 6
  683.     self.zoom_x = 1 - @distance
  684.     self.zoom_y = 1 - @distance
  685.   end
  686.  
  687.   def update_other
  688.     self.blend_type = @character.blend_type
  689.     self.visible = !@character.transparent
  690.   end
  691. end # Sprite_Mirror < Sprite_Character
  692.  
  693.  
  694. #-------------------------------------------------------------------------------
  695. #  Sprite_Shadow
  696. #-------------------------------------------------------------------------------
  697.  
  698. class Sprite_Shadow < Sprite_Character
  699.   def initialize(viewport, character = nil, source)
  700.     [url=home.php?mod=space&uid=14094]@flicker[/url] = 0
  701.     @famount = 0
  702.     @aamount = 0
  703.     [url=home.php?mod=space&uid=171370]@source[/url] = source
  704.     super(viewport, character)
  705.   end
  706.  
  707.   def update_balloon; end
  708.   def setup_new_effect; end
  709.  
  710.   def update
  711.     super
  712.     update_bitmap
  713.     update_src_rect
  714.     update_position
  715.     update_other
  716.     update_facing
  717.   end
  718.  
  719.   def set_character_bitmap
  720.     self.bitmap = Cache.character(@character_name)
  721.  
  722.     self.color = Color.new(0, 0, 0, 255)
  723.     self.z = Galv_CEffects::SHADOW_Z
  724.     self.wave_amp = 1 if $game_map.shadow_options[2]
  725.     self.wave_speed = 1000
  726.  
  727.     sign = @character_name[/^[\!\$]./]
  728.     if sign && sign.include?(')
  729.       @cw = bitmap.width / 3
  730.       @ch = bitmap.height / 4
  731.     else
  732.       @cw = bitmap.width / 12
  733.       @ch = bitmap.height / 8
  734.     end
  735.     self.ox = @cw / 2
  736.     self.oy = @ch
  737.   end
  738.  
  739.   def update_position
  740.     self.x = @character.screen_x
  741.     self.y = @character.screen_y - 10
  742.     get_angle
  743.   end
  744.  
  745.   def get_angle
  746.     x = $game_map.light_source[@source][0] - @character.real_x
  747.     y = $game_map.light_source[@source][1] - @character.real_y
  748.     self.opacity = $game_map.shadow_options[0] -
  749.       Math::sqrt(x * x + y * y) * $game_map.shadow_options[1]
  750.  
  751.     if x == 0 && y == 0 || self.opacity <= 0
  752.       self.opacity = 0
  753.     else
  754.       self.angle = Math::atan2(x, y) * 180 / Math::PI + @aamount
  755.     end
  756.   end
  757.  
  758.   def update_facing
  759.     if @character.y < $game_map.light_source[@source][1]
  760.       self.mirror = false
  761.     else
  762.       self.mirror = true
  763.     end
  764.   end
  765.  
  766.   def update_other
  767.     self.blend_type = @character.blend_type
  768.     self.visible = [email protected]
  769.   end
  770. end # Sprite_Shadow < Sprite_Character
  771.  
  772.  
  773. #-------------------------------------------------------------------------------
  774. #  Sprite_Icon
  775. #-------------------------------------------------------------------------------
  776.  
  777. class Sprite_Icon < Sprite_Character
  778.   def initialize(viewport, character = nil)
  779.     @icon_sprite ||= Sprite.new
  780.     @icon_sprite.bitmap ||= Cache.system("Iconset")
  781.     @icon = nil
  782.     super(viewport, character)
  783.   end
  784.  
  785.   def dispose
  786.     super
  787.     if @icon_sprite
  788.       @icon_sprite.dispose
  789.       @icon_sprite = nil
  790.     end
  791.   end
  792.  
  793.   def update
  794.     super
  795.     update_icon
  796.   end
  797.  
  798.   def update_icon
  799.     return if [email protected]
  800.     draw_icon(@character.icon)
  801.   end
  802.  
  803.   def draw_icon(icon_index)
  804.     return if [email protected]?
  805.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  806.     @icon_sprite.src_rect  = rect
  807.     @icon = icon_index
  808.   end
  809.  
  810.   def update_position
  811.     @icon_sprite.x = @character.screen_x - 12
  812.     @icon_sprite.y = @character.screen_y + Galv_CEffects::ICON_OFFSET
  813.   end
  814.  
  815.   def update_other
  816.     self.blend_type = @character.blend_type
  817.     @icon_sprite.visible = [email protected]
  818.   end
  819. end # Sprite_Icon < Sprite_Character
  820.  
  821.  
  822. #-------------------------------------------------------------------------------
  823. #  Other Stuff
  824. #-------------------------------------------------------------------------------
  825.  
  826.  
  827. class Game_Character < Game_CharacterBase
  828.   attr_reader    :altitude
  829.   attr_accessor  :reflect
  830.   attr_accessor  :reflect_sprite
  831.   attr_accessor  :shadow
  832.   attr_accessor  :icon
  833.   attr_accessor  :icon_offset
  834. end
  835.  
  836.  
  837. class Game_Event < Game_Character
  838.   alias galv_reflect_ge_initialize initialize
  839.   def initialize(map_id, event)
  840.     @reflect = false
  841.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = false
  842.     @icon_offset = [0,0]
  843.     galv_reflect_ge_initialize(map_id, event)
  844.   end
  845. end # Game_Event < Game_Character
  846.  
  847.  
  848. class Game_Vehicle < Game_Character
  849.   attr_reader :map_id
  850.  
  851.   alias galv_reflect_gv_initialize initialize
  852.   def initialize(type)
  853.     @reflect = true
  854.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  855.     @icon_offset = [0,0]
  856.     galv_reflect_gv_initialize(type)
  857.   end
  858. end # Game_Vehicle < Game_Character
  859.  
  860.  
  861. class Game_Follower < Game_Character
  862.   alias galv_reflect_gf_initialize initialize
  863.   def initialize(member_index, preceding_character)
  864.     galv_reflect_gf_initialize(member_index, preceding_character)
  865.     @reflect = true
  866.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  867.   end
  868.  
  869.   alias galv_reflect_gf_refresh refresh
  870.   def refresh
  871.     galv_reflect_gf_refresh
  872.     return if actor.nil?
  873.     @reflect = actor.reflect
  874.     @reflect_sprite = actor.reflect_sprite
  875.     @icon = actor.icon
  876.     if SceneManager.scene_is?(Scene_Map)
  877.       SceneManager.scene.spriteset.refresh_effects
  878.     end
  879.   end
  880. end # Game_Follower < Game_Character
  881.  
  882.  
  883. class Game_Player < Game_Character
  884.   alias galv_reflect_gp_initialize initialize
  885.   def initialize
  886.     galv_reflect_gp_initialize
  887.     @reflect = true
  888.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  889.   end
  890.  
  891.   alias galv_reflect_gp_refresh refresh
  892.   def refresh
  893.     galv_reflect_gp_refresh
  894.     @reflect = actor.reflect
  895.     @reflect_sprite = actor.reflect_sprite
  896.     @icon = actor.icon
  897.     if SceneManager.scene_is?(Scene_Map)
  898.       SceneManager.scene.spriteset.refresh_effects
  899.     end
  900.   end
  901. end # Game_Player < Game_Character
  902.  
  903.  
  904. class Scene_Map < Scene_Base
  905.   attr_accessor :spriteset
  906. end # Scene_Map
  907.  
  908.  
  909. class Game_Map
  910.   attr_accessor :char_effects
  911.   attr_accessor :light_source
  912.   attr_accessor :shadow_options
  913.   attr_accessor :reflect_options
  914.  
  915.   alias galv_reflect_game_map_initialize initialize
  916.   def initialize
  917.     @light_source = []
  918.     @shadow_options = [80,10,false]
  919.     @reflect_options = [0]
  920.     @char_effects = [false,false,false,false]
  921.     #[reflect,shadow,mirror,icon]
  922.     galv_reflect_game_map_initialize
  923.   end
  924.  
  925.  
  926.   alias galv_reflect_game_map_setup setup
  927.   def setup(map_id)
  928.     galv_reflect_game_map_setup(map_id)
  929.     reset_char_effects
  930.     do_all_chareffects
  931.     if SceneManager.scene_is?(Scene_Map)
  932.       SceneManager.scene.spriteset.refresh_effects
  933.     end
  934.   end
  935.  
  936.   def reset_char_effects
  937.     @light_source = []
  938.     @events.values.each { |e|
  939.       e.reflect = false
  940.       e.icon = nil }
  941.   end
  942. end # Game_Map
  943.  
  944.  
  945. class Game_Actor < Game_Battler
  946.   attr_accessor :reflect
  947.   attr_accessor :reflect_sprite
  948.   attr_accessor :icon
  949.  
  950.   alias galv_reflect_game_actor_initialize initialize
  951.   def initialize(actor_id)
  952.     galv_reflect_game_actor_initialize(actor_id)
  953.     @reflect = $data_actors[actor_id].reflect
  954.     @reflect_sprite = $data_actors[actor_id].reflect_sprite
  955.     @icon_offset = [0,0]
  956.   end
  957. end # Game_Actor < Game_Battler
  958.  
  959.  
  960. class RPG::Actor
  961.   def reflect_sprite
  962.     if @reflect_sprite.nil?
  963.       if @note =~ /<reflect_sprite:[ ](.*),(.*)>/i
  964.         @reflect_sprite = [$1.to_s,$2.to_i]
  965.       else
  966.         @reflect_sprite = nil
  967.       end
  968.     end
  969.     @reflect_sprite
  970.   end
  971.   def reflect
  972.     if @reflect.nil?
  973.       if @note =~ /<no_reflect>/i
  974.         @reflect = false
  975.       else
  976.         @reflect = true
  977.       end
  978.     end
  979.     @reflect
  980.   end
  981. end # RPG::Actor

评分

参与人数 2星屑 +30 +2 收起 理由
alexncf125 + 30 + 1 认可答案
zzz2207981 + 1 认可答案

查看全部评分

什么都想做一点却又逊又屑的一个人
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2436
在线时间
212 小时
注册时间
2022-1-17
帖子
230
3
发表于 2022-2-27 20:42:07 | 只看该作者
没办法,大部分镜像脚本都烂尾了,仔细翻翻吧,注意看是否适用于VX Ace
什么都想做一点却又逊又屑的一个人
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
585
在线时间
58 小时
注册时间
2020-8-21
帖子
21

极短22参与

4
 楼主| 发表于 2022-3-12 17:36:08 | 只看该作者
音狼MW 发表于 2022-2-27 17:28
在网址https://galvs-scripts.com/2013/02/21/character-effects/找到的,你试试
#----------------------- ...

thx!
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-30 23:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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