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

[转载发布] Panik Value ACE

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

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-2 18:33:02 | 显示全部楼层 |阅读模式
    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:       
    1. # * Panik Value ACE
    2. #   Scripter : Kyonides Arkanthes
    3. #   v1.0.2 - 2022-01-02
    4. # * This script is free as beer and speech! * #
    5. # Display the current Panic Level on screen!
    6. # It changes its backdrop depending on how dangerous the situation actually is.
    7. # You can toggle it by turning a specific game switch on and off at will.
    8. # A flash will be displayed if the Panic Level hits a certain value.
    9. # Please adjust the values of all the CONSTANTS found below in the Panik module.
    10. module Panik
    11.   BACKDROP_X = 460
    12.   BACKDROP_Y = 0
    13.   # Pictures for Good, So so and Bad Panic Levels
    14.   BACKDROPS = ["", "", ""]
    15.   VAR_ID = 100
    16.   SWITCH_ID = 1
    17.   FONT_NAME = "Verdana"
    18.   FONT_SIZE = 20
    19.   # [ Red, Green, Blue ] for each Panic Level
    20.   FONT_COLOR = [[255,255,255], [220,80,20], [255,0,0]]
    21.   FLASH_MIN_VALUE = 90
    22.   FLASH_COLOR = [255,0,0,128] # [ Red, Green, Blue, Opacity ]
    23.   FLASH_DURATION = 8
    24. end
    25. class PanicSpriteset
    26.   include Panik
    27.   def initialize
    28.     @box = Sprite.new
    29.     @box.x = BACKDROP_X
    30.     @box.y = BACKDROP_Y
    31.     @board = Sprite.new
    32.     @board.x = BACKDROP_X + 4
    33.     @board.y = BACKDROP_Y + 4
    34.     @sprites = [@box, @board]
    35.     refresh_panic
    36.     check_panic_index
    37.     refresh_backdrop
    38.     @board.bitmap = Bitmap.new(@box.width - 8, @box.height - 8)
    39.     refresh_value
    40.     self.visible = $game_switches[SWITCH_ID]
    41.   end
    42.   def check_panic_index
    43.     @panic_index = case @panic_value
    44.     when 0..49   then 2
    45.     when 50..75  then 1
    46.     when 75..100 then 0
    47.     end
    48.   end
    49.   def refresh_panic
    50.     @panic_value = [0, $game_variables[VAR_ID]].max
    51.     @panic_value = [@panic_value, 100].min
    52.   end
    53.   def refresh_backdrop
    54.     @last_index = @panic_index
    55.     backdrop = BACKDROPS[@last_index]
    56.     @box.bitmap.dispose if @box.bitmap != nil
    57.     @box.bitmap = Cache.picture(backdrop)
    58.   end
    59.   def refresh_value
    60.     @last_value = @panic_value
    61.     bit = @board.bitmap
    62.     bit.clear
    63.     bit.font.name = FONT_NAME
    64.     bit.font.size = FONT_SIZE
    65.     r, g, b = FONT_COLOR[@panic_index]
    66.     bit.font.color = Color.new(r, g, b, 255)
    67.     bit.draw_text(0, 0, @board.width, @board.height, @panic_value.to_s, 1)
    68.     return if FLASH_MIN_VALUE > @panic_value
    69.     r, g, b, a = FLASH_COLOR
    70.     $game_screen.start_flash(Color.new(r, g, b, a), FLASH_DURATION)
    71.   end
    72.   def update
    73.     refresh_panic
    74.     check_panic_index
    75.     refresh_backdrop if @last_index != @panic_index
    76.     refresh_value if @last_value != @panic_value
    77.     self.visible = $game_switches[SWITCH_ID]
    78.   end
    79.   def visible=(bool)
    80.     if @last_state != bool
    81.       @sprites.each{|sprite| sprite.visible = bool }
    82.     end
    83.     @last_state = bool
    84.   end
    85.   def dispose
    86.     @sprites.each do |sprite|
    87.       sprite.bitmap.dispose
    88.       sprite.dispose
    89.     end
    90.     @sprites.clear
    91.   end
    92. end
    93. class Scene_Map
    94.   alias :kyon_panik_val_scn_map_crt_spr :create_spriteset
    95.   alias :kyon_panik_val_scn_map_dsp_spr :dispose_spriteset
    96.   alias :kyon_panik_val_scn_map_up :update
    97.   def create_spriteset
    98.     kyon_panik_val_scn_map_crt_spr
    99.     @panic_box = PanicSpriteset.new
    100.   end
    101.   
    102.   def dispose_spriteset
    103.     kyon_panik_val_scn_map_dsp_spr
    104.     @panic_box.dispose
    105.   end
    106.   def update
    107.     kyon_panik_val_scn_map_up
    108.     @panic_box.update
    109.   end
    110. end
    复制代码


    Terms & Conditions

    You can find them embedded in my scriptlet.


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 09:25 , Processed in 0.135730 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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