累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
58883
OK点
16
推广点
0
同能卷
50
积分 68848
Panik Value ACE
by Kyonides
Introduction
This scriptlet allows you to display a so called panic level on screen. You can change its current location by adjusting the values of the corresponding CONSTANTS found in the Panik module.
Version 1.0.2
Ruby:
# * Panik Value ACE # Scripter : Kyonides Arkanthes # v1.0.2 - 2022-01-02 # * This script is free as beer and speech! * # # Display the current Panic Level on screen! # It changes its backdrop depending on how dangerous the situation actually is. # You can toggle it by turning a specific game switch on and off at will. # A flash will be displayed if the Panic Level hits a certain value. # Please adjust the values of all the CONSTANTS found below in the Panik module. module Panik BACKDROP_X = 460 BACKDROP_Y = 0 # Pictures for Good, So so and Bad Panic Levels BACKDROPS = ["", "", ""] VAR_ID = 100 SWITCH_ID = 1 FONT_NAME = "Verdana" FONT_SIZE = 20 # [ Red, Green, Blue ] for each Panic Level FONT_COLOR = [[255,255,255], [220,80,20], [255,0,0]] FLASH_MIN_VALUE = 90 FLASH_COLOR = [255,0,0,128] # [ Red, Green, Blue, Opacity ] FLASH_DURATION = 8 end class PanicSpriteset include Panik def initialize @box = Sprite.new @box.x = BACKDROP_X @box.y = BACKDROP_Y @board = Sprite.new @board.x = BACKDROP_X + 4 @board.y = BACKDROP_Y + 4 @sprites = [@box, @board] refresh_panic check_panic_index refresh_backdrop @board.bitmap = Bitmap.new(@box.width - 8, @box.height - 8) refresh_value self.visible = $game_switches[SWITCH_ID] end def check_panic_index @panic_index = case @panic_value when 0..49 then 2 when 50..75 then 1 when 75..100 then 0 end end def refresh_panic @panic_value = [0, $game_variables[VAR_ID]].max @panic_value = [@panic_value, 100].min end def refresh_backdrop @last_index = @panic_index backdrop = BACKDROPS[@last_index] @box.bitmap.dispose if @box.bitmap != nil @box.bitmap = Cache.picture(backdrop) end def refresh_value @last_value = @panic_value bit = @board.bitmap bit.clear bit.font.name = FONT_NAME bit.font.size = FONT_SIZE r, g, b = FONT_COLOR[@panic_index] bit.font.color = Color.new(r, g, b, 255) bit.draw_text(0, 0, @board.width, @board.height, @panic_value.to_s, 1) return if FLASH_MIN_VALUE > @panic_value r, g, b, a = FLASH_COLOR $game_screen.start_flash(Color.new(r, g, b, a), FLASH_DURATION) end def update refresh_panic check_panic_index refresh_backdrop if @last_index != @panic_index refresh_value if @last_value != @panic_value self.visible = $game_switches[SWITCH_ID] end def visible=(bool) if @last_state != bool @sprites.each{|sprite| sprite.visible = bool } end @last_state = bool end def dispose @sprites.each do |sprite| sprite.bitmap.dispose sprite.dispose end @sprites.clear end end class Scene_Map alias :kyon_panik_val_scn_map_crt_spr :create_spriteset alias :kyon_panik_val_scn_map_dsp_spr :dispose_spriteset alias :kyon_panik_val_scn_map_up :update def create_spriteset kyon_panik_val_scn_map_crt_spr @panic_box = PanicSpriteset.new end def dispose_spriteset kyon_panik_val_scn_map_dsp_spr @panic_box.dispose end def update kyon_panik_val_scn_map_up @panic_box.update end end 复制代码
Terms & Conditions
You can find them embedded in my scriptlet.
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/panik-value-ace.143404/