Last0rder   05-28-2015, 04:48 PM
#1
ปกติตอนที่กดปุ่ม X เข้าเมนูหลัก มันจะเล่นเสียงเดียวกับเสียงกดคีย์ตกลงตามที่ตั้งค่าไว้ในฐานข้อมูล
แต่อยากเปลี่ยนเสียงเวลาที่กดเข้าเมนูให้เป็นอีกเสียงหนึ่งโดยเฉพาะ พอจะมีวิธีมั้ยคะ?
splendith   05-28-2015, 06:25 PM
#2
-

ทำมาให้แล้วครับผม

ไปที่ Script Editor ของ RPG Maker XP (หรือกด F11)
คลิกขวาที่ Main เลือก Insert จะมีบล็อกช่องว่างเพิ่มขึ้นมา
กดที่บล็อกช่องว่างนั้น ตั้งชื่ออะไรก็ได้ที่ต้องการในช่อง Name
จากนั้นให้นำโค้ดด้านล่างนี้ไปไว้ในกล่องด้านขวาครับ

[shcode=rails]
module Config
MENU_SE_NAME = "test.ogg" # ชื่อไฟล์เสียง พร้อมนามสกุลไฟล์ ไฟล์จะต้องอยู่ที่ Audio/SE ในโฟลเดอร์เกม
MENU_SE_VOLUME = 80 # ความดัง มีค่า 0 - 100 [Default: 80]
MENU_SE_PITCH = 100 # ค่าเสียงต่ำ-เสียงสูง มีค่า 50 - 150 [Default: 100]
end

class Scene_Map
def call_menu
$game_temp.menu_calling = false
if $game_temp.menu_beep
$game_system.se_play(RPG::AudioFile.new(Config::MENU_SE_NAME, Config::MENU_SE_VOLUME, Config::MENU_SE_PITCH))
$game_temp.menu_beep = false
end
$game_player.straighten
$scene = Scene_Menu.new
end
end
[/shcode]

การตั้งค่า
MENU_SE_NAME คือชื่อไฟล์เสียงตามด้วยนามสกุลไฟล์ ซึ่งไฟล์จะต้องอยู่ที่ Audio/SE ในโฟลเดอร์เกม
MENU_SE_VOLUME ความดังของเสียง มีค่า 0 - 100 ปกติจะอยู่ที่ 80
MENU_SE_PITCH ระดับความต่ำ-สูง ของเสียง มีค่า 50 - 150 ปกติจะอยู่ที่ 100
This post was last modified: 05-28-2015, 06:28 PM by splendith.
Last0rder   05-28-2015, 06:30 PM
#3
@splendith เปลี่ยนเสียงตอนเข้าเมนูได้แล้ว ขอบคุณมากเลยค่ะ ^__^
splendith   05-28-2015, 06:32 PM
#4
(05-28-2015, 06:30 PM)Last0rder Wrote: @splendith เปลี่ยนเสียงตอนเข้าเมนูได้แล้ว ขอบคุณมากเลยค่ะ ^__^

ด้วยความยินดีคร้าบ ^^
Nazuth Away   05-28-2015, 07:14 PM
#5
ขอบคุณ คุณsplendithมากครับที่คอยตอบคำถามให้มือใหม่อยู่เรื่อยๆ

[Image: 76561198134933497.png]
Show ContentFanPage:


hengmana   05-28-2015, 08:37 PM
#6
ถ้าไม่อยากให้เปลืองช่อง ให้ไปที่ Scene_Map บรรทัดที่ 202~216
[shcode=rails] def call_menu
# Clearing the menu call flag
$game_temp.menu_calling = false
# When the menu SE performance flag is set
if $game_temp.menu_beep
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Clearing the menu SE performance flag
$game_temp.menu_beep = false
end
# Reforming the attitude of the prayer
$game_player.straighten
# Change to menu screen
$scene = Scene_Menu.new
end[/shcode]
ตรง
$game_system.se_play($data_system.decision_se)

เปลี่ยนเป็น
Audio.se_play("Audio/SE/ชื่อเพลง", 100, 100)
คำสั่งนึ้ก็ใช้ได้เหมือนกัน
This post was last modified: 05-28-2015, 08:40 PM by hengmana.
Last0rder   05-28-2015, 09:42 PM
#7
@hengmana ขอบคุณสำหรับอีกหนึ่งวิธีที่แนะนำมานะคะ ขอเซฟเก็บไว้ทั้งสองแบบเลยแล้ว
  
Users browsing this thread: 1 Guest(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.