设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 69|回复: 0

[转载发布] Extra Fogs & Panorama Lock

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4469

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22945
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28308

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Extra Fogs & Panorama Lock
    By Jaiden

    Introduction

    This is a script that I've used to enhance XP's mapping even further. It allows for an additional fog that is exclusive to the map ID instead of the tileset, plus an additional two fogs: one drawn as a "lightmap" to add lighting effects and one drawn as a "parallax" (like RMVXA's parallax mapping) to add additional little details to the map like vegetation, etc.

    Lastly, there is an option to lock the panorama (background image) of a map so it can also be used as a ground layer, effectively giving you two more layers to work with if you know how to drive it.

    I've included a demo to help solidify the concept a bit. Note that you will still need to understand how to make parallaxes and lightmaps in GIMP/Photoshop. There are lots of tutorials on this--this script just makes it much easier to apply them.

    Features


    • Allows for an additional fog, which is per map instead of per tileset
    • Allows a panorama to lock so it doesn't scroll, allowing it to be used as a ground layer
    • Designated fog for parallax/detail mapping
    • Designated fog for lighting overlay

    Demo


    https://drive.google.com/open?id=1z6Xas94VmIQca1KVA1T_BbLssb_C3l4w

    Script


    Place this script above main just as you would any other custom script.
                    Code:        
    #============================================================================== # Extra Fogs & Panorama Lock # - - - # By Jaiden (RPGmaker.net / rpgmakerweb.com) # (Twitter: @studioalemni) # v1.0 - September 2019 # * Allows for an additional fog, which is per map instead of per tileset # * Allows a panorama to lock so it doesn't scroll, allowing it to be used #  as a ground layer #  (Thanks to Game_Guy from www.chaos-project.com for help on this) # * Designated fog for parallax/detail mapping # * Designated fog for lighting overlay # # [[Compatibility]] # This script aliases the Spriteset_Map class. Place it above main # like any other custom script. # It hasn't been extensively tested, but should otherwise play nicely # with other map scripts. # # [[How to Use]] # The "fogs" folder should contains two subfolders: # /Fogs/Lightmaps # /Fogs/Parallax # # In these folders, place a file named "Map[MAPID]", such as "Map002.png" # If the file is detected, it will be applied to the map. # # ***NOTE: In order to get the desired effect, these files MUST be the same size # as the map they're applied to. If they are not, the panorama/lights will not # match up with the tilemap / player. # # Lightmaps will always have subtractive blending, and "parallax" will always # be drawn above the ground layer but below the player. This means the player # can always walk over items in the parallax, and is best reserved for things # like vegetation, etc. # #============================================================================== module CustomFogsPanorama   def self.fogs(map_id)     case map_id     #==============================================================================     #     # BEGIN CONFIGURATION     #     # When a fog is specified here, it will be drawn in addition to the     # already existing map fog.     #     # Configuration values are identical to that of the editor.     # Please follow the format exactly, and do not modify the "else"     # or the lines below it. Mind your commas!        # when MAPID then ["Name", Zoom_x (%), Zoom_y (%), Opacity (0-255), Blend (0:norm, 1:add, 2:sub), Tone.new(r,g,b), scroll x, scroll y]       when 1 then ["003-Shade01", 100, 100, 50, 2, Tone.new(0,0,0), -1, 5]     # when 2 then ["Fog Name", 100, 100, 255, 2, Tone.new(0,0,0), 0, 0]        #     #---- End Extra Fog Config -------------------------------------------------     else       [""]     end   end   #--------------------------------------------------------------------------   # * Lock Panorama   #   # Specify a list of map IDs that will stop the panorama from scrolling   # Separated by commas: [ID, ID, ID]   #   LOCK_PANORAMA_IDS = [2] # # END CONFIGURATION # (Do not modify below this line unless you know what you're doing!) # #============================================================================== end   class Game_Map   #--------------------------------------------------------------------------   # * Public Instance Variables   #--------------------------------------------------------------------------   attr_accessor :parallax_lock   attr_accessor :fog2_ox   attr_accessor :fog2_oy   #--------------------------------------------------------------------------   # * Setup   #    map_id : map ID   #--------------------------------------------------------------------------   alias jaiden_parallax_map_setup setup   def setup(map_id)     # Call original     jaiden_parallax_map_setup(map_id)     # Initialize fog variables     @fog2_ox = 0     @fog2_oy = 0     # Get fog sx/sy     @fog2 = CustomFogsPanorama.fogs(@map_id)     @fog2_sx = @fog2[6]     @fog2_sy = @fog2[7]     # Check if map_id includes parallax     if CustomFogsPanorama::LOCK_PANORAMA_IDS.include?(@map_id)       @parallax_lock = true     else       @parallax_lock = false     end   end   #--------------------------------------------------------------------------   # * Frame Update   #--------------------------------------------------------------------------   alias jaiden_second_fog_update update   def update     # Call original / aliases     jaiden_second_fog_update     # Manage fog scrolling     if @fog2[0] != ""       @fog2_ox -= @fog2_sx / 8.0       @fog2_oy -= @fog2_sy / 8.0     end   end end  class Spriteset_Map   #--------------------------------------------------------------------------   # * Initialize   #--------------------------------------------------------------------------   alias jaiden_lights_initialize_spritemap initialize   def initialize     # Call original     jaiden_lights_initialize_spritemap     # Reassign fog plane if a custom one is assigned     second_fog = CustomFogsPanorama.fogs($game_map.map_id)     if second_fog[0] != ""       @fog2 = Plane.new(@viewport1)       @fog2.bitmap = RPG::Cache.fog(second_fog[0], 0)       @fog2.zoom_x = second_fog[1] / 100.0       @fog2.zoom_y = second_fog[2] / 100.0       @fog2.opacity = second_fog[3]       @fog2.blend_type = second_fog[4]       @fog2.tone = second_fog[5]       @fog2.z = 3500     end     # Create parallax (unlike panorama, this overlays the map and should always = map size)     if FileTest.exist?("Graphics/Fogs/Parallax/Map#{$game_map.map_id}.png")       @parallax = Plane.new(@viewport1)       @parallax.bitmap = RPG::Cache.fog("/Parallax/Map#{$game_map.map_id}", 0)       @parallax.blend_type = 0 # Normal blending       @parallax.opacity = 255       @parallax.ox = $game_map.display_x / 4       @parallax.oy = $game_map.display_y / 4     end     # Create lightmap (above everything else)     if FileTest.exist?("Graphics/Fogs/Lightmaps/Map#{$game_map.map_id}.png")       @lightmap = Plane.new(@viewport1)       @lightmap.z = 4000       @lightmap.bitmap = RPG::Cache.fog("/Lightmaps/Map#{$game_map.map_id}", 0)       @lightmap.blend_type = 2 # Subtractive blending       @lightmap.opacity = 255       @lightmap.ox = $game_map.display_x / 4       @lightmap.oy = $game_map.display_y / 4     end   end   #--------------------------------------------------------------------------   # * Dispose   #--------------------------------------------------------------------------   alias jaiden_lights_dispose_spritemap dispose   def dispose     @fog2.dispose if @fog2     @parallax.dispose if @parallax     @lightmap.dispose if @lightmap     # Call original     jaiden_lights_dispose_spritemap   end   #--------------------------------------------------------------------------   # * Update   #--------------------------------------------------------------------------   alias jaiden_lights_spriteset_update update   def update     # Update second fog     if @fog2       @fog2.ox = $game_map.display_x / 4 + $game_map.fog2_ox       @fog2.oy = $game_map.display_y / 4 + $game_map.fog2_oy     end     # Update parallax     if @parallax       @parallax.ox = $game_map.display_x / 4       @parallax.oy = $game_map.display_y / 4     end     # Update lightmap     if @lightmap       @lightmap.ox = $game_map.display_x / 4       @lightmap.oy = $game_map.display_y / 4     end     # Call original / aliased methods     jaiden_lights_spriteset_update     # Check for locked parallax     if $game_map.parallax_lock       @panorama.ox = $game_map.display_x / 4       @panorama.oy = $game_map.display_y / 4     else       @panorama.ox = $game_map.display_x / 8       @panorama.oy = $game_map.display_y / 8     end   end end


    Instructions


    Please see the script for instructions, or check out the demo.

    Compatibility


    This script aliases the Spriteset_Map class. Place it above main like any other custom script.
    It hasn't been extensively tested, but should otherwise play nicely with other map scripts.

    Credits and Thanks


    • Game_Guy (for helping with the parallax lock)
    • Chaos Project (for existing and keeping XP alive)

    Author's Notes


    Feel free to let me know if there are any bugs. Commercial use is OK, but I would really appreciate it if you credited me (and showed me what kind of awesome game you're making with it!)

    I made this script specifically for use in my game Legends of Astravia. Consider supporting it if you were happy with this script!


    本贴来自国际rpgmaker官方论坛作者:Jaiden处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/extra-fogs-panorama-lock.114472/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 17:53 , Processed in 0.070070 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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