Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # MOLEGATO FUNCTIONS
- # Author Molegato
- # Version 1.1
- #------------------------------------------------------------------------------
- # Several methods that I use in my scripts.
- #------------------------------------------------------------------------------
- # Included in some of my scripts. May be needed for those that dont include it
- # in order to make them work.
- #==============================================================================
- #==============================================================================
- # MOLEGATO GAME_EVENT
- #------------------------------------------------------------------------------
- # Several methods for Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- def note
- string_note=""
- return "" if not list
- for i in 0..list.size-1
- if list[i] and list[i].code==108
- string_note += list[i].parameters[0]
- end
- end
- return string_note
- end
- end
- #==============================================================================
- # MOLEGATO BattleManager
- #------------------------------------------------------------------------------
- # Several methods for BattleManager
- #==============================================================================
- module BattleManager
- def self.action_battlers
- return @action_battlers
- end
- def self.delete_battler_from_turn(battler)
- @action_battlers.delete(battler)
- end
- end
- #==============================================================================
- # MOLEGATO WINDOW BASE
- #------------------------------------------------------------------------------
- # Several methods for window_base
- #==============================================================================
- class Window_Base < Window
- def draw_face_scaled(face_name, face_index, x, y, scale,enabled = true)
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
- rect2 = Rect.new(x,y, 96*scale, 96*scale)
- contents.stretch_blt(rect2, bitmap, rect,enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- def draw_actor_face_scaled(actor, x, y, scale, enabled = true)
- draw_face_scaled(actor.face_name, actor.face_index, x, y, scale, enabled)
- end
- def draw_system(name, x, y)
- bitmap = Cache.system(name)
- rect = Rect.new(0, 0, bitmap.width, bitmap.width)
- contents.blt(x, y, bitmap, rect, 255)
- end
- def instant_close
- @openness=0
- @closing=false
- @opening=false
- end
- def instant_open
- @openness=255
- @closing=false
- @opening=false
- end
- end
- #==============================================================================
- # MOLEGATO TAG METHODS
- #------------------------------------------------------------------------------
- # Several methods for using tags. Needed by some of my scripts.
- #==============================================================================
- module MOLEGATO_TAG_METHODS
- def has_tag?(tag)
- if self.note[/<#{tag}>/mi]
- return true
- else
- return false
- end
- end
- def tag_check_value(tag)
- if self.note[/<#{tag}: (.*?)>/mi]
- return $1
- else
- return false
- end
- end
- def tag_check_multivalues(tag)
- if self.note[/<#{tag}: (.*?)>/mi]
- return $1.split(',')
- else
- return false
- end
- end
- def tag_check_multivalues(string, tag)
- if string[/<#{tag}: (.*?)>/mi]
- return $1.split(',')
- else
- return false
- end
- end
- def tag_get_block(tag)
- if self.note[/<#{tag}>(.*?)<\\#{tag}>/mi]
- return $1
- else
- return false
- end
- end
- def tag_multiple(tag)
- if tag_get_block(tag)
- var=tag_get_block(tag)
- return var.split(';')
- else
- return false
- end
- end
- def tag_check_multiple_multivalues(tag)
- if tag_multiple(tag)
- array=[]
- tag_multiple(tag).each do |each|
- array.push(tag_check_multivalues(each,tag))
- end
- return array
- else
- return false
- end
- end
- end
- #---For items/skills/actors/etc
- class RPG::BaseItem
- include MOLEGATO_TAG_METHODS
- end
- #---for maps
- class RPG::Map
- include MOLEGATO_TAG_METHODS
- end
- #---for events
- class Game_Event < Game_Character
- include MOLEGATO_TAG_METHODS
- end
Advertisement
Add Comment
Please, Sign In to add comment