[Thảo Luận] Cần hướng dẫn về script Battle Transistion System
Tình hình là mình dùng Battle Transition System V1.0 của FlipelyFlip (http://www.rpgmakervxace.net/topic/775-battle-transition-system/)
Nhưng do dốt ngoại ngữ :noidien: nên không hiểu lắm.:capcuu: Ai đó có thể hướng dẫn chi tiết script cho mình không?:huhu:
Cảm ơn :ngaytho:(à, mình là người mới ạ):laclac:
Nhưng do dốt ngoại ngữ :noidien: nên không hiểu lắm.:capcuu: Ai đó có thể hướng dẫn chi tiết script cho mình không?:huhu:
Cảm ơn :ngaytho:(à, mình là người mới ạ):laclac:
Comments
#===============================================================================
# * Battle Transistion System V1.0
#
# By FlipelyFlip
#===============================================================================
=begin
With this script you can change the battle transition to randomize the transition
for random battles. Also you can set random transition for boss battles or set a
specified transition for battles. Everything is possible (:
=end
module Flip
TransitTypVarID = 1 # Variable ID for defining if it's a normal, special or
# boss battle transition.
BossDuratVarID = 2 # Variable ID for the duration of the transition
# standard is 60. The higher the number, the longer the transition would take.
BossDirect = "Graphics/System/" # sets the direction where the graphics are
BossTransit = [ # <-- do not remove this!!
"BossStart",
"BossStart2",
"BossStart3"# set up the graphics name for boss transition
] # <-- do not remove this!!
SpecialDuratVarID = 3 # Variable ID for the duration of the transition
# no standard. The higher the number, the longer the transition would take.
SpecialDirect = "Graphics/System/" # sets the direction where the graphics are
SpecialTransit = [ # <-- do not remove this!!
"BattleStart5", # set up the graphics name for special
"BattleStart6", # transition
"BattleStart7",
] # <-- do not remove this!!
CustomDuratVarID = 4 # Variable ID for the duration of the transition
# standard is 60. The higher the number, the longer the transition would take.
CustomDirect = "Graphics/System/" # sets the direction where the graphics are.
CustomTransitVarID = 5 # Variable ID to save the name of the transition.
# to set the name of transition in a variable, you have to use the call script
# command. Write then in:
# $game_variables[Flip::CustomTransitionVarID] = "TransitionName"
RandomDuratVarID = 6 # Variable ID for the Duration of the transition
# standard is 60. The higher the number, the longer the transition would take.
RandomDirect = "Graphics/System/" # sets the direction where the graphics are
RandomTransit = [ # <-- do not remove this!!
"BattleStart1", # set up the graphics name for random
"BattleStart2", # transitions.
"BattleStart3",
"BattleStart4",
"BattleStart",
] # <-- do not remove this!!
end
#==============================================================================
# ** Scene_Map
#
# This class performs the map screen processing.
#==============================================================================
class Scene_Map
#
# ● Execute Pre-battle Transition
#
def perform_battle_transition
if $game_variables[Flip::TransitTypVarID] == 1 # check if variable == 1 for
# Bossbattletransition (:
Graphics.transition($game_variables[Flip::BossDuratVarID],
Flip::BossDirect+Flip::BossTransit[rand(Flip::BossTransit.size)], 100)
elsif $game_variables[Flip::TransitTypVarID] == 2 # check if variable == 2 for
# Specialtransition. Used for Transitions which are not for random battles,
# also not for boss battles.
Graphics.transition($game_variables[Flip::SpecialDuratVarID],
Flip::SpecialDirect+Flip::SpecialTransit[rand(Flip::SpecialTransit.size)],
100)
elsif $game_variables[Flip::TransitTypVarID] == 3 # check if variable == 3 for
# Customtransition. Used to specify one transition for a battle.
Graphics.transition($game_variables[Flip::CustomDuratVarID],
Flip::CustomDirect+$game_variables[Flip::CustomTransitVarID], 100)
else # Used for random battles
Graphics.transition($game_variables[Flip::RandomDuratVarID],
Flip::RandomDirect+Flip::RandomTransit[rand(Flip::RandomTransit.size)], 100)
end
Graphics.freeze
end
end
class Scene_Title < Scene_Base
#
# ● Command New Game
#
alias flip_transition_default_command_new_game command_new_game
def command_new_game
flip_transition_default_command_new_game
$game_variables[Flip::BossDuratVarID] = 60 # sets the BossDurationVarID to 60
$game_variables[Flip::CustomDuratVarID] = 60 # sets the CustomDurationVarID to
# 60
$game_variables[Flip::RandomDuratVarID] = 60 # sets the RandomDuratVarID to 60
end
end
[/php]
Ý tưởng của script:
Script có mục đích giúp bạn thay đổi transition - hiệu ứng chuyển cảnh khi vào trận đấu, theo ý của mình. Dựa trên sự phân loại lựa chọn như sau:
Có 4 nhóm lựa chọn transition, số thứ tự lựa chọn được xác định bởi biến
V[001] (Được định nghĩa ở dòng TransitTypeVarID = 1). Các lựa chọn gồm có:
1. Boss battle transition - Hiệu ứng khi vào trận đấu với Boss: Ứng với V[001] = 1
Khi đặt giá trị biến V[001] = 1, thì chương trình sẽ chọn ngẫu nhiên các bức ảnh transition có tên được xác định ở phần BossTransit.
Như ở trong script gồm có: "BossStart", "BossBattle2", "BossBattle3".
Ngoài ra còn có thể xác định thời gian kéo dài 1 transition của lựa chọn BossBattle.
Theo như script ta có BossDuratVarID = 2, tức là biến V[002] sẽ xác định thời gian kéo dài này. Mặc định là 60 frames (= 1 giây).
Tương tự ta có.
2. Special transition - Hiệu ứng đặc biệt khi vào trận đấu : Ứng với V[001] = 2
tên các file ảnh được chọn random trong phần SpecialTransit, thời gian kéo dài là biến SpecialDuratVarID = 3 (Biến V[003])
3. Custom transition - Hiệu ứng được cài đặt khi vào trận đấu: Ứng với V[001] = 3
Cái này sẽ hơi đặc biệt, tên file ảnh sẽ không bị fix cứng trong script (tức là 1 khi chơi game sẽ không thể thay đổi), mà bạn có thể thay đổi tên 1 cách chủ động trong thời gian chơi game.
Bạn sẽ đặt tên file ảnh ở biến V[005] (Do dòng CustomTransitVarID = 5 định nghĩa, bạn có thể thay đổi bằng biến khác ở đây).
Và bạn sẽ phải đặt tên thông qua script (Vì giá trị string - xâu ký tự, chữ) không thể dùng event để đặt).
Mẫu câu lệnh của script như sau: $game_variables[Flip::CustomTransitionVarID] = "TransitionName". Trong đó TransitionName là tên file ảnh bạn muốn đặt.
4. Random transition - Hiệu ứng ngẫu nhiên khi vào trận đấu: Ứng với V[001] != 1, 2, 3 (Mọi giá trị trừ 1, 2, 3).
Thời gian và file ảnh tương tự ở trên.
Ví dụ các bước thực hiện
Bước 1:
Down 3 bức ảnh transition trên mạng về (Hoặc kiếm ở đâu đó, các bức ảnh nên có kích thước là 544 x 416 px). Đặt tên lần lượt là "BossStart", "BossBattle2", "BossBattle3" và bỏ vào thư mục Graphics/System
Ví dụ 1 bức ảnh transition sau:
Bước 2:
Đặt 1 event với các câu lệnh như sau:
[php]
@>Control Variables: [0001] = 1
@>Battle Processing: Slime*2
@>
[/php]
Bước 3:
Chạy game và nói chuyện với event đó để xem kết quả.
Chúc bạn thành công