じ☆ve冰风 发表于 3 天前

Map Safety Level VX

Map Safety Level VX

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.





Script

                Ruby:       
# * Map Safety Level VX * ##   Scripter : Kyonides Arkanthes#   2022-12-30# This scriptlet lets you set some texts as Safety Level Labels, and then you# can call a method to set a new level at any given time.# Valid Levels: 0 up to your safety maximum level.# * Get or Set Current Map's Safety Level * ## $game_map.safety_level# $game_map.safety_level = NewLevel# * Preset a given Map's Safety Level * ## SAFETY_LEVELS = { MapIDa => Level, MapIDb => Level, etc. }# * Define a given Map's Safety Level Color * ## - Alpha is optional. Valid Values: 0 through 255# SAFETY_LEVELS = module MapDataDEFAULT_SAFETY_LEVEL = 0SAFETY_LEVELS = { 1 => 3 }SAFETY_LABELS = [] # Just leave it alone.SAFETY_COLORS = [] # Just leave it alone.SAFETY_LABELS = "A Nightmare"SAFETY_LABELS = "Dangerous"SAFETY_LABELS = "Unsafe"SAFETY_LABELS = "Normal Place"SAFETY_LABELS = "Great Place"SAFETY_LABELS = "The Utopia"SAFETY_COLORS = SAFETY_COLORS = SAFETY_COLORS = SAFETY_COLORS = SAFETY_COLORS = SAFETY_COLORS = endclass Game_Mapalias :kyon_map_safety_lvl_gm_map_init :initializealias :kyon_map_safety_lvl_gm_map_setup :setupdef initialize    kyon_map_safety_lvl_gm_map_init    @safety_levels = MapData::SAFETY_LEVELS.dup    @safety_levels.default = MapData::DEFAULT_SAFETY_LEVELenddef get_mapinfos_name    load_data("Data/MapInfos.rvdata")[@map_id].nameenddef display_name    @display_name ||= get_mapinfos_nameenddef safety_level    @safety_levels[@map_id]enddef safety_level=(new_level)    @safety_levels[@map_id] = new_levelenddef safety_level_text    MapData::SAFETY_LABELS[@safety_levels[@map_id]]endattr_reader :safety_levelsattr_writer :display_nameendclass MapNameSafeWindow < Window_Basedef initialize(wx, wy, w)    super(wx, wy, w, WLH * 2 + 32)    self.contents = Bitmap.new(w - 32, WLH * 2)    map = $game_map    contents.draw_text(0, 0, 128, 24, map.display_name, 1)    safety_color = MapData::SAFETY_COLORS    contents.font.color.set(*safety_color)    contents.draw_text(0, 24, 128, 24, map.safety_level_text, 1)endendclass Scene_Menualias :kyon_map_safety_lvl_scn_menu_start :startalias :kyon_map_safety_lvl_scn_menu_term :terminatedef start    kyon_map_safety_lvl_scn_menu_start    create_map_safety_windowenddef create_map_safety_window    @map_name_safe = MapNameSafeWindow.new(0, Graphics.height - 80 - 56, 160)enddef terminate    kyon_map_safety_lvl_scn_menu_term    @map_name_safe.disposeendend


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-vx.153611/
页: [1]
查看完整版本: Map Safety Level VX