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

[转载发布] Map Safety Level XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    4461

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 18:41 | 显示全部楼层 |阅读模式
    Map Safety Level XP

    by Kyonides Arkanthes



    Introduction

    I have come up with a very simple scriptlet that will allow the game developers to show a simple map name window plus a brand new label telling the player how safe that map actually is. This window will be shown on the menu screen only.

    Screenshot





                    Ruby:       
    1. # * Map Safety Level XP * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2022-12-30
    4. # This scriptlet lets you set some texts as Safety Level Labels, and then you
    5. # can call a method to set a new level at any given time.
    6. # Valid Levels: 0 up to your safety maximum level.
    7. # * Get or Set Current Map's Safety Level * #
    8. # $game_map.safety_level
    9. # $game_map.safety_level = NewLevel
    10. # * Preset a given Map's Safety Level * #
    11. # SAFETY_LEVELS = { MapIDa => Level, MapIDb => Level, etc. }
    12. # * Define a given Map's Safety Level Color * #
    13. # - Alpha is optional. Valid Values: 0 through 255
    14. # SAFETY_LEVELS[0] = [Red, Green, Blue, Alpha]
    15. module MapData
    16.   DEFAULT_SAFETY_LEVEL = 0
    17.   SAFETY_LEVELS = { 1 => 3 }
    18.   SAFETY_LABELS = [] # Just leave it alone.
    19.   SAFETY_COLORS = [] # Just leave it alone.
    20.   SAFETY_LABELS[0] = "A Nightmare"
    21.   SAFETY_LABELS[1] = "Dangerous"
    22.   SAFETY_LABELS[2] = "Unsafe"
    23.   SAFETY_LABELS[3] = "Normal Place"
    24.   SAFETY_LABELS[4] = "Great Place"
    25.   SAFETY_LABELS[5] = "The Utopia"
    26.   SAFETY_COLORS[0] = [255, 0, 0]
    27.   SAFETY_COLORS[1] = [255, 165, 0]
    28.   SAFETY_COLORS[2] = [255, 255, 0]
    29.   SAFETY_COLORS[3] = [255, 255, 255]
    30.   SAFETY_COLORS[4] = [90, 205, 90]
    31.   SAFETY_COLORS[5] = [0, 255, 0]
    32. end
    33. class Game_Map
    34.   alias :kyon_map_safety_lvl_gm_map_init :initialize
    35.   alias :kyon_map_safety_lvl_gm_map_setup :setup
    36.   def initialize
    37.     kyon_map_safety_lvl_gm_map_init
    38.     @safety_levels = MapData::SAFETY_LEVELS.dup
    39.     @safety_levels.default = MapData::DEFAULT_SAFETY_LEVEL
    40.   end
    41.   def get_mapinfos_name
    42.     load_data("Data/MapInfos.rxdata")[@map_id].name
    43.   end
    44.   def display_name
    45.     @display_name ||= get_mapinfos_name
    46.   end
    47.   def safety_level
    48.     @safety_levels[@map_id]
    49.   end
    50.   def safety_level=(new_level)
    51.     @safety_levels[@map_id] = new_level
    52.   end
    53.   def safety_level_text
    54.     MapData::SAFETY_LABELS[@safety_levels[@map_id]]
    55.   end
    56.   attr_reader :safety_levels
    57.   attr_writer :display_name
    58. end
    59. class MapNameSafeWindow < Window_Base
    60.   def initialize(wx, wy, w)
    61.     super(wx, wy, w, 96)
    62.     self.contents = Bitmap.new(w - 32, 64)
    63.     map = $game_map
    64.     contents.draw_text(0, 0, 128, 28, map.display_name, 1)
    65.     safety_color = MapData::SAFETY_COLORS[map.safety_level]
    66.     contents.font.color.set(*safety_color)
    67.     contents.draw_text(0, 32, 128, 28, map.safety_level_text, 1)
    68.   end
    69. end
    70. class Scene_Menu
    71.   alias :kyon_map_safety_lvl_scn_menu_main :main
    72.   alias :kyon_map_safety_lvl_scn_menu_up :update
    73.   def main
    74.     @show_map_name = true
    75.     @map_name_safe = MapNameSafeWindow.new(0, 320, 160)
    76.     @map_name_safe.z += 100
    77.     kyon_map_safety_lvl_scn_menu_main
    78.     @map_name_safe.dispose
    79.   end
    80.   def update
    81.     if Input.trigger?(Input::L) or Input.trigger?(Input::R)
    82.       if @command_window.active
    83.         @show_map_name = !@show_map_name
    84.         @map_name_safe.z = @show_map_name ? 100 : 0
    85.         @steps_window.z = @show_map_name ? 0 : 100
    86.       end
    87.       return
    88.     end
    89.     kyon_map_safety_lvl_scn_menu_up
    90.   end
    91. end
    复制代码


    Terms & Conditions

    Free for use in commercial and non commercial games unless you have pissed me off.
    Please include my nickname in your game credits.
    I seriously hope this will not be the only script of mine that you will include in your games.


    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/map-safety-level-xp.153612/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 16:52 , Processed in 0.064235 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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