• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Healing Machine Pokeballs, Pokemon Monitor Icons

73
Posts
4
Years
    • Seen May 13, 2024
    I upgraded my game from v20 to v21. I had these plugins in v20:

    Better Healing Machine
    (broken link removed)

    Script:

    class MakeHealingBallGraphics #------------------Settings CENTRE = false #change to false if Pokéball tray is between two tiles # if above is false, you need two events on the left and right side of the Pokéball tray # if above is true, place a single event in the middle of your Pokéball tray #------------------ def initialize balls=[] for poke in $player.party balls.push(poke.poke_ball) if !poke.egg? end return false if balls.length==0 @sprites={} @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @viewport.z=999999 for i in 0...balls.length @sprites["ball#{i}"]=Sprite.new(@viewport) if pbResolveBitmap("Graphics/Pictures/Balls/ball_#{balls[i]}.png") @sprites["ball#{i}"].bitmap=Bitmap.new("Graphics/Pictures/Balls/ball_#{balls[i]}.png") else @sprites["ball#{i}"].bitmap=Bitmap.new("Graphics/Pictures/Balls/ball_POKEBALL.png") end @sprites["ball#{i}"].visible=false end if CENTRE bitmap1=Bitmap.new(128,192) #testing bitmap2=Bitmap.new(128,192) #testing rect1=Rect.new(0,0,128,192/4) #testing was 128 rect2=Rect.new(0,0,128,192/4) #testing was 128, need to chnage ball grpahics!!!!! for i in 0...balls.length case i when 0 bitmap1.blt(0,50,@sprites["ball#{i}"].bitmap,rect1) #test bitmap1.blt(0,98,@sprites["ball#{i}"].bitmap,rect1) bitmap1.blt(0,146,@sprites["ball#{i}"].bitmap,rect1) bitmap2.blt(0,50,@sprites["ball#{i}"].bitmap,rect2) #test bitmap2.blt(0,98,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,146,@sprites["ball#{i}"].bitmap,rect2) when 1 bitmap1.blt(0,106,@sprites["ball#{i}"].bitmap,rect1) bitmap1.blt(0,154,@sprites["ball#{i}"].bitmap,rect1) bitmap2.blt(0,58,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,106,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,154,@sprites["ball#{i}"].bitmap,rect2) when 2 bitmap1.blt(15,146,@sprites["ball#{i}"].bitmap,rect1) bitmap2.blt(15,50,@sprites["ball#{i}"].bitmap,rect1) bitmap2.blt(15,98,@sprites["ball#{i}"].bitmap,rect1) bitmap2.blt(15,146,@sprites["ball#{i}"].bitmap,rect2) when 3 bitmap2.blt(15,58,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(15,106,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(15,154,@sprites["ball#{i}"].bitmap,rect2) when 4 bitmap2.blt(0,114,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,162,@sprites["ball#{i}"].bitmap,rect2) when 5 bitmap2.blt(15,162,@sprites["ball#{i}"].bitmap,rect2) end Graphics.update end if RTP.exists?("Graphics/Characters/Healing balls 1.png") File.delete("Graphics/Characters/Healing balls 1.png") end if RTP.exists?("Graphics/Characters/Healing balls 2.png") File.delete("Graphics/Characters/Healing balls 2.png") end bitmap1.to_file("Graphics/Characters/Healing balls 1.png") bitmap2.to_file("Graphics/Characters/Healing balls 2.png") else #if CENTRE != true bitmap1=Bitmap.new(128,192) bitmap2=Bitmap.new(128,192) rect1=Rect.new(0,0,128,192/4) rect2=Rect.new(0,0,128,192/4) for i in 0...balls.length case i when 0 bitmap1.blt(20,50,@sprites["ball#{i}"].bitmap,rect1) bitmap1.blt(20,98,@sprites["ball#{i}"].bitmap,rect1) bitmap1.blt(20,146,@sprites["ball#{i}"].bitmap,rect1) when 1 bitmap2.blt(0,50,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,98,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,146,@sprites["ball#{i}"].bitmap,rect2) when 2 bitmap1.blt(20,106,@sprites["ball#{i}"].bitmap,rect1) bitmap1.blt(20,154,@sprites["ball#{i}"].bitmap,rect1) when 3 bitmap2.blt(0,106,@sprites["ball#{i}"].bitmap,rect2) bitmap2.blt(0,154,@sprites["ball#{i}"].bitmap,rect2) when 4 bitmap1.blt(20,162,@sprites["ball#{i}"].bitmap,rect1) when 5 bitmap2.blt(0,162,@sprites["ball#{i}"].bitmap,rect2) end Graphics.update end if RTP.exists?("Graphics/Characters/Healing balls left.png") File.delete("Graphics/Characters/Healing balls left.png") end if RTP.exists?("Graphics/Characters/Healing balls right.png") File.delete("Graphics/Characters/Healing balls right.png") end bitmap1.to_file("Graphics/Characters/Healing balls left.png") bitmap2.to_file("Graphics/Characters/Healing balls right.png") end #CENTRE check end pbDisposeSpriteHash(@sprites) @viewport.dispose bitmap1.dispose bitmap2.dispose end end

    Pokemon monitor icons

    Script:

    # ------------------------------------------------------------------------------------------------------------- # Pokemon monitor icons # ------------------------------------------------------------------------------------------------------------- # # Credit: Ulithium_Dragon (original), bo4p5687 (update) # # ------------------------------------------------------------------------------------------------------------- # # Call: MonitorIcons.show and replace with this method in event 'Nurse' # # count = $player.pokemon_count # for i in 1..count # pbSet(6, i) # pbSEPlay("Battle ball shake") # pbWait(16) # end # # ------------------------------------------------------------------------------------------------------------- # If you want to change coordinate of bitmap, call like this MonitorIcons.show(x', y') # -> x', y' are numbers that have equation: x (real) = x (recent) + x'; y (real) = y (recent) + y' # You can change zoom with this method -> MonitorIcons.show(x', y', zoom) # If you want to change zoom but you don't want to change x and y, just call MonitorIcons.show(0, 0, zoom) # It uses icon file of PE # ------------------------------------------------------------------------------------------------------------- # In event 'Nurse', you can try use this method: # MonitorIcons.show(15, -65, 0.45) # ------------------------------------------------------------------------------------------------------------- module MonitorIcons class Show def self.icons(position, x, y, zoom) pkmn = $player.party[position-1] species = pkmn.species species = GameData::Species.get(species).species bmpkmn = GameData::Species.icon_bitmap(species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?) realw = bmpkmn.width / 2 realh = bmpkmn.height viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) viewport.z = 99999 @sprite = Sprite.new(viewport) @sprite.bitmap = bmpkmn @sprite.src_rect.width = realw @sprite.ox = @sprite.src_rect.width / 2 @sprite.oy = @sprite.src_rect.height / 2 @sprite.x = x @sprite.y = y @sprite.zoom_x = @sprite.zoom_y = zoom end def self.finish @sprite.dispose @sprite = nil end end def self.show(addx = 0, addy = 0, zoom = 1) count = $player.pokemon_count for i in 1..count pbSet(6, i) event = pbMapInterpreter.get_self x = event.screen_x + addx y = event.screen_y + addy s = Show s.icons(i, x, y, zoom) pbSEPlay("Battle ball shake") pbWait(16) s.finish end end end

    I moved them directly to v21, mainly to test them.
    This is what I have in the Nurse event:
    Healing Machine Pokeballs, Pokemon Monitor Icons
    Healing Machine Pokeballs, Pokemon Monitor Icons
    To be completely honest, I don't remember what's the purpose of those script commands inside the event, but it worked perfectly in v20 like that.
    For some reason, after the first ball is placed and first icon appears, the game effectively freezes. Nothing else happens, music keeps playing. Until I activate this plugin's speed up:

    Delta Speed Up
    (broken link removed)

    Script:

    #===============================================================================# # Whether the options menu shows the speed up settings (true by default) #===============================================================================# module Settings SPEED_OPTIONS = true end #===============================================================================# # Speed-up config #===============================================================================# SPEEDUP_STAGES = [1, 2, 3] $GameSpeed = 0 $CanToggle = true #===============================================================================# # Set $CanToggle depending on the saved setting #===============================================================================# module Game class << self alias_method :original_load, :load unless method_defined?(:original_load) end def self.load(save_data) original_load(save_data) $CanToggle = $PokemonSystem.only_speedup_battles == 0 end end #===============================================================================# # Handle incrementing speed stages if $CanToggle allows it #===============================================================================# module Input def self.update update_KGC_ScreenCapture pbScreenCapture if trigger?(Input::F8) if $CanToggle && trigger?(Input::AUX1) $GameSpeed += 1 $GameSpeed = 0 if $GameSpeed >= SPEEDUP_STAGES.size $PokemonSystem.battle_speed = $GameSpeed if $PokemonSystem && $PokemonSystem.only_speedup_battles == 1 end end end #===============================================================================# # Return System.Uptime with a multiplier to create an alternative timeline #===============================================================================# module System class << self alias_method :unscaled_uptime, :uptime unless method_defined?(:unscaled_uptime) end def self.uptime return SPEEDUP_STAGES[$GameSpeed] * unscaled_uptime end end #===============================================================================# # Event handlers for in-battle speed-up restrictions #===============================================================================# EventHandlers.add(:on_start_battle, :start_speedup, proc { $CanToggle = false $GameSpeed = $PokemonSystem.battle_speed if $PokemonSystem.only_speedup_battles == 1 }) EventHandlers.add(:on_end_battle, :stop_speedup, proc { $GameSpeed = 0 if $PokemonSystem.only_speedup_battles == 1 $CanToggle = true if $PokemonSystem.only_speedup_battles == 0 }) #===============================================================================# # Can only change speed in battle during command phase (prevents weird animation glitches) #===============================================================================# class Battle alias_method :original_pbCommandPhase, :pbCommandPhase unless method_defined?(:original_pbCommandPhase) def pbCommandPhase $CanToggle = true original_pbCommandPhase $CanToggle = false end end #===============================================================================# # Fix for consecutive battle soft-lock glitch #===============================================================================# alias :original_pbBattleOnStepTaken :pbBattleOnStepTaken def pbBattleOnStepTaken(repel_active) return if $game_temp.in_battle original_pbBattleOnStepTaken(repel_active) end #===============================================================================# # Fix for scrolling fog speed #===============================================================================# class Game_Map alias_method :original_update, :update unless method_defined?(:original_update) def update temp_timer = @fog_scroll_last_update_timer @fog_scroll_last_update_timer = System.uptime # Don't scroll in the original update method original_update @fog_scroll_last_update_timer = temp_timer update_fog end def update_fog uptime_now = System.unscaled_uptime @fog_scroll_last_update_timer = uptime_now unless @fog_scroll_last_update_timer speedup_mult = $PokemonSystem.only_speedup_battles == 1 ? 1 : SPEEDUP_STAGES[$GameSpeed] scroll_mult = (uptime_now - @fog_scroll_last_update_timer) * 5 * speedup_mult @fog_ox -= @fog_sx * scroll_mult @fog_oy -= @fog_sy * scroll_mult @fog_scroll_last_update_timer = uptime_now end end #===============================================================================# # Fix for animation index crash #===============================================================================# class SpriteAnimation def update_animation new_index = ((System.uptime - @_animation_timer_start) / @_animation_time_per_frame).to_i if new_index >= @_animation_duration dispose_animation return end quick_update = (@_animation_index == new_index) @_animation_index = new_index frame_index = @_animation_index current_frame = @_animation.frames[frame_index] unless current_frame dispose_animation return end cell_data = current_frame.cell_data position = @_animation.position animation_set_sprites(@_animation_sprites, cell_data, position, quick_update) return if quick_update @_animation.timings.each do |timing| next if timing.frame != frame_index animation_process_timing(timing, @_animation_hit) end end end #===============================================================================# # PokemonSystem Accessors #===============================================================================# class PokemonSystem alias_method :original_initialize, :initialize unless method_defined?(:original_initialize) attr_accessor :only_speedup_battles attr_accessor :battle_speed def initialize original_initialize @only_speedup_battles = 0 # Speed up setting (0=always, 1=battle_only) @battle_speed = 0 # Depends on the SPEEDUP_STAGES array size end end #===============================================================================# # Options menu handlers #===============================================================================# MenuHandlers.add(:options_menu, :only_speedup_battles, { "name" => _INTL("Speed Up Settings"), "order" => 25, "type" => EnumOption, "parameters" => [_INTL("Always"), _INTL("Only Battles")], "description" => _INTL("Choose which aspect is sped up."), "get_proc" => proc { next $PokemonSystem.only_speedup_battles }, "set_proc" => proc { |value, scene| $GameSpeed = 0 if value != $PokemonSystem.only_speedup_battles $PokemonSystem.only_speedup_battles = value $CanToggle = value == 0 } }) MenuHandlers.add(:options_menu, :battle_speed, { "name" => _INTL("Battle Speed"), "order" => 26, "type" => EnumOption, "parameters" => [_INTL("x#{SPEEDUP_STAGES[0]}"), _INTL("x#{SPEEDUP_STAGES[1]}"), _INTL("x#{SPEEDUP_STAGES[2]}")], "description" => _INTL("Choose the battle speed when the battle speed-up is set to 'Battles Only'."), "get_proc" => proc { next $PokemonSystem.battle_speed }, "set_proc" => proc { |value, scene| $PokemonSystem.battle_speed = value } })

    When I speed it up, the balls and icons do appear, kinda properly. (Since it's being sped up, I can't tell if all my waits and timing work properly).
    Does anybody know why? Or has someone made similar plugins work on v21?
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    The issue is the pbWait. In v20, pbWait waits for the specified number of frames (16 or 0.4 Seconds). But in v21, that same method now waits for the specified number of seconds. If you swap out the pbWait(16) for pbWait(0.4), it should behave as expected (as older versions of essentials ran at 40 FPS, so 16 frames/40 FPS is 0.4 seconds)
    Mind that I haven't checked if there are any other modifications necessary, but v20 and v21 aren't too different generally outside of battle stuff, and the retimed UIs.
     
    73
    Posts
    4
    Years
    • Seen May 13, 2024
    The issue is the pbWait. In v20, pbWait waits for the specified number of frames (16 or 0.4 Seconds). But in v21, that same method now waits for the specified number of seconds. If you swap out the pbWait(16) for pbWait(0.4), it should behave as expected (as older versions of essentials ran at 40 FPS, so 16 frames/40 FPS is 0.4 seconds)
    Mind that I haven't checked if there are any other modifications necessary, but v20 and v21 aren't too different generally outside of battle stuff, and the retimed UIs.
    GOAT
    The ball animation looks a little funny, maybe I just have to adjust some waits inside the event itself, but it works perfectly otherwise, thank you very much!
     
    Back
    Top