Sign in to follow this  
Followers 0
KillerG

Detalles de NPC's

10 posts in this topic

Un script facil de usar
Lo que hace es simple, habre una pequeña ventana dando datos que nosotros pongamos sobre el NPC

Script:
[SPOILER]
CODE
#==============================================================================
# ** NPC Details Window
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-07-11
# Version 1
#------------------------------------------------------------------------------
# * Instructions
#
#   ~ Give NPC Comment Line with : NPC Details
#     The Following Lines in the Comment Box will apear exactly as is
#
#   ~ NPC Button
#     Check_NPCDetails_Button = Input::Constant
#==============================================================================
#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player
 #--------------------------------------------------------------------------
 # * Check NPC Details Button
 #--------------------------------------------------------------------------
 Check_NPCDetails_Button = Input::A
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias seph_npcdetails_gmplyr_update update
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Original Update
   seph_npcdetails_gmplyr_update
   # If NPC Details Button is Pressed
   if Input.trigger?(Check_NPCDetails_Button)
     # Gets NPC Desired Location
     new_x = x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
     new_y = y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
     # Checks All Events
     for event in $game_map.events.values
       # If Event is In Front Of Player
       if event.x == new_x && event.y == new_y
         # Checks All Event's Event Commands
         for event_command in event.list
           # If Comment Command
           if event_command.code == 108
             # If Comment Contains 'NPC Details'
             if event_command.parameters[0].include?('NPC Details')
               # Gathers NPC Details
               details = []
               index = event.list.index(event_command)
               for i in index...event.list.size
                 if event.list[i].code == 408
                   details << event.list[i].parameters[0]
                 end
               end
               # Creates NPC Window
               $scene.seph_start_npcdetails_window(event.id, details)
               break
             end
           end
         end
       end
     end
   end
 end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event
 attr_reader :event
end
 
#==============================================================================
# ** Window_NPCDetails
#==============================================================================

class Window_NPCDetails < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(event_id, details)
   x = [[0, $game_map.events[event_id].screen_x - 160].max, 320].min
   y = [[0, $game_map.events[event_id].screen_y - 224].max, 320].min
   super(x, y, 320, 160)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.opacity = 160
   refresh(event_id, details)
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh(event_id, details)
   self.contents.clear
   # Draws Event Name
   name = $game_map.events[event_id].event.name
   self.contents.font.color = system_color
   self.contents.draw_text(0, 0, contents.width, 32, name, 1)
   # Draws Details
   self.contents.font.color = normal_color
   for i in 0...details.size
     self.contents.draw_text(4, i * 32 + 32, contents.width, 32, details[i])
   end
 end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias seph_npcdetails_scnmap_update update
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # If NPC Details Window Exist
   unless @npc_details_window.nil?
     seph_update_npcdetails
     return
   end
   # Original Update Processing
   seph_npcdetails_scnmap_update
 end
 #--------------------------------------------------------------------------
 # * Frame Update : Npc Details
 #--------------------------------------------------------------------------
 def seph_update_npcdetails
   # Update Map Details
   $game_map.update
   $game_system.map_interpreter.update
   $game_system.update
   $game_screen.update
   @spriteset.update
   @message_window.update
   # If B Button Or C Button is Pressed
   if Input.trigger?(Input::A) || Input.trigger?(Input::C)
     # Dispose NPC Details Window
     @npc_details_window.dispose
     @npc_details_window = nil
   end
 end
 #--------------------------------------------------------------------------
 # * Start NPC Details Window
 #--------------------------------------------------------------------------
 def seph_start_npcdetails_window(event_id, details)
   @npc_details_window = Window_NPCDetails.new(event_id, details)
 end
end
[/SPOILER]

Introducciones:
1)Para ver la informacion del npc hay que estar cerca del NPC(al lado) y apretar "Z"(se puede cambiar
2) Crea un evento cualquiera y ponle una anotacion(comentario) que contenga:
NPC Details
Lo que quieras
Otra cosa
Etc...
....
Y termina la anotacion, cuando juegues al pulsar "Z" saldra una ventana diciendo la info que pusistes, facil de usar
Screenie Tuto:
[SPOILER]
user posted image
[/SPOILER]

Screenies:
[SPOILER]
http://img231.imageshack.us/my.php?image=screen14ui.png
[/SPOILER]

By: SephirotSpawn Edited by KillerG
0

Share this post


Link to post
Share on other sites
perdon si revivo el tema pero pongo la anotacion y me sale la ventana vacia sin informacion, podes explicar mejor como poner las lineas despues del npcdetail? auxilio.gif
0

Share this post


Link to post
Share on other sites
Ése script queda muy bien en juegos donde eliges al grupo. Gracias por éste script.
0

Share this post


Link to post
Share on other sites
QUOTE(jcxtrm @ Oct 8 2006, 04:36 PM)
Ése script queda muy bien en juegos donde eliges al grupo. Gracias por éste script.
[right][snapback]8176[/snapback][/right]

avos te funciona? ojomorado.gif por ke a mi me abre la ventana en sin decir nada.
0

Share this post


Link to post
Share on other sites
Ahora te subo una imagen de como deberia ser la ventana de anotacion icon13.gif

Edit: Imagen subida icon13.gif , mirar donde dice Screenie Tuto , se entiende bastante como para preguntar rolleye11.gif Edited by KillerG
0

Share this post


Link to post
Share on other sites
user posted image
en el evento pongo la anotacion y no me sale en el juego llorar.gif alguien probo el script y le funciona? o sino es mi maker huh.gif
0

Share this post


Link to post
Share on other sites
Chequeaste que tenga la fuente?
Copia y pega de nuevo el script por las dudas q se haya copiado mal
Si no es nada de eso, puede q sea incompatible con otro script o si usas SDK
Pero si no es nada de eso, ni idea =S
0

Share this post


Link to post
Share on other sites
lo copie y pegue otra vez y nada, y es un proyecto nuevo de prueva sin nada agregado, ni un script, no necesitara el sdk o alguna de esas cosas?
0

Share this post


Link to post
Share on other sites
lo q el dice es q si te fijaste si la fuente la tenes anda a donde dice sobre la fuente y cambiala por una q tengas y seguro q funca icon13.gif
0

Share this post


Link to post
Share on other sites
Cambia el main por esto:

CODE

#==============================================================================
# ■ Main
#------------------------------------------------------------------------------
#  各クラスの定義が終わった後、ここから実際の処理が始まります。
#==============================================================================
begin  
# Tipo de fuente ha usar
$defaultfonttype = $fontface = $fontname = Font.default_name = "Arial"
# Tamaño de la fuente
$defaultfontsize = $fontsize = Font.default_size =  24
Graphics.freeze
$scene = Scene_Title.new
while $scene != nil
$scene.main
end
Graphics.transition(20)
rescue Errno::ENOENT
filename = $!.message.sub("No such file or directory - ", "")
print("File #{filename} was not found.")
end



Cambia el Arial por cualquier Font que quieras usar

Suerte icon13.gif Edited by Alexus
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0