Per 2016, RMID pindah ke RMID Discord (Invite link dihapus untuk mencegah spambot -Theo @ 2019). Posting sudah tidak bisa dilakukan lagi.
Mohon maaf atas ketidaknyamanannya dan mohon kerjasamanya.

Share | 
 

 [VX/VXA]Pop-up Message

Topik sebelumnya Topik selanjutnya Go down 
[VX/VXA]Pop-up Message Empty2012-07-10, 08:28
Post[VX/VXA]Pop-up Message
#1
DrDhoom 
Doomed Zombie
DrDhoom

Level 5
Posts : 629
Thanked : 22
Engine : Multi-Engine User
Skill : Intermediate
Type : Scripter

[VX/VXA]Pop-up Message Vide
PopUp Message
Versi: 1.1
Tipe: System


Pengenalan

Lagi ga ada kerjaan :hammer:
Convert dari scriptnya Lukas di thread https://rmid.forumotion.net/t5703p20-xppop-up-message


Fitur


  • Pop-up muncul bila dapet item,armor,weapon,gold,party
  • set sound, posisi.



Screenshots

Ga ada


Demo

Ga ada


Scripts

Code:
=begin
 * Pop Up Message.
 Vers. 1.1
 Created by Lukas Cahyadi Gunawan:  25/4/2012
 Converted by DrDhoom/WhiteHopper: 10/07/2012

 How To Use ? Place above Main.
 For RPG VX and RPG VXA (RGSS2/RGSS3)

 Feature:
 - Show message if there are changes of item, weapon, armor, gold, party.

 Thanks to :
      - Jesus My Savior

  This work is protected by the following license:
 ----------------------------------------------------------------------------
  Creative Commons - Attribusi-NonKomersial 3.0 Unported License.
  ( http://creativecommons.org/licenses/by-nc/3.0/ )

  CC BY-NC (Atribusi-NonKomersial).
  Memperbolehkan pihak lain untuk menyalin, mengumumkan, menyebarkan,
  menggubah, dan mengadaptasi ciptaan ini,
  selama mencantumkan nama pembuat.
 ----------------------------------------------------------------------------

 If you find bugs or errors can contact me at http://www.rpgmakerid.com/u2336.
=end
module LCG
#=============================================================================#
#                                ▼ CONFIGURATION ▼
#-----------------------------------------------------------------------------#
#---------------------------------------------------------------
# [A,B] A = 1 or 2. Left Side / Right Side.
#      B = 1 for line[down], 2 for [up].
  TYPE_POP_LCG = [1,2] #[1,1]/[1,2]/[2,1]/[2,2]
  Y_FROM = 352  # Limit from bottom. If use line[up].
#---------------------------------------------------------------
# Set SFX. [Gain, Lost, MONEY]
  POP_UP_SOUND = ["Item1", "Sleep", "Chime2"]
#---------------------------------------------------------------
  VOLUME_PU = 100                  # Set 0 to 100.
  PITC_PU = 100                    # Set 50 to 150.
  SWITCH_POPUP = 9                  # Set on switch to deactive pop_up.
  ICN_U = 246                      # Gold icon index. Default, VX = 86 and
                                    # VXA = 246
  GAIN_OR_LOST = ["Gain","Lost"]
  ITEM_WEAP_ARM = ["Item(s)", "Weapon(s)", "Armor(s)"]
  PARTY_WORD = ["joining with party.", "leaving party."]
  LOCATION_TIME_POP_UP = 77        # Set time popup.
#-----------------------------------------------------------------------------#
#                                ▲ CONFIGURATION ▲
#=============================================================================#
end
VXA = defined?(SceneManager)
class Game_Temp
  attr_accessor :pop; attr_accessor :pop_ref; attr_accessor :sfx_pop
  alias gol_item_initialize initialize
  def initialize
    gol_item_initialize
    @pop = {}
    @pop_ref = false
    @sfx_pop = 0
  end
end
class Bitmap
  if !VXA
    alias tulisan_outline draw_text
    def draw_text_full(x2, y2, w2 = 0, h2 = 0, text2 = '', a2 = 0)
      if x2.is_a?(Rect)
        x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
      else
        x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
      end
      save_color = self.font.color.clone
      self.font.color = Color.new(0, 0, 0)
      tulisan_outline(x - 1, y - 1, w, h, text, a); tulisan_outline(x + 1, y - 1, w, h, text, a)
      tulisan_outline(x - 1, y + 1, w, h, text, a); tulisan_outline(x + 1, y + 1, w, h, text, a)
      self.font.color = save_color; tulisan_outline(x, y, w, h, text, a)
    end
  end
end
class Game_Interpreter
  include LCG
  alias lcg_com_125 command_125
  def command_125
    lcg_com_125
    value = operate_value(@params[0], @params[1], @params[2])
    if !$game_switches[SWITCH_POPUP]
    $game_temp.pop.delete(@params[0]+ 5) if $game_temp.pop.key?(@params[0]+ 5)
    $game_temp.pop[@params[0]+ 5] = [value, LOCATION_TIME_POP_UP]
    $game_temp.sfx_pop = 2
    $game_temp.pop_ref = true
    end
    return true
  end
  alias lcg_com_126 command_126
  def command_126
    lcg_com_126
    value = operate_value(@params[1], @params[2], @params[3])
    if !$game_switches[SWITCH_POPUP]
    $game_temp.pop.delete($data_items[@params[0]]) if $game_temp.pop.key?($data_items[@params[0]])
    $game_temp.pop[$data_items[@params[0]]] = [value, LOCATION_TIME_POP_UP, @params[1]]
    $game_temp.sfx_pop = @params[1]; $game_temp.pop_ref = true
    end
    return true
  end
  alias lcg_com_127 command_127
  def command_127
    lcg_com_127
    value = operate_value(@params[1], @params[2], @params[3])
    if !$game_switches[SWITCH_POPUP]
    $game_temp.pop.delete($data_weapons[@params[0]]) if $game_temp.pop.key?($data_weapons[@params[0]])
    $game_temp.pop[$data_weapons[@params[0]]] = [value, LOCATION_TIME_POP_UP, @params[1]]
    $game_temp.sfx_pop = @params[1];$game_temp.pop_ref = true
    end
    return true
  end
  alias lcg_com_128 command_128
  def command_128
    lcg_com_128
    value = operate_value(@params[1], @params[2], @params[3])
    if !$game_switches[SWITCH_POPUP]
    $game_temp.pop.delete($data_armors[@params[0]]) if $game_temp.pop.key?($data_armors[@params[0]])
    $game_temp.pop[$data_armors[@params[0]]] = [value, LOCATION_TIME_POP_UP, @params[1]]
    $game_temp.sfx_pop = @params[1]; $game_temp.pop_ref = true
    end
    return true
  end
  alias lcg_com_129 command_129
  def command_129
    lcg_com_129
    if !$game_switches[SWITCH_POPUP]
    $game_temp.pop.delete(@params[1]) if $game_temp.pop.key?(@params[1])
    $game_temp.pop[@params[1]] = [@params[0], LOCATION_TIME_POP_UP]
    $game_temp.sfx_pop = @params[1]
    $game_temp.pop_ref = true
    end
    return true
  end
end
class Window_Popup < Window_Base
  include LCG
  def initialize
    super(TYPE_POP_LCG[0] == 2 ? 0 : -8, -14, 652, 512); self.opacity = 0
    refresh
  end
  def refresh
    if self.contents != nil; self.contents.dispose
      self.contents = nil
    end
    if $game_temp.pop != nil
      self.contents = Bitmap.new(width - 32, height - 32)
      (0...$game_temp.pop.size).each {|i| draw_item_pop_up(i)}
    end
  end
  def draw_item_pop_up(i)
    item = $game_temp.pop.keys[i]
    x = 0
    if TYPE_POP_LCG[1] == 2; y = Y_FROM - (i * 32)
    else; y = i * 32
    end
    if TYPE_POP_LCG[0] == 1
      case item
      when RPG::Item, RPG::Weapon, RPG::Armor
        text_width_w = self.contents.text_size(GAIN_OR_LOST[$game_temp.pop.values[i].to_a[2]] + " " + ITEM_WEAP_ARM[item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2]).width
        if !VXA
          self.contents.draw_text_full(x, y, text_width_w, 32, GAIN_OR_LOST[$game_temp.pop.values[i].to_a[2]] + " " + ITEM_WEAP_ARM[item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2])
        else
          self.contents.draw_text(x, y, text_width_w, 32, GAIN_OR_LOST[$game_temp.pop.values[i].to_a[2]] + " " + ITEM_WEAP_ARM[item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2])
        end
      when 0,1
        actor = $game_actors[$game_temp.pop.values[i].to_a[0]]
        bitmap = Cache.character(actor.character_name)
        sign = actor.character_name[/^[\!\$]./]
        if sign != nil and sign.include?('$')
          cw = bitmap.width / 3
          ch = bitmap.height / 4
        else
          cw = bitmap.width / 12
          ch = bitmap.height / 8
        end
        n = actor.character_index
        src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
        self.contents.blt(x,y, bitmap, src_rect)
        if !VXA
          self.contents.draw_text_full(cw, y, 160, 32, PARTY_WORD[item == 0 ? 0 : 1])
        else
          self.contents.draw_text(cw, y, 160, 32, PARTY_WORD[item == 0 ? 0 : 1])
        end
      else
        text_width_w = self.contents.text_size(GAIN_OR_LOST[item == 5 ? 0 : 1]).width
        if !VXA
          self.contents.draw_text_full(x, y, text_width_w, 32, GAIN_OR_LOST[item == 5 ? 0 : 1])
        else
          self.contents.draw_text(x, y, text_width_w, 32, GAIN_OR_LOST[item == 5 ? 0 : 1])
        end
      end
      unless item == 0 || item == 1
        icon_index = (item == 5 || item == 6 ? ICN_U : item.icon_index)
        bitmap = bitmap = Cache.system("Iconset");src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) 
        text_width = self.contents.text_size(item == 5 || item == 6 ? $game_temp.pop.values[i].to_a[0].to_s : item.name).width
        if !VXA
          self.contents.draw_text_full(item == 5 || item == 6 ? 4 + text_width_w : 32 + text_width_w, y, text_width, 32, item == 5 || item == 6 ? $game_temp.pop.values[i].to_a[0].to_s : item.name)
        else
          self.contents.draw_text(item == 5 || item == 6 ? 4 + text_width_w : 32 + text_width_w, y, text_width, 32, item == 5 || item == 6 ? $game_temp.pop.values[i].to_a[0].to_s : item.name)
        end
        unless item == 5 || item == 6
          text_width_s = self.contents.text_size("x  " + $game_temp.pop.values[i].to_a[0].to_s).width
          if !VXA
            self.contents.draw_text_full(text_width + text_width_w + 38 , y, text_width_s , 32, "x " + $game_temp.pop.values[i].to_a[0].to_s)
          else
            self.contents.draw_text(text_width + text_width_w + 38 , y, text_width_s , 32, "x " + $game_temp.pop.values[i].to_a[0].to_s)
          end
        end
        self.contents.blt(item == 5 || item == 6 ? text_width_w + text_width + 8 : text_width_w + 4, y + 4, bitmap, src_rect)
      end
    else
      unless item == 0 || item == 1
        bitmap = RPG::Cache.icon(item == 5 || item == 6 ? ICN_U : item.icon_name); src_rect = Rect.new(0, 0, 24, 24)
        unless item == 5 || item == 6
          text_width_s = self.contents.text_size("x  " + $game_temp.pop.values[i].to_a[0].to_s).width
          self.contents.draw_text_full(x, y, 616 , 32, "x " + $game_temp.pop.values[i].to_a[0].to_s,2)
        end
        text_width = self.contents.text_size(item == 5 || item == 6 ? $game_temp.pop.values[i].to_a[0].to_s : item.name).width
        self.contents.draw_text_full(item == 5 || item == 6 ? -32: -text_width_s, y, 616, 32, item == 5 || item == 6 ? $game_temp.pop.values[i].to_a[0].to_s : item.name, 2)
        self.contents.blt(item == 5 || item == 6 ? 616 - 28: 616 - text_width_s - text_width - 32, y + 4, bitmap, src_rect)
      end
      case item
      when RPG::Item, RPG::Weapon, RPG::Armor
        text_width_w = self.contents.text_size(GAIN_OR_LOST[$game_temp.pop.values[i].to_a[2]] + " " + ITEM_WEAP_ARM[item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2]).width
        self.contents.draw_text_full(-text_width_s - text_width - 38, y, 616, 32, GAIN_OR_LOST[$game_temp.pop.values[i].to_a[2]] + " " + ITEM_WEAP_ARM[item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2],2)
      when 0,1
        actor = $game_actors[$game_temp.pop.values[i].to_a[0]]
        bitmap = Cache.character(actor.character_name)
        sign = actor.character_name[/^[\!\$]./]
        if sign != nil and sign.include?('$')
          cw = bitmap.width / 3
          ch = bitmap.height / 4
        else
          cw = bitmap.width / 12
          ch = bitmap.height / 8
        end
        n = actor.character_index
        src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
        text_width_w = self.contents.text_size(PARTY_WORD[item == 0 ? 0 : 1]).width
        self.contents.blt(616 - 32 - text_width_w, y, bitmap, src_rect)
        self.contents.draw_text_full(x, y, 616, 32, PARTY_WORD[item == 0 ? 0 : 1],2)
      else
        text_width_w = self.contents.text_size(GAIN_OR_LOST[item == 5 ? 0 : 1]).width
        self.contents.draw_text_full(-text_width - 38, y, 616, 32, GAIN_OR_LOST[item == 5 ? 0 : 1],2)
      end
    end
  end
  def update
    if $game_temp.pop_ref; Audio.se_play("Audio/SE/" + POP_UP_SOUND[$game_temp.sfx_pop], VOLUME_PU, PITC_PU); $game_temp.pop_ref = false
      return true
    end
    if $game_temp.pop != nil; (0...$game_temp.pop.size).each {|i|
      if $game_temp.pop.values[i].to_a[1] > 0; $game_temp.pop.values[i].to_a[1] -= 1
      elsif $game_temp.pop.values[i].to_a[1] <= 0; $game_temp.pop.shift[i]
        return true
      end}
    end
    return false
  end
end
class Scene_Map
  alias lcg_popup_main main
  def main
    @popup = Window_Popup.new
    lcg_popup_main
    @popup.dispose if @popup != nil
  end
  alias lcg_popup_updt update
  def update
    @popup = Window_Popup.new if @popup == nil
    if @popup != nil && !$game_switches[LCG::SWITCH_POPUP]
      if @popup.update; @popup.refresh
      end
    end
    lcg_popup_updt
  end
end
$lcg_popup_message = true


Credits


  • Lukas, Original Author
  • WhiteHopper/DrDhoom


 

[VX/VXA]Pop-up Message

Topik sebelumnya Topik selanjutnya Kembali Ke Atas 
Halaman 1 dari 1

Permissions in this forum:Anda tidak dapat menjawab topik
RPGMakerID :: Scripts & Event Systems :: RMVX Scripts-