Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # CAHML Sprite (Walking) in Window Status
- #===============================================================================
- # Author : Cahml
- # Version : V.1.0
- # Engine : RMVX Ace
- #===============================================================================
- # Cara Pemakaian
- #-------------------------------------------------------------------------------
- # Taruh script ini di atas Main Process dan di bawah script apapun pada
- # Script Editor.
- # jangan lupa harus pkek Srpite 1 set...
- # jangan yang 8 set
- #===============================================================================
- # Credits Me CAHML :)
- #===============================================================================
- # Script ini Adalah Script untuk ada Sprite Character yang berjalan Di Face klo buka di Window Status
- #-------------------------------------------------------------------------------
- # mungkin bisa sedikit membantu bwt yg newbie dan Diatas Newbie :3
- #===============================================================================
- module CAHML
- #===============================================================================
- #ini adalah Jika kamu Mau Nge Set atau Nge - Custom Srptite dari karakter kamu
- # misal sprite kamu Kaduki.... kamu bisa nge set "_1" , "_2" , "_3" DLL
- # klo gamau nge set kosongin aja :)
- #===============================================================================
- SPRITE_ADJUST = ""
- #===============================================================================
- #berapa Frame dngan Sprite berjalannya??? Step baru itu 1 Detik yang setara 60 Frame.
- #===============================================================================
- SPRITE_WALK = 15
- #===============================================================================
- # Mau Sprite nya Random????
- #===============================================================================
- SPRITE_RANDOM_DIR = true
- #===============================================================================
- #berapa jumlah step klo mau ganti direction???
- #===============================================================================
- SPRITE_RANDOM_DIR_COUNT = 5
- #===============================================================================
- #memulai direction dari arah mana???
- #0 = Bawah
- #1 = kiri
- #2 = kanan
- #3 = atas
- #===============================================================================
- SPRITE_DIR_START = 0
- #===============================================================================
- # Set Sprite nya di Face Window Status
- #===============================================================================
- SPRITE_X = 90
- SPRITE_Y = 112
- SHOW_AT_STATUS = true
- end
- include CAHML
- def update
- super
- @counter += 1
- if @counter == SPRITE_WALK
- @counter = 0
- refresh2
- end
- end
- def refresh2
- if @anim_index == 0
- @anim_index = 1
- @flip = false
- elsif @anim_index == 1
- if @flip == false
- @anim_index = 2
- else
- @anim_index = 0
- end
- elsif @anim_index == 2
- @anim_index = 1
- @flip = true
- end
- if SPRITE_RANDOM_DIR
- @count += 1
- if @count == SPRITE_RANDOM_DIR_COUNT
- @count = 0
- for i in $game_party.members
- @step[i.id] = rand(4)
- end
- end
- end
- refresh
- for actor in $game_party.members
- draw_actor_graphic_extreme(actor, SPRITE_X, actor.index * 96 + SPRITE_Y, @anim_index, @step[actor.id])
- end
- end
- class Window_Status < Window_Selectable
- alias define initialize
- def initialize(actor)
- @refreshed = false
- @anim_index = 0 if @anim_index == nil
- @flip = false
- @count = 1
- @counter = 0
- @step = SPRITE_DIR_START
- define(actor)
- end
- def update
- super
- @counter += 1
- if @counter == SPRITE_WALK
- @counter = 0
- refresh2
- end
- end
- alias sprite_draw refresh
- def refresh
- sprite_draw
- draw_actor_graphic_extreme(@actor, 8 + SPRITE_X, 32 + SPRITE_Y, @anim_index, @step) unless @refreshed or !SHOW_AT_STATUS
- @refreshed = true
- end
- def refresh2
- if @anim_index == 0
- @anim_index = 1
- @flip = false
- elsif @anim_index == 1
- if @flip == false
- @anim_index = 2
- else
- @anim_index = 0
- end
- elsif @anim_index == 2
- @anim_index = 1
- @flip = true
- end
- if SPRITE_RANDOM_DIR
- @count += 1
- if @count == SPRITE_RANDOM_DIR_COUNT
- @count = 0
- @step = rand(4)
- end
- end
- refresh if SHOW_AT_STATUS
- draw_actor_graphic_extreme(@actor, 6 + SPRITE_X, 32 + SPRITE_Y, @anim_index, @step) if SHOW_AT_STATUS
- end
- end
- class Window_Base < Window
- def draw_actor_graphic_extreme(actor, x, y, anim, step)
- draw_character_extreme(actor.character_name, actor.character_index, x, y, anim,step)
- end
- def draw_character_extreme(character_name, character_index, x, y,anim,step)
- return if character_name == nil
- bitmap = Cache.character(character_name+SPRITE_ADJUST)
- sign = 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 = character_index
- a = anim
- b = step
- src_rect = Rect.new((n%4*3+a)*cw, (n/4*4+b)*ch, cw, ch) unless b == nil
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) unless b == nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement