In Game tone change V1

5 Respostas   1387 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

SevenM

Tópico criado em: 07/10/2014 às 21:39 - Última modificação por King Gerar em 20/01/2017 às 09:25

In Game tone change V1
Grim


Link do tópico original: Clique Aqui
 Não sei se já postaram, fiz uma busca antes mas não retornou resultados similares portanto decidi arriscar. xD O script é SUPER útil e achei que mais pessoas iriam gostar.

Introdução:
O grande problema em testar tons de tela no RMVX-A é o fardo de sempre precisar recompilar o jogo e testar in-game para saber se o valor selecionado de fato agradou e fez justo ao que imaginávamos. Com este script, você terá acesso a uma tela de mudança de tons da tela em tempo real enquanto estiver testando o jogo direto do editor.(executar o jogo no RPG Maker)

O botão para esconder/mostrar a janela de testes é F3 por padrão, você pode mudar esta tecla indo no módulo Tint_Config e editando o valor de KEY.

O script é de fácil uso e irá poupar você de diversos testes em busca do tom perfeito para cenas e mapas específicos.

Screenshot do script em ação:



Como instalar e usar:
Coloque o script acima do script "Main", dentro da aba de "Materiais" e pressione a tecla F3 in-game durante o teste no RPG Maker. Mova os sliders na direção desejada e, quando achar o tom de tela correto, anote os valores e utilize-os na opção padrão do maker.

Script
Código: [Selecionar]
=begin
Modificateur de teinte inGame !
------------------------------------------------------
Par Grim (http://blog.gri.im)
Funkywork - Biloucorp

Un tout grand merci à Zeus81 pour sa précieuse aide (sur les arguments
et pour le 'v' :P)

Idée originale de Siegfried, merci à lui !

Merci à Magicalichigo et Nuki pour leur aide aussi :)

Concept
------------------------------------------------------
Je suis un grand utilisateur des tons d'écran sous RM,
le problème c'est que l'on est jamais satisfait du premier coup
donc il faut recompiler le projet plusieurs fois...
Avec ce script, vous avez, en mode test (donc uniquement lancé
depuis l'éditeur) une fenêtre de test des teintes en temps réel.
La touche pour appeller/masquer la fenêtre est F3 par défaut,
Vous pouvez la changer via le module Tint_Config, il suffit
de modifier la constante KEY.

J'espère que ce script sera utile !

=end
#==============================================================================
# ** Tint_Config
#------------------------------------------------------------------------------
#  Configuration du script
#==============================================================================

module Tint_Config
#--------------------------------------------------------------------------
# * Liste des touches
#--------------------------------------------------------------------------
F1 = 0x70
F2 = 0x71
F3 = 0x72
F4 = 0x73
F5 = 0x74
F6 = 0x75
F7 = 0x76
F8 = 0x77
F9 = 0x78
F10 = 0x79
F11 = 0x7A
F12 = 0x7B
#--------------------------------------------------------------------------
# * Touche d'activation du menu de teinte
#--------------------------------------------------------------------------
KEY = F3
end

#==============================================================================
# ** Module d'interaction Utilisateur
#------------------------------------------------------------------------------
#  Ensemble des outils de saisie utilisateur
#==============================================================================

module GUI
#--------------------------------------------------------------------------
# * Librairies
#--------------------------------------------------------------------------
FindWindowA = Win32API.new('user32', 'FindWindowA', 'pp', 'l')
GetPrivateProfileStringA = Win32API.new('kernel32', 'GetPrivateProfileStringA', 'pppplp', 'l')
GetWindowRect = Win32API.new('user32','GetWindowRect','lp','i')
ScreenToClient = Win32API.new('user32', 'ScreenToClient', 'lp', 'i')
GetAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
GetKeyState = Win32API.new('user32', 'GetKeyState', 'i', 'i')
CreateWindowEx = Win32API.new("user32","CreateWindowEx",'lpplllllllll','l')
ShowWindow = Win32API.new('user32','ShowWindow','ll','l')
DestroyWindow = Win32API.new('user32','DestroyWindow','p','l')
MoveWindow = Win32API.new('user32','MoveWindow','liiiil','l')
SendMessage = Win32API.new('user32','SendMessage','llll','l')
SetWindowText = Win32API.new('user32','SetWindowText','pp','i')
#--------------------------------------------------------------------------
# * Styles
#--------------------------------------------------------------------------
WS_BORDER = 0x00800000
WS_POPUP = 0x80000000
WS_VISIBLE = 0x10000000
WS_SYSMENU = 0x00080000
WS_CLIPSIBLINGS = 0x04000000
WS_CAPTION = 0x00C00000
WS_TILED = 0x00000000
WS_DLGFRAME = 0x00400000
WS_CHILD = 0x40000000
WS_EX_WINDOW_EDGE = 0x00000100
WS_EX_APPWINDOW = 0x00040000
WS_EX_TOOLWINDOW = 0x00000080
TBS_AUTOTICKS = 1
TBS_ENABLESELRANGE = 32
TBS_NOTIFY  = 0x0001
TBM_SETRANGE = 1030
TBM_SETPOS = 1029
TBM_GETPOS = 1024
TBM_GETMAX = 1031
TRACKBAR_CLASS = "msctls_trackbar32"

#--------------------------------------------------------------------------
# * Singleton
#--------------------------------------------------------------------------
class << self
#--------------------------------------------------------------------------
# * Retourne la fenêtre RGSS
#--------------------------------------------------------------------------
def handle
name = [].pack("x256")
GetPrivateProfileStringA.call('Game', 'Title', '', name, 255, ".\\Game.ini")
name.delete!("\x00")
FindWindowA.call('RGSS Player', name)
end
#--------------------------------------------------------------------------
# * Retourne le RECT de la fenêtre sur l'écran
#--------------------------------------------------------------------------
def window_rect
buffer = [0,0,0,0].pack('l4')
GetWindowRect.call(handle, buffer)
return Rect.new(*buffer.unpack('l4'))
end
end

#==============================================================================
# ** Window_Track
#------------------------------------------------------------------------------
#  Fenêtre qui contiendra les sliders
#==============================================================================

class Window_Track
#--------------------------------------------------------------------------
# * Variable de classe
#--------------------------------------------------------------------------
@@HWND = GUI.handle
#--------------------------------------------------------------------------
# * variables d'instances
#--------------------------------------------------------------------------
attr_reader :visibility
#--------------------------------------------------------------------------
# * Constructeur
#--------------------------------------------------------------------------
def initialize(r=0,v=0,b=0,g=-255)
@visibility = false
name = "Modification de la teinte"
@w, @h = 280, 200
@x, @y = GUI.window_rect.x-@w-16, GUI.window_rect.y
ex_style = WS_EX_WINDOW_EDGE|WS_EX_APPWINDOW|WS_EX_TOOLWINDOW
dw_style = WS_POPUP|WS_DLGFRAME|WS_TILED|WS_CAPTION
args = [ex_style, "static", name, dw_style, @x,@y,@w,@h, @@HWND, 0,0,0]
@window = CreateWindowEx.call(*args)
args2 = [0, "static", "[R: #{r}] [V: #{v}] [B: #{b}] [G: #{g}]", WS_CHILD|WS_VISIBLE,10,150,260,40, @window, 0,0,0]
@red = UI_Slider.new("red", 10, 32, @window, r)
@green = UI_Slider.new("green", 10, 64, @window, v)
@blue = UI_Slider.new("blue", 10, 96, @window, b)
@gray = UI_Slider.new("gray", 10, 128, @window, g)
@text = CreateWindowEx.call(*args2)
end
#--------------------------------------------------------------------------
# * Get value
#--------------------------------------------------------------------------
def get_value(sym)
return @red.get_value if sym == :red || sym == :r
return @green.get_value if sym == :green || sym == :g
return @blue.get_value if sym == :blue || sym == :b
return @gray.get_value
end
#--------------------------------------------------------------------------
# * Delete
#--------------------------------------------------------------------------
def delete
DestroyWindow.call(@window)
end
#--------------------------------------------------------------------------
# * Display textbox
#--------------------------------------------------------------------------
def set_visibility(value, r=0, v=0, b=0, g=-255)
@visibility = !!value
flag = (value) ? 1 : 0
@red.set_value r
@green.set_value v
@blue.set_value b
@gray.set_value g
ShowWindow.call(@window, flag)
set_text r, v, b, g
end
#--------------------------------------------------------------------------
# * set text
#--------------------------------------------------------------------------
def set_text(r, v, b, g)
SetWindowText.call(@text, "[R: #{r}] [V: #{v}] [B: #{b}] [G: #{g}]")
end
end

#==============================================================================
# ** UI_Slider
#------------------------------------------------------------------------------
#  Décris un slider
#==============================================================================

class UI_Slider
#--------------------------------------------------------------------------
# * Constructeur
#--------------------------------------------------------------------------
def initialize(name, x, y, hwnd, value)
@hwnd = hwnd
dw_style = WS_CHILD|WS_VISIBLE|TBS_NOTIFY
args = [0, TRACKBAR_CLASS, name, dw_style, x, y, 255, 32, @hwnd, 0,0,0]
@track = CreateWindowEx.call(*args)
SendMessage.call(@track, TBM_SETRANGE, 1, [-255, 255].pack('SS').unpack('L')[0])
SendMessage.call(@track, TBM_SETPOS, 1, value)
end
#--------------------------------------------------------------------------
# * Get Value
#--------------------------------------------------------------------------
def get_value
return SendMessage.call(@track, TBM_GETPOS, 0, 0)
end
#--------------------------------------------------------------------------
# * Set Value
#--------------------------------------------------------------------------
def set_value(val)
return SendMessage.call(@track, TBM_SETPOS, 1, val)
end
end
end

#==============================================================================
# ** Module Input
#------------------------------------------------------------------------------
#  Ajout de la gestion de la Palette
#==============================================================================

module Input
#--------------------------------------------------------------------------
# * variables de classe
#--------------------------------------------------------------------------
@@window_Track = GUI::Window_Track.new
#--------------------------------------------------------------------------
# * Singleton
#--------------------------------------------------------------------------
class << self
#--------------------------------------------------------------------------
# * Alias
#--------------------------------------------------------------------------
alias tint_update update
#--------------------------------------------------------------------------
# * Input update
#--------------------------------------------------------------------------
def update
tint_update
rmvxace = $game_map.respond_to?(:screen)
flag =(rmvxace && defined?(SceneManager)) ? SceneManager.scene : $scene
if ($TEST||$DEBUG) && flag.is_a?(Scene_Map)
if rmvxace
screen = $game_map.screen
key_press = lambda do |key|
GUI::GetAsyncKeyState.call(key)&0x01 == 1
end
else
screen = $game_screen
key_press = lambda do |key|
!GUI::GetKeyState.call(key).between?(0, 1)
end
end
t = screen.tone
if key_press.call(Tint_Config::KEY)
@@window_Track.set_visibility(!@@window_Track.visibility, t.red, t.green, t.blue, t.gray)
sleep(0.2) unless rmvxace
end
r, v, b, g = @@window_Track.get_value(:r), @@window_Track.get_value(:g),@@window_Track.get_value(:b), @@window_Track.get_value(:gr)
r_check = t.red != r
g_check = t.green != v
b_check = t.green != b
gr_check = t.gray != g
if (r_check || g_check || b_check || gr_check) && @@window_Track.visibility
new_tone = Tone.new(r,v,b,g)
screen.start_tone_change(new_tone, 0)
@@window_Track.set_text(r,v,b,g)
end
end
end
end
end

Link externo em .rb
https://github.com/BastienDuplessier/Scripts-rm/blob/master/Toutes%20versions/InGameTONEChange.rb

Créditos e agradecimentos:
- Grim
- Zeus81
- Nuki
- Magicalichigo
- Hiino

Notas do autor:
Divirta-se.

Jogo em desenvolvimento. Se interessou? Clique na imagem para mais informações!

Selitto

  • *
  • Posts: 392
  • Ouros: 97
  • A vida é muito curta para ser pequena. - Benjami D
  • Equipamentos "Um dos melhores trabalhos dos povos das terras da noite é esse metal, que na escuridão mais gelada aquece o corpo que protege." "O norte sempre me surpreende, e este escudo não foi uma exceção. Em uma de minhas viagens lá vi ele, muito bonito e resistente, claro que não poderia deixar de trazer um."
Resposta 1: 07/10/2014 às 22:12

Muito bom , não tinha visto esse script em nenhum lugar, será muito útil pra mim, sempre que vou testar, fico indo e voltando. Gold!

SimonMuran

Resposta 2: 08/10/2014 às 07:26

Caaaraca, ta aí um script diferente valeu por postar!

Geraldo de Rívia

  • Mito
  • *
  • Posts: 4452
  • Ouros: 3887
  • O vento está sibilando.
  • Medalhas Vencedor do Protótipo Premiado Participantes do Maps Together 2
Resposta 3: 08/10/2014 às 07:56

Haha, custei a entender o funcionamento aqui. Tava imaginando que era
pro jogador (final) ajeitar o mapa como ele preferisse. Mas funciona como
uma ferramenta a mais pros makers, certo?

É realmente bom mesmo, eu geralmente demoro muito pra achar um tom
legal, principalmente para quando faço a tela à noite.
Muito bom, Seven!
  :ok:

SevenM

Resposta 4: 08/10/2014 às 12:22

 O mais engraçado é que achei este script por acaso. kk  Eu estava ficando meio de saco cheio com tantos testes seguidos apenas para achar o tom de tela ideal para dentro da casa que estou bolando e decidi pesquisar algumas dicas sobre como agilizar o processo, acabei me deparando com essa maravilha e logo decidi compartilhar o achado. xD

 Fico contente em saber que o achado vai ser útil para mais pessoas.  :XD:

Jogo em desenvolvimento. Se interessou? Clique na imagem para mais informações!

Misty

  • Mito
  • *
  • Posts: 1602
  • Ouros: 1837
  • The Last One!~
  • Medalhas Participante do 'Amigo, Estou Aqui!' Participante da 2º Mostra de Arte Steamfórdia Vencedor CRM Awards - Melhor Designer pela 2ª vez Vencedor CRM Awards - Melhor Designer Vencedor do Protótipo Premiado
Resposta 5: 08/10/2014 às 14:53

É realmente muito útil para quem faz bastante cutscenes em diferentes ambientes. Meus parabéns pela contribuição! :XD: