InícioFAQBuscarMembrosRegistrar-seLogin
A Equipe Central RPG Maker deseja a todos Boas Vindas!
Olá galera venho aqui pedir para ajuda a vocês pesso que postem conteúdo em nossa comunidade irei ajudar a vocês também.
Agora nossa comunidade também tem o famoso projeto de ouro porem da nossa comunidade leva um nome diferente leva o nome Osca de Ouro entre no tópico de Notícias e fique por dentro das novidades.

Compartilhe | 
 

 Script de tirar foto igual no the sims!!

Ver o tópico anterior Ver o tópico seguinte Ir em baixo 
AutorMensagem
matheus180
Membro
Membro


Sexo : Masculino
Mensagens : 149

MensagemAssunto: Script de tirar foto igual no the sims!!   Sab Dez 11, 2010 2:39 pm


Correções:
Nome da imagem
Tradução das Scenes

Autor Original:
BigKevSexMan(rmxp.org)

Função:
tira fotos com F5 e ve elas em um Menu com F6

Screens:



Script:
Código:

# -----------------------------
# BigKev's Picture Camera
# -----------------------------

class Game_Stored
attr_accessor :picture_database
attr_accessor :picture_events
def initialize
@new_picture_calling = false
@picture_database = []
@picture_events = []
end

def check_picture_events # Whenever you want to check if an event that had it's picture taken use $game_stored.check_picture_events
for i in 1...6 # Cycles through each picture to see the events located within
for j in 0...299 # Cycles through every possible event in each picture
if $game_stored.picture_events[i] != nil
if $game_stored.picture_events[i][j] == "PurpleFlower" # Events taken by pictures are recognized by name
$game_switches[2] = true # PurpleFlower
$game_map.refresh # You gotta refresh the map everytime you turn a switch on/off if you want it to take effect.
end
if $game_stored.picture_events[i][j] == "Fairy"
$game_switches[3] = true # fairy
$game_map.refresh
end
if $game_stored.picture_events[i][j] == "Sticks"
$game_switches[5] = true # sticks
$game_map.refresh
end
if $game_stored.picture_events[i][j] == "Fire"
$game_switches[4] = true # campfire
$game_map.refresh
end
if $game_stored.picture_events[i][j] == "Lich"
for k in 0...299 # Recycles through every possible event in each picture
if $game_stored.picture_events[i][k] == "Ghost"
$game_switches[7] = true # CaughtGhosts
$game_map.refresh
end
end
end
# Insert other pictures you want taken here
end
end
end
end
end

class Scene_Photo_Menu # Menu that displays all the pictures you have taken
def initialize(menu_index = 0)
@menu_index = menu_index
end

def main
# Sets up the information on the picture that shows in Window_Photo_Display
@selected_picture = Sprite.new
@selected_picture.x = 75
@selected_picture.y = 20
@selected_picture.z = 9998
@selected_picture.zoom_x = 0.75
@selected_picture.zoom_y = 0.75

@window_photo_select = Window_Photo_Select.new
@window_photo_select.index = @menu_index
@window_photo_select.x = 0
@window_photo_select.y = 400
@photo_display_window = Window_Photo_Display.new
@photo_display_window.x = 0
@photo_display_window.y = 0
@photo_options_window = Window_Photo_Options.new
@photo_options_window.index = @menu_index
@photo_options_window.x = 0
@photo_options_window.y = 400
@photo_options_window.visible = false
@photo_options_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_photo_select.dispose
@photo_display_window.dispose
@photo_options_window.dispose
end

def update
@window_photo_select.update
@photo_display_window.update
@photo_options_window.update
if @window_photo_select.active
case @window_photo_select.index
when 0
# Set's the picture to the stored picture's bitmap to the corresponding picture in the database
if $game_stored.picture_database[1] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture1")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
when 1
if $game_stored.picture_database[2] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture2")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
when 2
if $game_stored.picture_database[3] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture3")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
when 3
if $game_stored.picture_database[4] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture4")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
when 4
if $game_stored.picture_database[5] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture5")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
when 5
if $game_stored.picture_database[6] != nil
@selected_picture.bitmap = RPG::Cache.picture("Picture6")
else
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
end
end
if Input.trigger?(Input::C)
# Enters Photo Options Menu
if $game_stored.picture_database[@window_photo_select.index+1] != nil
@window_photo_select.active = false
@window_photo_select.visible = false
@photo_options_window.visible = true
@photo_options_window.active = true
$game_system.se_play($data_system.decision_se)
else
$game_system.se_play($data_system.cancel_se)
end
end
# Leaves the Menu
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@selected_picture.dispose
$scene = Scene_Map.new
end
return
end
if @photo_options_window.active
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@window_photo_select.active = true
@window_photo_select.visible = true
@photo_options_window.visible = false
@photo_options_window.active = false
end
if Input.trigger?(Input::C)
case @photo_options_window.index
when 0 # Deletes the picture
$game_stored.picture_database[@window_photo_select.index+1] = nil
$game_stored.picture_events[@window_photo_select.index+1] = []
RPG::Cache.picture("Picture"+(@window_photo_select.index+1).to_s).dispose
@selected_picture.bitmap = RPG::Cache.picture("NoPicture")
$game_system.se_play($data_system.decision_se)
when 1 # Returns to Photo Select Menu
@window_photo_select.active = true
@window_photo_select.visible = true
@photo_options_window.visible = false
@photo_options_window.active = false
$game_system.se_play($data_system.cancel_se)
end
end
return
end
end
end

class Scene_New_Picture # Menu when you take the picture
def initialize(index, menu_index = 0)
@menu_index = menu_index
@index = index
end

def main
@window_save_picture = Window_Save_Picture.new
@column_max = 2
@window_save_picture.index = @menu_index
@window_save_picture.x = 0
@window_save_picture.y = 400
@new_picture_window = Window_New_Picture.new(@index)
@new_picture_window.x = 0
@new_picture_window.y = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_save_picture.dispose
@new_picture_window.dispose
end

def update
@window_save_picture.update
@new_picture_window.update
if @window_save_picture.active
if Input.trigger?(Input::C)
case @window_save_picture.index
when 0
$game_system.se_play($data_system.decision_se)
for i in 1..6 # Checks to see if there is an open slot available
if $game_stored.picture_database[i] == nil
# Storing the newly taken picture in the database
$game_stored.picture_database[i] = 1
events_within_range(i)
break
end
end
$scene = Scene_Map.new
when 1
# Deletes the picture
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
RPG::Cache.picture("Picture" + @index.to_s).dispose
return
end
end
return
end
end

def events_within_range(id) # Checking to see what events are within the picture
if $game_map.events.keys.max != nil
$game_stored.picture_events[id] = []
for i in 0...$game_map.events.keys.max+1
if $game_map.events[i] != nil
if $game_map.events[i].real_x >= $game_map.display_x + 64
if $game_map.events[i].real_x <= $game_map.display_x + 2496
if $game_map.events[i].real_y >= $game_map.display_y + 128
if $game_map.events[i].real_y <= $game_map.display_y + 1792
$game_stored.picture_events[id].push($game_map.events[i].event.name)
end
end
end
end
end
end
end
end
end

class Window_Photo_Options < Window_Selectable
def initialize
super(0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
@item_max = 2
@column_max = 2
@commands = ["Deletar", "Voltar"]
draw_item(0, normal_color)
draw_item(1, normal_color)
self.index = 0
end

def refresh
self.contents.clear
end

def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(160 + index * 160, 0, 128, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect
self.cursor_rect.set(160 + index * 160, 0, 128, 32)
end
end

class Window_Photo_Select < Window_Selectable
def initialize
super(0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
@item_max = 6
@column_max = 6
@commands = ["Photo1", "Photo2", "Photo3", "Photo4", "Photo5", "Photo6"]
draw_item(0, normal_color)
draw_item(1, normal_color)
draw_item(2, normal_color)
draw_item(3, normal_color)
draw_item(4, normal_color)
draw_item(5, normal_color)
self.index = 0
end

def refresh
self.contents.clear
end

def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(40 + index * 90, 0, 84, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect
self.cursor_rect.set(40 + index * 90, 0, 84, 32)
end
end

class Window_Photo_Display < Window_Base
def initialize
super(0, 0, 640, 400)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end

def refresh
self.contents.clear
@frame = Sprite.new
@frame.bitmap = RPG::Cache.picture("PictureFrame")
@frame.x = 75
@frame.y = 20
@frame.z = 9999
@frame.zoom_x = 0.75
@frame.zoom_y = 0.75
end

def dispose
@frame.dispose
super
end
end

class Window_New_Picture < Window_Base
def initialize(index)
super(0, 0, 640, 400)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@index = index
@temp_picture = Sprite.new
refresh
end

def refresh
self.contents.clear
@frame = Sprite.new
@frame.bitmap = RPG::Cache.picture("PictureFrame")
@frame.x = 75
@frame.y = 20
@frame.z = 9999
@frame.zoom_x = 0.75
@frame.zoom_y = 0.75
@temp_picture.bitmap = RPG::Cache.picture("Picture"+@index.to_s)
@temp_picture.x = 75
@temp_picture.y = 20
@temp_picture.z = 9998
@temp_picture.zoom_x = 0.75
@temp_picture.zoom_y = 0.75
end

def dispose
@frame.dispose
@temp_picture.dispose
super
end
end

class Window_Save_Picture < Window_Selectable
def initialize
super(0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
@item_max = 2
@column_max = 2
@commands = ["Continuar", "Apagar"]
draw_item(0, normal_color)
draw_item(1, normal_color)
self.index = 0
end

def refresh
self.contents.clear
end

def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect
self.cursor_rect.set(160 + index * 160, 0, 128, 32)
end
end

class Scene_Map
alias bksm_photography_update update
def update
if Input.trigger?(Input::F5) # Takes a new picture
if $game_stored.picture_database[1] != nil
if $game_stored.picture_database[2] != nil
if $game_stored.picture_database[3] != nil
if $game_stored.picture_database[4] != nil
if $game_stored.picture_database[5] != nil
if $game_stored.picture_database[6] != nil
print "Sem espaço disponivel" # If no slot is available
end
end
end
end
end
end
for i in 1...6
if $game_stored.picture_database[i] == nil
# If slot is available
Screen::shot("Picture" + i.to_s, 2)
$game_player.straighten
$scene = Scene_New_Picture.new(i, 0)
break
end
end
end
if Input.trigger?(Input::F6) # Calls the Photo Menu
$game_player.straighten
$scene = Scene_Photo_Menu.new
end
bksm_photography_update
end
end

class Scene_Title
alias bksm_camera_command_new_game command_new_game
def command_new_game
$game_stored = Game_Stored.new
bksm_camera_command_new_game
end
end

class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)

$game_stored = Marshal.load(file)

if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end

class Scene_Save
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)

Marshal.dump($game_stored, file)
end
end

class Game_Event
attr_reader :event
end
#===============================================================================
#
# Screenshot V2
#
# Screenshot Script v1 & screenshot.dll v1 created by: Andreas21
# Screenshot Script v2 created/edit by: cybersam
# the autor is found on a german board...
# the comments are added by me...
# since the autor didnt want to add any comment...
# so thats it from here...
# have fund with it... ^-^
#
# oh yea.. the needed command line is found in "Scene_Map" in "def update"
#
#===============================================================================

module Screen

@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'

module_function

#-----------------------------------------------------------------------------
# here comes the stuff...
# i add here the stuff for automatic change of the number for the screenshot
# so it wont overrite the old one...
# if you want to change so stuff change them in this line below
# or you can change them in your command line... like
# Screen::shot("screenshot", 2)
# this change the name and the type of the screenshot
# (0 = bmp, 1 = jpg and 2 = png)
# ----------------------------------------------------------------------------
def shot(file = "New_Picture", typ = 2)

# to add the right extension...
if typ == 0
typname = ".bmp"
elsif typ == 1
typname = ".jpg"
elsif typ == 2
typname = ".png"
end

file_index = 0

dir = "Graphics/Pictures/"

# make the filename....
file_name = dir + file.to_s + typname.to_s

# make the screenshot.... Attention dont change anything from here on....
@screen.call(0,0,640,480,file_name,handel,typ)
end
# find the game window...
def handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end

Instruções:
1) Salve as 2 imagens a seguir:


2) Abaixe o arquivo screenshot.dll em http://www.4shared.com/get/43255777/82c45dba/screenshot.html;jsessionid=1125BFB89F732DAA37B2FC51BE00507C.dc82 e salve na pasta de seu projeto.

Creditos:
Matheus180(Por disponibilizar)
Voltar ao Topo Ir em baixo
 
Script de tirar foto igual no the sims!!
Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo 
Página 1 de 1
 Tópicos similares
-
» tem como colocar meu wave 533 para tirar foto em alta resoluçao?
» Uma dica! quem não tem scaner, pode tirar fotos da prova pra postar!
» Aplicativos Uteis ou Prediletos pro WAVE Y
» Como coloco essas 2 imagens ao mesmo tempo?
» Demora pra tirar foto

Permissão deste fórum:Você não pode responder aos tópicos neste fórum
 :: Rpg Maker XP :: Scripts-
Ir para: