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 | 
 

 [RGSS3] Kuro Any Bar

Topik sebelumnya Topik selanjutnya Go down 
[RGSS3] Kuro Any Bar Empty2014-09-04, 10:48
Post[RGSS3] Kuro Any Bar
#1
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
Kuro Any Bar
V2.1
Tipe: Eventer Tool


Pengenalan
Semenjak AES yang ku buat cenderung butuh bar, sekalian aja buat ini.


Fitur

  • Custom bar multifungsi nan animatif.
  • Bisa dipanggil sebanyak mungkin.
  • Nilai variable manapun bisa masuk.
  • Align kanan? tengah? atau vertikal sekalian? Bisa2~
  • Termasuk custom text.
  • Menganut prinsip CRUDE (Create, Update, Delete).
  • Bisa menggunakan picture sebagai bar.



Screenshots
[RGSS3] Kuro Any Bar Kuro%20Any%20Bar


Demo
https://db.tt/CwRDmzxo V2.1


scripts
Code:
=begin
================================================================================
                              KURO ANY BAR V2.0
================================================================================
  Introduction :
  A multi simple active bar for any kind of use.
  From now will be used to support my advanced event system.
================================================================================
  Changelog :
  V.2.1 (10-12-2014)
  * More property : skinpic.
  * Kini hanya menerima nilai dari game variable.
  * Fixed, value yang nembus nilai max atau kurang dari 0.
  * Fixed, flip picture.
  * Fixed, ukuran dan posisi text.
  * Rapihin.
  V.2.0 (06-09-2014)
  * Method baru : Kuro::Bar.update
  * More property : picture, gradien, etc.
  * Gauge animatif.
  * New interface : rombak habis-habisan.
  V.1.0 (03-09-2014)
  * Awal pembuatan, dan selesainya script.
================================================================================
  Current feature :
  * Multi simple custom bar.
  * Come with custom text.
  * Could be aligned.
  * Vertical? no prob~
  * Can use picture as the bar.
================================================================================
  How to use :
  Konfigurasi bar nya berada di module sesuai dengan format yang tertera.
  Jadi tinggal siap panggil di mana saja melalui event dengan script call.
 
  Kuro::Bar.create(ID)          <<< buat bar
  Kuro::Bar.update(ID,KEY,VALUE) <<< edit property bar
  Kuro::Bar.delete(ID)          <<< hapus bar

  ID    = adalah nomor id preset yang anda buat (0 = default preset)
  KEY  = nama property daripada bar di preset anda (:x, :y, :width)
  VALUE = nilai baru untuk property preset anda.
================================================================================
=end
module Kuro
  module Bar
#===============================================================================
# CONFIGURATION START
#===============================================================================

# COLOR PALLETTE
# ==============================================================================
  # Palet warna. Silahkan saja kalo mau membuat warna anda sendiri.
  # WARNA  = Color.new(red, green, blue)
    BLACK  = Color.new(0,0,0)
    WHITE  = Color.new(255,255,255)
    RED    = Color.new(255,0,0)
    GREEN  = Color.new(0,255,0)
    BLUE    = Color.new(0,0,255)
    YELLOW  = Color.new(255,255,0)
    CYAN    = Color.new(0,255,255)
    MAGENTA = Color.new(255,0,255)
  # Palet warna untuk gradient. Gabung-gabungkan saja palet warna di atas.
  # HANYA 2 WARNA !
  # GRADIEN    = [WARNA 1, WARNA 2]
    GREENBLACK = [GREEN,BLACK]
    BLUEBLACK  = [BLUE,BLACK]
    REDBLACK  = [RED,BLACK]

# BAR DEFAULT VALUE
# ==============================================================================
    PRESET = [{ # Default setting
  # Setting default nya (PRESET[0]).
  # Kalo ada property yang gak ada di preset yang anda buat, bakal pake value
  # dari property yang ada di sini.
      :x        => 0,      # X coordinate
      :y        => 0,      # Y coordinate
      :z        => 50,      # Z coordinate
      :width    => 100,    # Bar width
      :height  => 10,      # Bar height
      :color    => WHITE,  # Bar color
      :opaback  => 255,    # Back skin opacity (0~255)
      :picture  => nil,    # Use picture as bar (in folder system)
      :skinpic  => nil,    # Use picture as bar foreskin (in folder system)
      :flip    => false,  # Flip the bar?
      :text    => nil,    # Text (\\b = base value, \\m = max value)
      :align    => 0,      # Bar align (0 = left, 1 = mid, 2 = right)
      :base    => 1,      # Variable ID as base value (use "" for eval script)
      :max      => "100",  # Variable ID as max value (use "" for eval script)
      :vertical => false    # Was it vertical?
    }]
  # Kecepatan animasi bar. Semakin gede, semakin cepat.
    BOOST = 3

# BAR PRESET
#===============================================================================
  # Mulai buat preset anda sendiri dari sini. Berantakan gak masalah selama
  # nama key nya bener. Ingat, jangan lupa naruh tanda koma!
    PRESET[1] = { # Actor 1 HP
      :base    => "$game_actors[1].hp",
      :max      => "$game_actors[1].mhp",
      :text    => "[\\b/\\m]",
      :color    => GREENBLACK,
      :width    => 120,
      :height  => 12,
      :skinpic  => "barskin",
    }
    PRESET[2] = { # Actor 1 MP
      :y        => 12,
      :width    => 120,
      :height  => 12,
      :color    => BLUEBLACK,
      :base    => "$game_actors[1].mp",
      :max      => "$game_actors[1].mmp",
      :text    => "[\\b/\\m]",
      :skinpic  => "barskin",
    }
    PRESET[3] = { # Quest : Kill Rat
      :x        => 16,
      :y        => 380,
      :width    => 512,
      :height  => 24,
      :color    => REDBLACK,
      :opaback  => 128,
      :base    => 1,
      :max      => "10",
      :text    => "kill rat (\\b/\\m)",
    }
    PRESET[4] = { # Mashing Button !!!
      :x        => 192,
      :y        => 240,
      :picture  => "screwthis",
      :opaback  => 200,
      :base    => 2,
      :max      => "100",
      :align    => 1,
    }
    PRESET[5] = { # Hit me!
      :x        => 364,
      :width    => 180,
      :height  => 24,
      :base    => 3,
      :max      => "30",
      :text    => "[\\b/\\m]",
      :align    => 2,
    }
#===============================================================================
# CONFIGURATION END
#===============================================================================
   
    def self.create(id)
      $kab[id] = AnyBar.new(id)
    end
    def self.update(id,key,value)
      return if PRESET[id][key] == value
      PRESET[id][key] = value
      if $kab[id] != nil
        $kab[id].load
      end
    end
    def self.delete(id)
      if $kab[id] != nil
        $kab[id].dispose
        $kab[id] = nil
      end
    end
  end
end

class AnyBar
  def initialize(id)
    @id = id
    load
  end
  def load
    d = Kuro::Bar::PRESET[0]
    v = Kuro::Bar::PRESET[@id]
    a = d.keys
    k = []
    for i in 0...a.size
      if v.include?(a[i])
        k[i] = v[a[i]]
      else
        k[i] = d[a[i]]
      end
    end
    @x = k[0]
    @y = k[1]
    @z = k[2]
    @w = k[3]
    @h = k[4]
    @c = k[5]
    @o = k[6]
    @p = k[7]
    @s = k[8]
    @f = k[9]
    @t = k[10]
    @a = k[11]
    @n = k[12]
    if k[13].is_a? Fixnum
      @m = [$game_variables[k[13]],1].max
    else
      @m = [eval(k[13]),1].max
    end
    @v = k[14]
    refresh
    create
  end
  def refresh
    @back.bitmap.dispose unless @back==nil
    @bar.bitmap.dispose unless @bar==nil
    @skin.bitmap.dispose unless @skin==nil
    @text.bitmap.dispose unless @text==nil
  end
  def create
    create_back if @o > 0
    create_bar
    create_skin if @s != nil
    create_text if @t != nil
    update
  end
  def create_back
    @back = Sprite.new
    if @p != nil
      @back.bitmap = Cache.system(@p)
      @back.tone = Tone.new(-255,-255,-255)
      @back.mirror = @f
    else
      @back.bitmap = Bitmap.new(@w,@h)
      @back.bitmap.fill_rect(0,0,@w,@h,Color.new(0,0,0,@o))
    end
    @back.x = @x
    @back.y = @y
    @back.z = @z
  end
  def create_bar
    @bar = Sprite.new
    if @p != nil
      @bar.bitmap = Cache.system(@p)
      @w = @bar.bitmap.width
      @h = @bar.bitmap.height
      @bar.mirror = @f
    else
      @bar.bitmap = Bitmap.new(@w,@h)
      if @c.is_a? Array
        @bar.bitmap.gradient_fill_rect(0,0,@w,@h,@c[0],@c[1],@v)
      else
        @bar.bitmap.fill_rect(0,0,@w,@h,@c)
      end
    end
    @bar.x = @x
    @bar.y = @y
    @bar.z = @z+1
    getvar
    if @v
      @bar.src_rect.height = @b*@h/@m
      @bar.src_rect.y = (@h-@bar.height)/2 if @a==1
      @bar.src_rect.y = (@h-@bar.height) if @a==2
      @bar.y = @y+(@h-@bar.height)/2 if @a==1
      @bar.y = @y+(@h-@bar.height) if @a==2
    else
      @bar.src_rect.width = @b*@w/@m
      @bar.src_rect.x = (@w-@bar.width)/2 if @a==1
      @bar.src_rect.x = (@w-@bar.width) if @a==2
      @bar.x = @x+(@w-@bar.width)/2 if @a==1
      @bar.x = @x+(@w-@bar.width) if @a==2
    end
  end
  def create_skin
    @skin = Sprite.new
    @skin.bitmap = Cache.system(@s)
    @skin.mirror = @f
    @skin.x = @x
    @skin.y = @y
    @skin.z = @z+2
  end
  def create_text
    @text = Sprite.new
    @text.bitmap = Bitmap.new([@w,@h].max,20)
    @text.bitmap.font.size = [@h,16].max
    @text.x = @x
    @text.x -= @text.width/2 if @v
    @text.y = @y
    @text.z = @z+3
  end
  def getvar
    if @n.is_a? Fixnum
      $game_variables[@n] = [[$game_variables[@n],0].max,@m].min
      @b = $game_variables[@n]
    else
      @b = eval(@n)
    end
  end
  def update
    update_back if @back != nil
    update_bar
    update_text if @text != nil
    update_skin if @skin != nil
  end
  def update_back
    @back.update
  end
  def update_bar
    getvar
    htarget = @b*@h/@m
    wtarget = @b*@w/@m
    boost = Kuro::Bar::BOOST
    return if @bar.height==htarget.round and @bar.width==wtarget.round
    if @v
      if @bar.height>htarget.round
        @bar.src_rect.height = [@bar.src_rect.height-boost,htarget.round].max
      else
        @bar.src_rect.height = [@bar.src_rect.height+boost,htarget.round].min
      end
      @bar.src_rect.y = (@h-@bar.height)/2 if @a==1
      @bar.src_rect.y = (@h-@bar.height) if @a==2
      @bar.y = @y+(@h-@bar.height)/2 if @a==1
      @bar.y = @y+(@h-@bar.height) if @a==2
    else
      if @bar.width>wtarget.round
        @bar.src_rect.width = [@bar.src_rect.width-boost,wtarget.round].max
      else
        @bar.src_rect.width = [@bar.src_rect.width+boost,wtarget.round].min
      end
      @bar.src_rect.x = (@w-@bar.width)/2 if @a==1
      @bar.src_rect.x = (@w-@bar.width) if @a==2
      @bar.x = @x+(@w-@bar.width)/2 if @a==1
      @bar.x = @x+(@w-@bar.width) if @a==2
    end
  end
  def update_skin
    @skin.update
  end
  def update_text
    @text.bitmap.clear
    if @v
      @text.bitmap.draw_text(0,0,@h,@w,convert(@t),1)
      @text.angle=-90
    else
      @text.bitmap.draw_text(0,0,@w,@h,convert(@t),1)
    end
  end
  def convert(text)
    text = text.gsub(/\\b/){@b.to_s}
    text = text.gsub(/\\m/){@m.to_s}
    return text
  end
  def dispose
    @back.dispose if @back != nil
    @bar.dispose
    @text.dispose if @text != nil
    @skin.dispose if @skin != nil
  end
end
class Scene_Map < Scene_Base
  alias kab_potato update
  def update
    kab_potato
    $kab = [] if $kab == nil
    for i in 0...$kab.length
      $kab[i].update unless $kab[i] == nil
    end
  end
end



How to use?
Konfigurasi preset ada di dalam module.
Kemudian melalui script call di event :
Kuro::Bar.create(ID) buat bar sesuai preset ID.
Kuro::Bar.update(ID,KEY,VALUE) edit VALUE dari KEY dalam preset ID.
Kuro::Bar.delete(ID) hapus bar preset ID.
Untuk lebih jelasnya lihat di demo.



Credits
Kuro Creator


Terakhir diubah oleh Kuro Ethernite tanggal 2014-12-10, 20:07, total 2 kali diubah
[RGSS3] Kuro Any Bar Empty2014-09-06, 17:38
PostRe: [RGSS3] Kuro Any Bar
#2
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
Ah... hahahaha~
You guys just don't realize its power, eh?

Ini punya banyak potensial, so I do an update ~ :v
  • Rombak ulang dan langsung menjajaki V2.0 !!!!
  • Gauge bar yang animatif.
  • Gradien dan picture included.
  • New method. Just check it out~
[RGSS3] Kuro Any Bar Empty2014-09-06, 18:01
PostRe: [RGSS3] Kuro Any Bar
#3
rizkyffq 
Newbie
Newbie
rizkyffq

Level 5
Posts : 60
Thanked : 2
Engine : RMVX Ace
Skill : Beginner
Type : Writer

[RGSS3] Kuro Any Bar Vide
Wah menarik, mungkin nanti saya make punya abang ini di game project saya hehe, pasti seru nanti,  btw bang game saya udah rilis demo nya mungkin abang bisa bantu jadi tester dan korektornya hehe (modus ini hehehe)
[RGSS3] Kuro Any Bar Empty2014-12-10, 20:18
PostRe: [RGSS3] Kuro Any Bar
#4
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
Apdet ~
  • Added : Color pallette untuk memudahkan nerapin warna dan gradien doank.
  • Added : skinpic. Kini udah bisa pasang fore skin.
  • Fixed : Game Variable yang dipake sebagai base value kini nilainya gak bisa kurang dari 0, atau lebih besar dari max value.
  • Fixed : Flip picture udah diterapin. Sebelumnya lupa dipajang.
[RGSS3] Kuro Any Bar Empty2014-12-11, 06:46
PostRe: [RGSS3] Kuro Any Bar
#5
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
Nice :thumbup: .
Btw, ane dapet error "cant convert nilclass to color", apa ada kemungkinan gak compatible ama script lain? :hammer:


==========EDIT===========
no problem. masalah di atas fix (ngopy script dari sumber langsung work :- )
Dapet probllem baru : Kalo width > height langsung dapet error "Bad value for size" :herp:
[RGSS3] Kuro Any Bar Empty2014-12-16, 19:51
PostRe: [RGSS3] Kuro Any Bar
#6
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
Hmm, nggak... rata2 skrip ku mah stand alone.
kalo error nya demikian berarti masalahnya ketika nerapin palet warna nya itu.
[RGSS3] Kuro Any Bar Empty2014-12-17, 09:24
PostRe: [RGSS3] Kuro Any Bar
#7
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
Ok :3
kalo yang problem bad value for size? :>
[RGSS3] Kuro Any Bar Empty2014-12-19, 22:26
PostRe: [RGSS3] Kuro Any Bar
#8
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
....
pastikan value yang dimasukkan itu sesuai format dan nggak ngaco...?
[RGSS3] Kuro Any Bar Empty2014-12-21, 17:18
PostRe: [RGSS3] Kuro Any Bar
#9
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
gak ngaco? :>
Ane mau pake bar versi vertikal, gambar barnya tetep landscape. Jadi ane ganti valuenya biar kayak vertikal (width < heigth) :herp:
[RGSS3] Kuro Any Bar Empty2014-12-23, 23:22
PostRe: [RGSS3] Kuro Any Bar
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
maksudnya ngaco seperti anda mencoba membuat bar yang panjang dan lebar nya 1 pixel, atau panjang dan lebar nya lebih dari 500 pixel, atau ngawur nyoba bikin dimensi nya negatif. nah itu ngaco.

mau ngebuat bar vertikal, pake gambar?
kalo :picture diberi value, :width dan height gak ada guna nya karena bakal menggunakan dimensi gambar tersebut. Jadi gambar yang dipake musti dari sananya kudu vertikal.
[RGSS3] Kuro Any Bar Empty2014-12-25, 15:43
PostRe: [RGSS3] Kuro Any Bar
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
ane gak pake pic, pake bar buatan yang biasa. :>
[RGSS3] Kuro Any Bar Empty2014-12-26, 23:27
PostRe: [RGSS3] Kuro Any Bar
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
ku coba beragam variasi gak ada masalah... :swt:
bisa lebih perjelas lagi masalahnya seperti apa?
[RGSS3] Kuro Any Bar Empty2014-12-27, 06:00
PostRe: [RGSS3] Kuro Any Bar
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
ane kasih ss aja ya :>

Spoiler:

ini projek kosongan
[RGSS3] Kuro Any Bar Empty2014-12-27, 21:13
PostRe: [RGSS3] Kuro Any Bar
Kuro Ethernite 
The Creator
Kuro Ethernite

Level 5
Posts : 1631
Thanked : 24
Engine : RMVX Ace
Skill : Masterful
Type : Jack of All Trades
Awards:

[RGSS3] Kuro Any Bar Vide
satu2 nya yang ganjil ku lihat di situ, kalo gak pake skinpic jangan ditulisin sama sekali lah... :swt:
cukup hapus line itu aja.
[RGSS3] Kuro Any Bar Empty2014-12-29, 04:32
PostRe: [RGSS3] Kuro Any Bar
shunpeicloser 
Newbie
Newbie
shunpeicloser

Level 5
Posts : 31
Thanked : 0
Engine : RMVX Ace
Skill : Very Beginner
Type : Event Designer
Awards:
[RGSS3] Kuro Any Bar Vide
masih gak bisa
yang ane pingin barnya kayak yang merah ini.
Spoiler:


ane download demonya, trus ane ganti vertical ke true kasusnya juga sama.
[RGSS3] Kuro Any Bar Empty
PostRe: [RGSS3] Kuro Any Bar
Sponsored content 




[RGSS3] Kuro Any Bar Vide
 

[RGSS3] Kuro Any Bar

Topik sebelumnya Topik selanjutnya Kembali Ke Atas 

Similar topics

+
Halaman 1 dari 1

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