Já viram qual a arte dessa semana?Exposição dos Artistas #8
8 Respostas   1014 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
#----------------------------------# Autor: lb_guilherme#----------------------------------# ReinoRPG.com#----------------------------------#Apenas insira na área de scripts adicionais#----------------------------------class Scene_Map < Scene_Base def update_transfer_player return unless $game_player.transfer? Graphics.freeze @spriteset.dispose $game_player.perform_transfer $game_map.autoplay $game_map.update @spriteset = Spriteset_Map.new Graphics.transition (80) Input.update endend
=begin#============================================================================== Title: Event Trigger Labels Author: Hime Date: Jan 30, 2014------------------------------------------------------------------------------ ** Change log Jan 30, 2014 -refactored code -added compatibility with instance items Dec 27, 2013 -optimized performance by not clearing out the key item variable on update Nov 19, 2013 -fixed bug where stepping on event with no active page crashed the game Sep 26, 2013 -added support for "player touch" trigger label Sep 6, 2013 -fixed bug where trigger labels as the first command doesn't register properly Mar 22, 2013 -fixed bug where you can still trigger events after they have been erased Dec 5, 2012 -fixed issue where event was checked before page was setup Oct 20, 2012 -fixed issue where using key item in succession crashes game -added support for key item triggers Aug 22, 2012 -Support input names greater than one character (eg: F5 vs C) Aug 18, 2012 -fixed label parsing to store all buttons Jun 13, 2012 -initial release------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Credits to Hime Works in your project * Preserve this header------------------------------------------------------------------------------ ** Description: This script allows developers to start their events by using more than just the default 'C' button, and will jump to the correct place in the event when the appropriate button is pressed. You can create custom "action trigger labels", which are labels that have special conditions assigned to them. When the condition is met, the event will run, automatically jumping to the specific label whose condition was met. If an event has a trigger label, then the default 'C' button will not activate the event unless you define a trigger label to check the 'C' button. ------------------------------------------------------------------------------ ** Installation Place this script below Materials and above Main ------------------------------------------------------------------------------ ** Usage -- Button Labels -- To choose where to start processing if the 'A' input is triggered, have a 'Label' command at that position, with the 'Label Name' button?(:A) Repeat for the other input buttons. If you don't want to use "button?" you may change the label text in the configuration below. -- Key Item Labels -- To use key item labels, create a label with the name keyitem?(x) Where x is the ID of the key item that should trigger this event. As above, you may change the name of the label in the configuration. To use a key item trigger in-game, press the key item selection button (default keyboard A) to show the item selection window. When you select a particular key item, it may trigger the event. You may use the event command "select key item" to force a user to select a key item, but you must use the specific "key item variable" which is specified in the configuration options. Key items can be set to be consumed whenever they are used, regardless of whether they actually trigger something or not. Tag the items with <key_consume> -- Trigger Labels -- Two special labels are available for events triggered by touch. trigger?(:player_touch) - triggered when the player touches an event trigger?(:event_touch) - triggered when an event touches the player Note that the event_touch label only works if the event trigger is "event touch", however "player touch" label works for both player touch and event touch. #===============================================================================end$imported = {} if $imported.nil?$imported["Tsuki_TriggerLabels"] = true#==============================================================================# ** Configuration#==============================================================================module Tsuki module Trigger_Labels # this is what you need to type for all your labels if you want to use # the input branching Button_Format = "button?" Key_Item_Format = "keyitem?" Trigger_Format = "trigger?" Enable_Key_Item_Trigger = true # set to false if you don't want this Key_Item_Variable = 1242 # just a random variable... Key_Item_Button = :Y # Which button to press to open key item selection window #==============================================================================# ** Rest of the script#============================================================================== Button_Regex = /#{Regexp.escape(Button_Format)}\(\:(.*)\)/ Key_Item_Regex = /#{Regexp.escape(Key_Item_Format)}\((\d+)\)/i Trigger_Regex = /#{Regexp.escape(Trigger_Format)}\((.+)\)/i Consumable_Regex = /<key_consume>/i endendmodule RPG class Item def key_use_consumable? return @key_use_consume unless @key_use_consume.nil? res = Tsuki::Trigger_Labels::Consumable_Regex.match(self.note) return @key_use_consume = !res.nil? end endendclass Game_Player < Game_Character #----------------------------------------------------------------------------- # Alias. Try to avoid hardcoding it #----------------------------------------------------------------------------- alias :th_trigger_labels_nonmoving :update_nonmoving def update_nonmoving(last_moving) return if $game_map.interpreter.running? if trigger_conditions_met? pre_trigger_event_processing check_event_trigger post_trigger_event_processing end th_trigger_labels_nonmoving(last_moving) end def trigger_conditions_met? movable? end #----------------------------------------------------------------------------- # New. Check for any valid events in the area #----------------------------------------------------------------------------- def check_event_trigger for x, y in positions_to_check_for_event for event in $game_map.events_xy(x, y) return unless event.page check_button_trigger(event) check_key_item_trigger(event) end end end def pre_trigger_event_processing show_key_item_selection if Tsuki::Trigger_Labels::Enable_Key_Item_Trigger && Input.trigger?(Tsuki::Trigger_Labels::Key_Item_Button) end #----------------------------------------------------------------------------- # New. Clean up #----------------------------------------------------------------------------- def post_trigger_event_processing item = $data_items[key_item_variable] $game_party.lose_item(item, 1) if item && item.key_use_consumable? $game_variables[Tsuki::Trigger_Labels::Key_Item_Variable] = 0 end #----------------------------------------------------------------------------- # New. Positions to check events #----------------------------------------------------------------------------- def positions_to_check_for_event positions = [[@x, @y]] x2 = $game_map.round_x_with_direction(@x, @direction) y2 = $game_map.round_y_with_direction(@y, @direction) positions << [x2, y2] return positions unless $game_map.counter?(x2, y2) x3 = $game_map.round_x_with_direction(x2, @direction) y3 = $game_map.round_y_with_direction(y2, @direction) positions << [x3, y3] return positions end #----------------------------------------------------------------------------- # New. Check whether the button triggers the event #----------------------------------------------------------------------------- def check_button_trigger(event) return unless button_trigger_met?(event) for button in event.button_labels if Input.trigger?(button.to_sym) # Reset the commands (Since we insert a jump command TO-CHANGE) event.list = event.page.list.clone # If the event can run, insert a jump to label command at # the beginning before running it if check_action_event text = ["#{Tsuki::Trigger_Labels::Button_Format}(:#{button})"] command = RPG::EventCommand.new(119, 0, text) event.list.insert(0, command) return end end end end def button_trigger_met?(event) return false if event.button_labels.empty? return false if event.erased return true end #----------------------------------------------------------------------------- # New. Check whether the selected key item triggers the event #----------------------------------------------------------------------------- def check_key_item_trigger(event) return unless key_item_trigger_met?(event) if key_item = event.key_item_labels[key_item_variable] event.list = event.page.list.clone if check_action_event text = ["#{Tsuki::Trigger_Labels::Key_Item_Format}(#{key_item_variable})"] command = RPG::EventCommand.new(119, 0, text) event.list.insert(0, command) end end end def key_item_trigger_met?(event) return false unless Tsuki::Trigger_Labels::Enable_Key_Item_Trigger return false if event.key_item_labels.empty? return false if key_item_variable == 0 || event.page.nil? return true end def key_item_variable $game_variables[Tsuki::Trigger_Labels::Key_Item_Variable] end # show key item selection def show_key_item_selection $game_message.item_choice_variable_id = Tsuki::Trigger_Labels::Key_Item_Variable endendclass Game_Event attr_reader :button_labels attr_reader :key_item_labels attr_reader :trigger_labels attr_reader :page attr_reader :erased attr_accessor :list def button_labels return @button_labels ||= [] end def key_item_labels return @key_item_labels ||= {} end alias :nr_eventLabels_setup_page_settings :setup_page_settings unless $@ def setup_page_settings(*args) # Run the original setup_page_settings nr_eventLabels_setup_page_settings(*args) # Store extra triggers @button_labels = [] @key_item_labels = {} @trigger_labels = [] # Where to insert "null" commands nulls = [] # If the event doesn't begin automatically if @trigger < 3 @list.each_with_index do |command, i| if command.code == 118 label = command.parameters[0] # Check for extra buttons button = label.match(Tsuki::Trigger_Labels::Button_Regex) if button @button_labels << button[1] nulls << i end # Check for key item triggers keyitem = label.match(Tsuki::Trigger_Labels::Key_Item_Regex) if keyitem @key_item_labels[keyitem[1].to_i] = true nulls << i end # Check for event trigger types trigger = label.match(Tsuki::Trigger_Labels::Trigger_Regex) if trigger @trigger_labels << trigger nulls << i end end end end # insert "exit event processing" before each "event branch" nulls.reverse.each {|index| @list.insert(index, RPG::EventCommand.new(115)) } endend#==============================================================================# Trigger label add-on. Allows you to define player_touch and event_touch# labels.#==============================================================================class Game_Player < Game_Character #----------------------------------------------------------------------------- # Overwrite. #----------------------------------------------------------------------------- alias :th_trigger_labels_start_map_event :start_map_event def start_map_event(x, y, triggers, normal) return if $game_map.interpreter.running? $game_map.events_xy(x, y).each do |event| if event.trigger_in?(triggers) && event.normal_priority? == normal event.list = event.page.list.clone text = ["#{Tsuki::Trigger_Labels::Trigger_Format}(:player_touch)"] command = RPG::EventCommand.new(119, 0, text) event.list.insert(0, command) event.start end end endendclass Game_Event < Game_Character def check_event_trigger_touch(x, y) return if $game_map.interpreter.running? if @trigger == 2 && $game_player.pos?(x, y) if !jumping? && normal_priority? @list = @page.list.clone text = ["#{Tsuki::Trigger_Labels::Trigger_Format}(:event_touch)"] command = RPG::EventCommand.new(119, 0, text) @list.insert(0, command) start end end endend#===============================================================================# Instance Items patch#===============================================================================if $imported["TH_InstanceItems"] class Window_KeyItem def on_ok result = item ? item.template_id : 0 $game_variables[$game_message.item_choice_variable_id] = result close end endend
#==============================================================================# ** Evento Mostrar Texto#==============================================================================# Criado por: Áص¹# Modificado, Adaptado e Melhorado por: Nietore# Traduzido por: Nietore# Acesse: Www.AldeiaRpgBr.Com#==============================================================================# * Instruções## - Criando evento para mostrar nome# - Crie um comentário com:# [Nome= Nome Aqui]#------------------------------------------------------------------------------#==============================================================================#==============================================================================# ** Game_Character#==============================================================================class Game_Character#--------------------------------------------------------------------------# * Escolher as cores#--------------------------------------------------------------------------Event_Color = Color.new(255, 225, 255)Player_Color = Color.new(255, 255, 255)#--------------------------------------------------------------------------# * Escolha o que você quer mostrar no personagem# ~ 'Nome', 'Classe', 'Nivel', 'Hp', 'Mp'#--------------------------------------------------------------------------Player_Text = 'Nome'#--------------------------------------------------------------------------# * Vareavel de instancia publica#--------------------------------------------------------------------------attr_accessor :text_displayend#==============================================================================# ** Game_Event#==============================================================================class Game_Event < Game_Character#--------------------------------------------------------------------------# * Alias Listings#--------------------------------------------------------------------------alias seph_characterdisplay_gevent_refresh refresh#--------------------------------------------------------------------------# * Atualização#--------------------------------------------------------------------------def refresh# Methodo de Atualização Originalseph_characterdisplay_gevent_refresh# Checa se o evento está com o comando no comentáriounless @list.nil?for i in 0...@list.sizeif @list[i].code == 108@list[i].parameters[0].dup.gsub!(/\[[Nn][Oo][Mm][Ee][=](.+?)\]/) do@text_display = [$1, Event_Color]endendendend@text_display = nil if @erasedendend#==============================================================================# ** Game_Player#==============================================================================class Game_Player < Game_Characteralias seph_characterdisplay_gplayer_refresh refresh#--------------------------------------------------------------------------# * Atualização#--------------------------------------------------------------------------def refresh# Methodo de Atualização Originalseph_characterdisplay_gplayer_refresh# Pega o personagem principalactor = $game_party.members[0]# Determina o textocase Player_Textwhen 'Nome'txt = actor.namewhen 'Classe'txt = actor.class_namewhen 'Nivel'txt = "Nivel: #{actor.level}"when 'Hp'txt = "HP: #{actor.hp} / #{actor.maxhp}"when 'Mp'txt = "MP: #{actor.sp} / #{actor.maxsp}"elsetxt = ''end# Creates Text Displayendend#==============================================================================# ** Sprite_Character#==============================================================================class Sprite_Characteralias seph_characterdisplay_scharacter_update update#--------------------------------------------------------------------------# * Atualizar Frame#--------------------------------------------------------------------------def update# Methodo de Atualização Originalseph_characterdisplay_scharacter_update# Methodo de atualização para mostrar o nome no eventoupdate_display_textend#--------------------------------------------------------------------------# * Cria o Sprite para Mostrar#--------------------------------------------------------------------------def create_display_sprite(args)bitmap = Bitmap.new(160, 24)# Tamanho da Fontbitmap.font.size = 13# Texto com Sombrabitmap.font.draw_shadow = false if bitmap.font.respond_to?(:draw_shadow)bitmap.font.color = Color.new(0, 0, 0)bitmap.draw_text(0, 0, 160, 24, args[0], 1)# Cor da Fontbitmap.font.color = Color.new(255, 255, 255)# Textobitmap.draw_text(0, 0, 160, 24, args[0], 1)# Desenha o texto@_text_display = Sprite.new(self.viewport)@_text_display.bitmap = bitmap@_text_display.ox = 80@_text_display.oy = 10@_text_display.x = self.x@_text_display.y = self.y - self.oy / 2 - 24@_text_display.z = 30001@_text_display.visible = self.visible #trueenddef dispose_display_text@_text_display.dispose unless @_text_display.nil?enddef update_display_textunless @character.text_display.nil?create_display_sprite(@character.text_display) if @_text_display.nil?@_text_display.x = self.x@_text_display.y = self.y - self.oy / 2 - 24elsedispose_display_text unless @_text_display.nil?endendend
Hm, não deu cara ... deu esse erro aqui:Tipo, já tem essa linha "return unless $game_player.transfer?" no script, aí colocando esse $game_player.perform_transfer? abaixo disso dá esse erro, e caso eu apague o $game_player.transfer? que já tem e deixe só esse que mandou colocar também da erro.