Shinryu   07-08-2012, 07:59 PM
#1
เป็นคำสั่งเพื่อให้สามารถตรวจเช็คได้ว่าเหตุการณ์อยู่บนพื้นที่แบบไหน เช่นอยู่บนพื้นหญ้า อยู่บนพื้นทราย หรืออยู่ในน้ำโดยมันจะเก็บเป็นตัวแปรในในโปรแกรมซึ่งเราสามารถตรวจสอบมันได้จากคำสั่งตัวแปรหรือสคริป

เราจะรู้ได้ไงว่าพื้นที่ไหนเหตุการณ์ยืนอยู่เป็น terrain เท่าไรสามารถไปดูได้ที่นี่
[Image: w6ss1.png]


โดยตัวเลขเราสามารถกำหนด ได้ 0-7 (ปกติจะเป็น 0 ทั้งหมด) เราจะกำหนดว่าเทลเซตใดเป็น terrain อะไรก็ได้

ตัวอย่างการทำ terrain เช่น
เมื่อเดินบนทรายความเร็วจะลดลง
เมื่อเดินในบึงพิษหรือลาวาพลังจะลดลงเรื่อยๆ

วีธีการตรวจเช็ค terrain

ทำได้ 2 วิธีคือ
1.เช็คผ่านตัวแปร ดังรูป
[Image: 4mss2.png]
เราจะเช็คเหตุการณ์อื่นนอกจากฮีโร่ก็ได้

จากนั้นเราก็ใช้คำสั่ง "ตรวจเช็คเงื่อนไข" ว่าตัวแปร terrain นั้นตรงกับเลขอะไรถึงจะเกิดเหตุการณ์ที่เราต้องการ
[Image: uiss3.png]

2.เช็คผ่านสคริปในคำสั่ง "ตรวจเช็คเงื่อนไข"
Code:
$game_player.terrain_tag == xx
โดย xx คือหมายเลข terrain เพื่อเช็คว่าฮีโร่ยืนอยู่ที่ terrain นั้นหรือเปล่า

กรณีที่เป็นเหตุการณ์อื่นนอกจากฮีโร่จะใส่ว่า
Code:
$game_map.events[id เหตุการณ์].terrain_tag == xx
แทน

ต.ย.
http://www.mediafire.com/?ujjzddywnnw


Credit : shinryu
This post was last modified: 07-09-2012, 02:05 AM by LuZi.

[Image: 7f7cb68ce0.png][Image: rlogo.png]
Show ContentSpoiler:
Mysticphoenix   07-10-2012, 11:07 AM
#2
สามารถเอามาประยุกต์ทำระบบเจอมอนสเตอร์เฉพาะในหญ้าได้แบบโปเกมอนด้วย

คือตั้งcommon eventเช็คเนื้อเรื่องไว้ตลอด ถ้า $game_player.terrain_tag == 2 อะไรงี้ ให้ encounter enable ถ้าไม่ตรงให้ encounter disable

สามารถทำเบ็ดตกปลาได้ด้วย โดยเช็คดังนี้

ถ้าฮีโร่หันลง
Code:
$game_map.terrain_tag($game_variables[11], $game_variables[12]+1) == 3 && $game_map.terrain_tag($game_variables[11], $game_variables[12]+1) != 4

ถ้าฮีโร่หันขึ้น
Code:
$game_map.terrain_tag($game_variables[11], $game_variables[12]-1) == 3 && $game_map.terrain_tag($game_variables[11], $game_variables[12]-1) != 4

ถ้าฮีโร่หันซ้าย
Code:
$game_map.terrain_tag($game_variables[11]-1, $game_variables[12]) == 3 && $game_map.terrain_tag($game_variables[11]-1, $game_variables[12]) != 4

ถ้าฮีโร่หันขวา
Code:
$game_map.terrain_tag($game_variables[11]+1, $game_variables[12]) == 3 && $game_map.terrain_tag($game_variables[11]+1, $game_variables[12]) != 4

ให้ $game_variables[11] เป็นพิกัด x ของฮีโร่ และ $game_variables[12] เป็นพิกัด y ของฮีโร่
ให้ terrain tag 3 คือน้ำและ terrain tag 4 คือสะพาน (ในกรณีที่สะพานอยู่เหนือน้ำด้วย โปรแกรมจะได้รู้)
This post was last modified: 07-10-2012, 11:21 AM by LuZi.

[Image: webboard%20signature1_zpskhtut2jg.png]
การทำอาหารที่อร่อยที่สุด และเดือดร้อนชาวบ้านมากที่สุด กำลังจะเริ่มขึ้น
  
Users browsing this thread: 1 Guest(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.