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

[转载发布] Some Popup 2.8

[复制链接]
累计送礼:
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-1 15:00:28 | 显示全部楼层 |阅读模式
    Some Popup 2.8

    mikb89



    Introduction

    With this script you can specify some text to be drawn when the player face an event. Text can be binded above the event or above the player or in center of the screen. There are many transition effects and it's possible to use picture instead of text. You can also play a SE, ME, BGM or BGS, on every popup event or for specific ones.

    Features


    • show simple text
    • bind in the middle of screen
    • bind above the player
    • bind above the event
    • show text grayed out
    • show picture
    • play SE/ME/BGM/BGS
    • fade text transition
    • move text transition
    • zoom text transition
    • transitions mixed together

    Screenshots





    How to Use

    Copy the script under Materials to use.

    Info on how to create popup event inside the script.

    Demo

    Multilanguage demo v. 2.8 (1.35 M


    http://www.mediafire.com/?1q8pjd848mvd6n4

    Script

    Spoiler                Code:       
    1. # Some Popup v 2.8
    2. # VX Ace version
    3. # by mikb89
    4. # Details:
    5. #  Show some popup text when facing an event.
    6. #  Text can be placed in center of screen, over the player or over the event.
    7. #  Write [pop] in a comment to assign the popup to an event and write in the
    8. #   next comment the text that will be shown.
    9. # NOTE: [pop] is by default, but you can change it in the settings.
    10. #  Text can be also grayed, to indicate a non-available something. To do so,
    11. #   write [npop] instead of [pop].
    12. #  You can also show a picture instead of text. In order to do this, the first
    13. #   comment must be [ppop] and the second will contain the name of the Picture.
    14. #  It is possible to play a sound/music effect for each event. Just write in a
    15. #   third comment these lines:
    16. #    SE (or ME or BGM or BGS)
    17. #    Audio filename
    18. #    Volume (1-100)
    19. #    Pitch (50-150)
    20. #    You can omit the two last lines, and they will be set by default:
    21. #    Volume 80 for BGS and SE, 100 for BGM and ME
    22. #    Pitch 100
    23. # ATTENTION: comments have to be the first two (or three) commands of the event.
    24. #
    25. #  You can also call a script with:
    26. #    $game_player.remove_town_sprite
    27. #   in it to remove the sprite. For example if you put the sprite on an event
    28. #   which you'll speak, with this code you can remove the popup.
    29. # Configurations:
    30. module SPOP
    31.   ID = "pop" # set "loc" for old version compatibility.
    32.    # What you have to write on a event to be identified as popup one.
    33.    # If the value here is for example "pop" you'll have to write:
    34.    #  - [pop] for the common text popup;
    35.    #  - [npop] for the grayed out popup;
    36.    #  - [ppop] for the picture popup.
    37.   AUTO_REMOVE_AT_TRANSFER = true
    38.    # Test to understand what I mean.
    39.    #  true - gives the same effect as the one in Chrono Trigger towns.
    40.    #  false - let the popup be visible after the teleport. Will fade out at the
    41.    #          first player movement.
    42.   GRAYED_COLOR = Color.new(255,245,255,175)
    43.    # Value of grey color. Red, green, blue, alpha. From 0 to 255.
    44.   WALK_8_DIR = true
    45.    # You don't have to include the 8dir script. Just set true this.
    46.   POPUP_TRANSITION = 9
    47.    # The effect of the popup appearing/disappearing.
    48.    #  0: no effect
    49.    #  1: fading in/out
    50.    #  2: movement up/down
    51.    #  3: movement & fading
    52.    #  4: reduced movement
    53.    #  5: reduced movement & fading
    54.    #  6: zoom in/out
    55.    #  7: zoom & fading
    56.    #  8: zoom & movement
    57.    #  9: zoom, movement, fading
    58.    # 10: zoom & reduced movement
    59.    # 11: zoom, reduced movement, fading
    60.   POPUP_SOUND = ["SE", "Book1", 80, 100]
    61.    # Play something on popup.
    62.    # 4 parameters:
    63.    #  1. Sound kind ("SE", "ME", "BGS", "BGM");
    64.    #  2. Name of the file;
    65.    #  3. Volume (0-100);
    66.    #  4. Pitch (50-150 (or 15-453 if you want MAXIMUM values)).
    67.    # To deactivate sound just set "" the 2. or set 0 to 3. Examples:
    68.    #  POPUP_SOUND = ["SE", "", 80, 100]
    69.    #  POPUP_SOUND = ["SE", "Book1", 0, 100]
    70.    # Won't be played.
    71.    # Eventual BGM or BGS playing will fade as the graphic fade/zoom/move and
    72.    #  will start after the popup close. Obviously not valid if using SE/ME.
    73.    # Examples with ME, BGM, BGS:
    74.    #  POPUP_SOUND = ["ME", "Item", 100, 100]
    75.    #  POPUP_SOUND = ["BGM", "Town1", 100, 100]
    76.    #  POPUP_SOUND = ["BGS", "Clock", 100, 100]
    77.   POPUP_BINDING = 2
    78.    # Where the popup should be binded.
    79.    #  0: center of the screen
    80.    #  1: over the player
    81.    #  2: over the event
    82. end
    83. # Others:
    84. #  You'll see 'town' everywhere in the script. This is because of the SECOND
    85. #   name given to this script: "Popup town name".
    86. #  The FIRST original name was "Location system", from this the [loc] to add in
    87. #   event comments. By the way I never publicated the version with this name, so
    88. #   you won't find anything.
    89. #Codename: spop
    90. ($imported ||= {})[:mikb89_spop] = true
    91. # License:
    92. # - You can ask me to include support for other scripts as long as these scripts
    93. #   use the $imported[script] = true;
    94. # - You can modify and even repost my scripts, after having received a response
    95. #   by me. For reposting it, anyway, you must have done heavy edit or porting,
    96. #   you can't do a post with the script as is;
    97. # - You can use my scripts for whatever you want, from free to open to
    98. #   commercial games. I'd appreciate by the way if you let me know about what
    99. #   you're doing;
    100. # - You must credit me, if you use this script or part of it.
    101. class Game_Player < Game_Character
    102.   #--------------------------------------------------------------------------
    103.   # * Object Initialization
    104.   #--------------------------------------------------------------------------
    105.   alias_method(:initGP_b4_spop, :initialize) unless method_defined?(:initGP_b4_spop)
    106. #class Game_Player#def initialize() <- aliased
    107.   def initialize
    108.     initGP_b4_spop
    109.     @town_sprite = nil
    110.     @town_text = ""
    111.     reset_audio
    112.     @town_ex_audio = nil
    113.     @sync_event = nil
    114.   end
    115.   #--------------------------------------------------------------------------
    116.   # * Frame Update
    117.   #--------------------------------------------------------------------------
    118.   alias_method(:updateGP_b4_spop, :update) unless method_defined?(:updateGP_b4_spop)
    119. #class Game_Player#def update() <- aliased
    120.   def update
    121.     updateGP_b4_spop
    122.     if @town_sprite != nil
    123.       case SPOP::POPUP_BINDING
    124.       when 1
    125.         @town_sprite.x = $game_player.screen_x
    126.         if @town_sprite.y != $game_player.screen_y && $game_player.screen_y != @sync_y
    127.           @town_sprite.y = $game_player.screen_y - (@town_sprite.y - @sync_y).abs
    128.           @sync_y = $game_player.screen_y
    129.         end
    130.       when 2
    131.         if @sync_event != nil
    132.           @town_sprite.x = @sync_event.screen_x
    133.           if @town_sprite.y != @sync_event.screen_y && @sync_event.screen_y != @sync_y
    134.             @town_sprite.y = @sync_event.screen_y - (@town_sprite.y - @sync_y).abs
    135.             @sync_y = @sync_event.screen_y
    136.           end
    137.           remove_town_sprite if Math.hypot(@sync_event.distance_x_from($game_player.x), @sync_event.distance_y_from($game_player.y)) > 2
    138.         end
    139.       end
    140.       rem = false
    141.       @town_sprite.visible = SceneManager.scene_is?(Scene_Map)
    142.       @town_sprite.update
    143.       if [1,3,5,7,9,11].include?(SPOP::POPUP_TRANSITION)
    144.         @town_sprite.opacity -= 15 if @town_sprite.z == 5 && @town_sprite.opacity > 0
    145.         @town_sprite.opacity += 15 if @town_sprite.z == 10 && @town_sprite.opacity < 255
    146.         rem = true if @town_sprite.opacity <= 0
    147.       end
    148.       if [2,3,4,5,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
    149.         mov = [4,5,10,11].include?(SPOP::POPUP_TRANSITION) ? 32 : 64
    150.         val = mov/16
    151.         t = @town_sprite.y
    152.         @town_sprite.y += val if @town_sprite.z == 5 && @toadd > -mov
    153.         @town_sprite.y -= val if @town_sprite.z == 10 && @toadd > 0
    154.         @toadd -= val if t != @town_sprite.y
    155.         rem = true if @toadd <= -mov
    156.       end
    157.       if [6,7,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
    158.         if @town_sprite.z == 5 && @town_sprite.zoom_x > 0
    159.           @town_sprite.zoom_x -= 0.25
    160.           @town_sprite.zoom_y -= 0.25
    161.         end
    162.         if @town_sprite.z == 10 && @town_sprite.zoom_x < 1
    163.           @town_sprite.zoom_x += 0.25
    164.           @town_sprite.zoom_y += 0.25
    165.         end
    166.         rem = true if @town_sprite.zoom_x <= 0
    167.       end
    168.       if @town_ex_audio != nil
    169.         if @audiowait > 0
    170.           @audiowait -= 1
    171.         elsif @audiowait == 0
    172.           if @town_audio != nil
    173.             @town_audio.play
    174.             if @town_ex_audio.class != @town_audio.class
    175.               @town_ex_audio.replay
    176.               @town_ex_audio = nil
    177.             end
    178.             reset_audio if @town_audio.name != SPOP::POPUP_SOUND[1]
    179.           end
    180.           @audiowait = -1
    181.         end
    182.       end
    183.       remove_town_sprite(true) if rem
    184.     end
    185.   end
    186.   #--------------------------------------------------------------------------
    187.   # * Removing of town sprite when changing map
    188.   #--------------------------------------------------------------------------
    189.   alias_method(:perform_transfer_b4_spop, :perform_transfer) unless method_defined?(:perform_transfer_b4_spop)
    190. #class Game_Player#def perform_transfer() <- aliased
    191.   def perform_transfer
    192.     remove_town_sprite(true, false) if SPOP::AUTO_REMOVE_AT_TRANSFER
    193.     perform_transfer_b4_spop
    194.   end
    195.   #--------------------------------------------------------------------------
    196.   # * Processing of Movement via input from the Directional Buttons
    197.   #--------------------------------------------------------------------------
    198. #class Game_Player#def move_by_input() <- rewritten
    199.   def move_by_input
    200.     return unless movable?
    201.     return if $game_map.interpreter.running?
    202.     x, y = self.x, self.y
    203.     case SPOP::WALK_8_DIR ? Input.dir8 : Input.dir4
    204.     when 1
    205.       move_diagonal(4,2)#lower_left
    206.       if !@move_succeed
    207.         check_town(x-1, y+1)
    208.       else
    209.         check_town(x-2, y+2)
    210.       end
    211.     when 2
    212.       move_straight(2)#down
    213.       if !@move_succeed
    214.         check_town(x, y+1)
    215.       else
    216.         check_town(x, y+2)
    217.       end
    218.     when 3
    219.       move_diagonal(6,2)#lower_right
    220.       if !@move_succeed
    221.         check_town(x+1, y+1)
    222.       else
    223.         check_town(x+2, y+2)
    224.       end
    225.     when 4
    226.       move_straight(4)#left
    227.       if !@move_succeed
    228.         check_town(x-1, y)
    229.       else
    230.         check_town(x-2, y)
    231.       end
    232.     when 6
    233.       move_straight(6)#right
    234.       if !@move_succeed
    235.         check_town(x+1, y)
    236.       else
    237.         check_town(x+2, y)
    238.       end
    239.     when 7
    240.       move_diagonal(4,8)#upper_left
    241.       if !@move_succeed
    242.         check_town(x-1, y-1)
    243.       else
    244.         check_town(x-2, y-2)
    245.       end
    246.     when 8
    247.       move_straight(8)#up
    248.       if !@move_succeed
    249.         check_town(x, y-1)
    250.       else
    251.         check_town(x, y-2)
    252.       end
    253.     when 9
    254.       move_diagonal(6,8)#upper_right
    255.       if !@move_succeed
    256.         check_town(x+1, y-1)
    257.       else
    258.         check_town(x+2, y-2)
    259.       end
    260.     end
    261.   end
    262.   #--------------------------------------------------------------------------
    263.   # * Operations for sprite removal and audio stopping
    264.   #--------------------------------------------------------------------------
    265. #class Game_Player#def remove_town_sprite(instant, audio)
    266.   def remove_town_sprite(instant=false, audio=true)
    267.     if @town_sprite != nil
    268.       if instant || SPOP::POPUP_TRANSITION == 0
    269.         if audio
    270.           @town_audio.class.stop if @town_audio != nil
    271.           @town_ex_audio.replay if @town_ex_audio != nil
    272.         end
    273.         @town_ex_audio = nil
    274.         @town_sprite.dispose
    275.         @town_sprite = nil
    276.         @sync_event = nil
    277.       else
    278.         @town_sprite.z = 5
    279.         unless @town_audio.is_a?(RPG::SE)
    280.           @town_audio.class.fade(4) if @town_audio != nil
    281.         end
    282.       end
    283.     end
    284.   end
    285.   #--------------------------------------------------------------------------
    286.   # * Set the audio as the one specified in SPOP or passed
    287.   #--------------------------------------------------------------------------
    288. #class Game_Player#def reset_audio(spn)
    289.   def reset_audio(spn = SPOP::POPUP_SOUND)
    290.     @town_audio = (spn[1] == "" ||
    291.                   spn[2] <= 0) ? nil :
    292.                     case spn[0]
    293.                     when "BGM"; RPG::BGM.new(spn[1], spn[2], spn[3])
    294.                     when "BGS"; RPG::BGS.new(spn[1], spn[2], spn[3])
    295.                     when "ME"; RPG::ME.new(spn[1], spn[2], spn[3])
    296.                     when "SE"; RPG::SE.new(spn[1], spn[2], spn[3])
    297.                     end
    298.   end
    299.   #--------------------------------------------------------------------------
    300.   # * Check if there is a town event in front of the player
    301.   #--------------------------------------------------------------------------
    302. #class Game_Player#def check_town(x, y)
    303.   def check_town(x, y)
    304.     return false if $game_map.interpreter.running?
    305.     result = false
    306.     for event in $game_map.events_xy(x, y)
    307.       unless [1,2].include?(event.trigger) and event.priority_type == 1
    308.         if event.list != nil
    309.           if event.list[0].code == 108 and
    310.             ["[#{SPOP::ID}]", "[n#{SPOP::ID}]", "[p#{SPOP::ID}]"].include?(event.list[0].parameters[0])
    311.             result = true
    312.             next if @town_sprite != nil && @town_sprite.z == 10 && @town_text == event.list[1].parameters[0]
    313.             remove_town_sprite(true)
    314.             @town_sprite = Sprite.new
    315.             @town_sprite.z = 10
    316.             if [6,7,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
    317.               @town_sprite.zoom_x = @town_sprite.zoom_y = 0.0
    318.             end
    319.             @town_sprite.opacity = 15 if [1,3,5,7,9,11].include?(SPOP::POPUP_TRANSITION)
    320.             if event.list[0].parameters[0] != "[p#{SPOP::ID}]"
    321.               @town_sprite.bitmap ||= Bitmap.new(1,1)
    322.               siz = @town_sprite.bitmap.text_size(event.list[1].parameters[0])
    323.               h = siz.height
    324.               s = siz.width
    325.               @town_sprite.bitmap.dispose
    326.               @town_sprite.bitmap = Bitmap.new(s, 24)
    327.               if event.list[0].parameters[0] == "[n#{SPOP::ID}]"
    328.                 ex = @town_sprite.bitmap.font.color
    329.                 @town_sprite.bitmap.font.color = SPOP::GRAYED_COLOR
    330.               end
    331.               @town_sprite.bitmap.draw_text(0,2,s,22,event.list[1].parameters[0],1)
    332.               @town_sprite.bitmap.font.color = ex if event.list[0].parameters[0] == "[n#{SPOP::ID}]"
    333.             else
    334.               @town_sprite.bitmap = Cache.picture(event.list[1].parameters[0])
    335.               s = @town_sprite.bitmap.width
    336.               h = @town_sprite.bitmap.height
    337.             end
    338.             @town_text = event.list[1].parameters[0]
    339.             @town_sprite.ox = s/2
    340.             @town_sprite.oy = h/2
    341.             case SPOP::POPUP_BINDING
    342.             when 1
    343.               @town_sprite.x = $game_player.screen_x#*32+16
    344.               @town_sprite.y = @sync_y = $game_player.screen_y#*32+16
    345.             when 2
    346.               @town_sprite.x = event.screen_x#*32+16
    347.               @town_sprite.y = @sync_y = event.screen_y#*32+16
    348.               @sync_event = event
    349.             else
    350.               @town_sprite.x = 544/2# - s/2
    351.               @town_sprite.y = 416/2# - h/2
    352.             end
    353.             @town_sprite.y -= 64 if [0,1,6,7].include?(SPOP::POPUP_TRANSITION)
    354.             @town_sprite.y -= 32 if [4,5,10,11].include?(SPOP::POPUP_TRANSITION)
    355.             @toadd = [2,3,4,5,8,9,10,11].include?(SPOP::POPUP_TRANSITION) ? 64 : 0
    356.             @toadd -= 32 if [4,5,10,11].include?(SPOP::POPUP_TRANSITION)
    357.             if @town_audio != nil || event.list[2].code == 108
    358.               if ["BGM", "ME", "BGS", "SE"].include?(event.list[2].parameters[0]) &&
    359.                 event.list[3].code == 408
    360.                 arr = []
    361.                 arr.push(event.list[2].parameters[0])
    362.                 arr.push(event.list[3].parameters[0])
    363.                 if event.list[4].code == 408
    364.                   arr.push(event.list[4].parameters[0].to_i)
    365.                   arr.push(event.list[5].parameters[0].to_i) if event.list[5].code == 408
    366.                 else
    367.                   arr.push(["BGS", "SE"].include?(event.list[2].parameters[0]) ? 80 : 100)
    368.                 end
    369.                 arr.push(100) if arr.size < 4
    370.                 reset_audio(arr)
    371.               end
    372.               @town_ex_audio = @town_audio.class.last if [RPG::BGM, RPG::BGS].include?(@town_audio.class)
    373.               if @town_ex_audio != nil
    374.                 @town_ex_audio.class.fade(4)
    375.                 @audiowait = 4
    376.               else
    377.                 @town_audio.play
    378.                 reset_audio if arr != nil
    379.               end
    380.             end
    381.           end
    382.         end
    383.       end
    384.     end
    385.     remove_town_sprite unless result
    386.     return result
    387.   end
    388. end
    389. #--------------------------------------------------------------------------
    390. # * Sprite removal at Save (can't save a Sprite) and End
    391. #--------------------------------------------------------------------------
    392. class Scene_Save < Scene_File
    393.   if method_defined?(:start)
    394.     alias_method(:start_SSav_b4_spop, :start) unless method_defined?(:start_SSav_b4_spop)
    395.   end
    396. #class Scene_Save#def start() <- aliased/added
    397.   def start
    398.     if respond_to?(:start_SSav_b4_spop)
    399.       start_SSav_b4_spop
    400.     else
    401.       super
    402.     end
    403.     $game_player.remove_town_sprite(true)
    404.   end
    405. end
    406. class Scene_End < Scene_MenuBase
    407.   alias_method(:start_SEnd_b4_spop, :start) unless method_defined?(:start_SEnd_b4_spop)
    408. #class Scene_End#def start() <- aliased
    409.   def start
    410.     start_SEnd_b4_spop
    411.     $game_player.remove_town_sprite(true)
    412.   end
    413. end
    复制代码





    Also visible on Pastebin.FAQ

    Q: Can I use the 8 directions script?

    A: No, but the 8 dir functionality is included, just enable it in settings.

    Credit and Thanks

    Thanks Guardian of Irael for various suggestions.

    Author's Notes

    N/A


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-18 00:25 , Processed in 0.138275 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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