Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Zamknięty przez: Ayene
Sob 27 Sie, 2011 11:42
Wybór Czasowy
Autor Wiadomość
krulszamanuw 



Preferowany:
RPG Maker VX

Pomógł: 9 razy
Dołączył: 29 Lip 2011
Posty: 34
  Wysłany: Czw 25 Sie, 2011 15:13
Wybór Czasowy
Witam użytkowników Ultimy. Otóż mam pewny problem ze skryptem.
Chodzi dokładnie o ten skrypt:
Spoiler:

# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# ======================== XIV's Timed Choices v1.4 ============================
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

# Author: XIV
# Version: 1.4
# Date: 19.12.2010.

# Features:
# - set a timer on player's choices with a variable
# - running an additional timer in the background is possible
# - set a random choice when the timer reaches 00:00 or use your own choice from
# the event command

# How to use:
# 1. Paste this script above Main in your project.
# 2. Setup the switch and variable IDs below.
# 3. Use and enjoy!

# NOTE!
# If you plan on using this with a custom message system, it WILL work fine as
# long as you don't mess with the "choice-box positioning"!
# If you want to make this script compatible with any custom message system's
# choice-box positioning, contact me either in the thread where you found this or
# via PM on rpgmakervx.net.

# For Ultimate Timer users:
# This script does NOT function properly with the count-up timer or the
# variable timer on, although it works perfectly with other features of the
# Ultimate Timer!

module XIV
module TimedChoice
# This variable determines the wait time before the choices close.
CHOICE_TIME = 5

# This switch enables(ON) or disables(OFF) the randomness of the choice when
# the choice timer reaches 00:00
RANDOM_CHOICE = 5

# Set this to true if you want the choice timer to be directly above the message
# box.
ABOVE_MSG = true
end
end
#-------------------------------------------------------------------------------
# * END CUSTOMIZATION
#-------------------------------------------------------------------------------
class Game_System
attr_accessor :choice_on
attr_accessor :return_pos
end # Game_System

class Sprite_Timer < Sprite
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
#--------------------------------------------------------------------------
alias xiv_timedchoices_init initialize unless $@
def initialize(viewport)
xiv_timedchoices_init(viewport)
@xy = [self.x,self.y]
$game_system.return_pos = true
if XIV::TimedChoice::ABOVE_MSG
self.x = 120
self.y = 240
$game_system.return_pos = false
end
end # initialize

alias xiv_timedchoices_up update unless $@
def update
xiv_timedchoices_up
if $game_system.return_pos
self.x = @xy[0]
self.y = @xy[1]
end
end # update
end # Sprite_Timer

class Window_Timer < Window_Base
def initialize
super(120, 240, 88, 50)
self.z = 0
end
end

class Window_Message < Window_Selectable
#-----------------------------------------------------------------------------
# * start_choice alias
#-----------------------------------------------------------------------------
alias new_start_choice_XTC start_choice unless $@
def start_choice
new_start_choice_XTC
$game_system.choice_on = true
@win = Window_Timer.new if XIV::TimedChoice::ABOVE_MSG
if $game_system.timer_working
@timer_worked = true
@old_time = $game_system.timer
end
$game_system.timer = $game_variables[XIV::TimedChoice::CHOICE_TIME] * Graphics.frame_rate
$game_system.timer_working = true
end # start_choice

#-----------------------------------------------------------------------------
# * input_choice alias
#-----------------------------------------------------------------------------
alias new_input_choice_XTC input_choice unless $@
def input_choice
new_input_choice_XTC
if $game_system.timer == 0
rand_choice
Sound.play_cancel
terminate_message
$game_system.choice_on = false
if XIV::TimedChoice::ABOVE_MSG
@win.dispose
$game_system.return_pos = true
end
return_timer
end
if Input.trigger?(Input::C)
$game_system.timer_working = false
$game_system.choice_on = false
if XIV::TimedChoice::ABOVE_MSG
@win.dispose
$game_system.return_pos = true
end
return_timer
end
end # input_choice

#-----------------------------------------------------------------------------
# * new method determines the random choice
#-----------------------------------------------------------------------------
def rand_choice
if $game_switches[XIV::TimedChoice::RANDOM_CHOICE]
random_choice = rand(6)
while random_choice == 0 or (random_choice != 5 and random_choice > $game_message.choice_max) or ($game_message.choice_cancel_type < 5 and random_choice == 5) do
random_choice = rand(6)
end
else
random_choice = $game_message.choice_cancel_type
end
$game_message.choice_proc.call(random_choice - 1)
end # rand_choice

#-----------------------------------------------------------------------------
# * new_method returns the timer if it ran before choice processing
#-----------------------------------------------------------------------------
def return_timer
if @timer_worked
@diff = ($game_variables[XIV::TimedChoice::CHOICE_TIME] * Graphics.frame_rate) - $game_system.timer - Graphics.frame_rate
timing = @old_time - @diff
$game_system.timer = timing
if $game_system.timer <= 0
$game_system.timer = 0
end
$game_system.timer_working = true
end
end # return_timer
end # Window_Message



Chodzi mi o to ,czy dałoby się go tak przerobić, aby był sterowany przełącznikiem?
Ponieważ teraz cały czas się pokazuje czas przy każdym wyborze!
A ja chciałbym aby to było kontrolowane przełącznikiem.
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Czw 25 Sie, 2011 18:36
Dobrze testowałeś skrypt? Wyskakuje błąd po oknie wyboru, gdy wejdzie się w np. w menu po czym wróci na mapę...
Niemniej jeśli chcesz wprowadzić przełącznik zrób kolejno:
Znajdź linijkę:
Kod:
module TimedChoice

dodaj po niej:
Kod:
CHOICE_TIMER_SWITCH = 4  # przełącznik włączający licznik

następnie znajdź fragment:
Kod:
def start_choice   
    new_start_choice_XTC

dodaj po nim:
Kod:
return if $game_switches[XIV::TimedChoice::CHOICE_TIMER_SWITCH] == false

następnie znajdź fragment:
Kod:
def input_choice   
    new_input_choice_XTC

dodaj po nim:
Kod:
return if $game_switches[XIV::TimedChoice::CHOICE_TIMER_SWITCH] == false

:->
________________________


 
 
 
krulszamanuw 



Preferowany:
RPG Maker VX

Pomógł: 9 razy
Dołączył: 29 Lip 2011
Posty: 34
Wysłany: Sob 27 Sie, 2011 11:19
Dziękuje Ayene wszystko działa jak należy ;)
Oto mi chodziło ;) :przytul2:
 
 
Wyświetl posty z ostatnich:   
Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene