>VoDich<
Legend of Zelda
{@: AirShip
người request hơi nhìu mà lão dương dê chẳng thèm share, tui cũng chưa thấy cái airship bao giờ nhưng nghe tên gọi thì có vẻ là 1 cái thuyền bay,
thôi thì mấy bạn dùng tạm cái airship này vậy, có thể ko = của lão dương nhưng cũng ngon lành lắm
sử dụng 3 event chính:
- airport: dùng để hạ cánh hoặc leo lên airship
- ship_motion_controller : tạo 1 hiệu ứng nhỏ làm airship đong đưa lắc lư
- air_ship: nó đó
về mặt graphics bạn cần 4 hình airship với 4 direction (left,right,up,down) add vô Pictures Resource, 4 hình tiếp theo cho 4 cái bóng của airship theo 4 hướng cũng cho dzô Pictures Resource.
Ok, phần chi tiết xem demo nhé
giờ tới variables: sử dụng 6 variables
0001: ship_x
0002: ship_y
0003: ship_motion
0004: flag
0005: ship_motion2
0006: enter_ship
nếu ko sử dụng mặc định 6 variable đầu này thì bạn cần sửa lại các thứ tự variable cho đúng trong 3 event trên. chú ý, variable 6: enter_ship có sử dụng trong script, vì vậy nhớ thay đồi trong script lun (sửa chỗ nào thì xem tiếp)
tiếp theo là script, airship này có modify vài chỗ nhỏ trong 3 script (tôi có để dấu ** trong demo)
Game_Character 2
Game_Character 3
Game_Event
với 1 số bạn khi đem airship này vào game của mình thì có thể 3 script trên trong game của bạn đã có thể có sự thay đồi so với script mặc định. vì vậy tôi ko thể biết số dòng chính xác để có thể hướng dẫn thêm vào cho các bạn. hướng dẫn thêm vào sau cho script mặc định
---------------------------------------------
trong Game_Character 2 tìm dòng 81
thay =
--------------------------------------------
thay đồi trong Game_Character 3 thì hơi nhìu nên bạn cứ copy hết đoạn script này rùi paste dzô
-------------------------------------------------
tìm trong script Game_Event đến dòng 209
copy và paste đoạn code sau bên trên dòng 209
OK vậy là xong, tôi có gửi kèm demo (not encrypt) bạn mở demo ra vọc là hiểu cách thức nó hoạt động liền
Have fun!!!

:@}
người request hơi nhìu mà lão dương dê chẳng thèm share, tui cũng chưa thấy cái airship bao giờ nhưng nghe tên gọi thì có vẻ là 1 cái thuyền bay,
thôi thì mấy bạn dùng tạm cái airship này vậy, có thể ko = của lão dương nhưng cũng ngon lành lắm
sử dụng 3 event chính:
- airport: dùng để hạ cánh hoặc leo lên airship
- ship_motion_controller : tạo 1 hiệu ứng nhỏ làm airship đong đưa lắc lư
- air_ship: nó đó
về mặt graphics bạn cần 4 hình airship với 4 direction (left,right,up,down) add vô Pictures Resource, 4 hình tiếp theo cho 4 cái bóng của airship theo 4 hướng cũng cho dzô Pictures Resource.
Ok, phần chi tiết xem demo nhé
giờ tới variables: sử dụng 6 variables
0001: ship_x
0002: ship_y
0003: ship_motion
0004: flag
0005: ship_motion2
0006: enter_ship
nếu ko sử dụng mặc định 6 variable đầu này thì bạn cần sửa lại các thứ tự variable cho đúng trong 3 event trên. chú ý, variable 6: enter_ship có sử dụng trong script, vì vậy nhớ thay đồi trong script lun (sửa chỗ nào thì xem tiếp)
tiếp theo là script, airship này có modify vài chỗ nhỏ trong 3 script (tôi có để dấu ** trong demo)
Game_Character 2
Game_Character 3
Game_Event
với 1 số bạn khi đem airship này vào game của mình thì có thể 3 script trên trong game của bạn đã có thể có sự thay đồi so với script mặc định. vì vậy tôi ko thể biết số dòng chính xác để có thể hướng dẫn thêm vào cho các bạn. hướng dẫn thêm vào sau cho script mặc định
---------------------------------------------
trong Game_Character 2 tìm dòng 81
Mã:
distance = 2 ** @move_speed
thay =
Mã:
if $game_variables[6]==0 #thay số 6 thành variable bạn tự chọn cho (enter_ship)
@ship_speed=4 #tốc tộ mặc định của character là 4
else
@ship_speed=2 #tốc độ của airship
end
distance = 2 ** @ship_speed
thay đồi trong Game_Character 3 thì hơi nhìu nên bạn cứ copy hết đoạn script này rùi paste dzô
Mã:
#==============================================================================
# ■ Game_Character (分割定義 3)
#------------------------------------------------------------------------------
# キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
# クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ● 下に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# 下を向く
if turn_enabled
turn_down
end
#MODIFY-----------MODIFY--------------MODIFY
# tiny modify
if $game_variables[6]==0 #false thay số 6 thành variable bạn tự chọn cho (enter_ship)
if passable?(@x, @y, 2)
turn_down
@y += 1
increase_steps
else
check_event_trigger_touch(@x, @y+1)
end
else #enter ship
turn_down
@y += 1
increase_steps
end
#end
#MODIFY-----------MODIFY--------------MODIFY
end
#--------------------------------------------------------------------------
# ● 左に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# 左を向く
if turn_enabled
turn_left
end
#MODIFY-----------MODIFY--------------MODIFY
# tiny modify
if $game_variables[6]==0 #false thay số 6 thành variable bạn tự chọn cho (enter_ship)
if passable?(@x, @y, 4)
turn_left
@x -= 1
increase_steps
else
check_event_trigger_touch(@x-1, @y)
end
else #enter ship
turn_left
@x -= 1
increase_steps
end
#end
#MODIFY-----------MODIFY--------------MODIFY
end
#--------------------------------------------------------------------------
# ● 右に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# 右を向く
if turn_enabled
turn_right
end
#MODIFY-----------MODIFY--------------MODIFY
# tiny modify
if $game_variables[6]==0 #false thay số 6 thành variable bạn tự chọn cho (enter_ship)
if passable?(@x, @y, 6)
turn_right
@x += 1
increase_steps
else
check_event_trigger_touch(@x+1, @y)
end
else #enter ship
turn_right
@x += 1
increase_steps
end
#end
#MODIFY-----------MODIFY--------------MODIFY
end
#--------------------------------------------------------------------------
# ● 上に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# 上を向く
if turn_enabled
turn_up
end
#MODIFY-----------MODIFY--------------MODIFY
# tiny modify
if $game_variables[6]==0 #false thay số 6 thành variable bạn tự chọn cho (enter_ship)
if passable?(@x, @y, 8)
turn_up
@y -= 1
increase_steps
else
check_event_trigger_touch(@x, @y-1)
end
else #enter ship
turn_up
@y -= 1
increase_steps
end
#end
#MODIFY-----------MODIFY--------------MODIFY
end
#--------------------------------------------------------------------------
# ● 左下に移動
#--------------------------------------------------------------------------
def move_lower_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
# 座標を更新
@x -= 1
@y += 1
# 歩数増加
increase_steps
end
end
#--------------------------------------------------------------------------
# ● 右下に移動
#--------------------------------------------------------------------------
def move_lower_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
# 座標を更新
@x += 1
@y += 1
# 歩数増加
increase_steps
end
end
#--------------------------------------------------------------------------
# ● 左上に移動
#--------------------------------------------------------------------------
def move_upper_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
# 座標を更新
@x -= 1
@y -= 1
# 歩数増加
increase_steps
end
end
#--------------------------------------------------------------------------
# ● 右上に移動
#--------------------------------------------------------------------------
def move_upper_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
# 座標を更新
@x += 1
@y -= 1
# 歩数増加
increase_steps
end
end
#--------------------------------------------------------------------------
# ● ランダムに移動
#--------------------------------------------------------------------------
def move_random
case rand(4)
when 0 # 下に移動
move_down(false)
when 1 # 左に移動
move_left(false)
when 2 # 右に移動
move_right(false)
when 3 # 上に移動
move_up(false)
end
end
#--------------------------------------------------------------------------
# ● プレイヤーに近づく
#--------------------------------------------------------------------------
def move_toward_player
# プレイヤーの座標との差を求める
sx = @x - $game_player.x
sy = @y - $game_player.y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合
if abs_sx > abs_sy
# 左右方向を優先し、プレイヤーのいるほうへ移動
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# 縦の距離のほうが長い場合
else
# 上下方向を優先し、プレイヤーのいるほうへ移動
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
# ● プレイヤーから遠ざかる
#--------------------------------------------------------------------------
def move_away_from_player
# プレイヤーの座標との差を求める
sx = @x - $game_player.x
sy = @y - $game_player.y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 差の絶対値を求める
abs_sx = sx.abs
abs_sy = sy.abs
# 横の距離と縦の距離が等しい場合
if abs_sx == abs_sy
# ランダムでどちらかを 1 増やす
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# 横の距離のほうが長い場合
if abs_sx > abs_sy
# 左右方向を優先し、プレイヤーのいないほうへ移動
sx > 0 ? move_right : move_left
if not moving? and sy != 0
sy > 0 ? move_down : move_up
end
# 縦の距離のほうが長い場合
else
# 上下方向を優先し、プレイヤーのいないほうへ移動
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
#--------------------------------------------------------------------------
# ● 一歩前進
#--------------------------------------------------------------------------
def move_forward
case @direction
when 2
move_down(false)
when 4
move_left(false)
when 6
move_right(false)
when 8
move_up(false)
end
end
#--------------------------------------------------------------------------
# ● 一歩後退
#--------------------------------------------------------------------------
def move_backward
# 向き固定の状態を記憶
last_direction_fix = @direction_fix
# 強制的に向き固定
@direction_fix = true
# 向きで分岐
case @direction
when 2 # 下
move_up(false)
when 4 # 左
move_right(false)
when 6 # 右
move_left(false)
when 8 # 上
move_down(false)
end
# 向き固定の状態を元に戻す
@direction_fix = last_direction_fix
end
#--------------------------------------------------------------------------
# ● ジャンプ
# x_plus : X 座標加算値
# y_plus : Y 座標加算値
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
# 加算値が (0,0) ではない場合
if x_plus != 0 or y_plus != 0
# 横の距離のほうが長い場合
if x_plus.abs > y_plus.abs
# 左右どちらかに向き変更
x_plus < 0 ? turn_left : turn_right
# 縦の距離のほうが長いか等しい場合
else
# 上下どちらかに向き変更
y_plus < 0 ? turn_up : turn_down
end
end
# 新しい座標を計算
new_x = @x + x_plus
new_y = @y + y_plus
# 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
# 姿勢を矯正
straighten
# 座標を更新
@x = new_x
@y = new_y
# 距離を計算
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
# ジャンプカウントを設定
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
# 停止カウントをクリア
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# ● 下を向く
#--------------------------------------------------------------------------
def turn_down
unless @direction_fix
@direction = 2
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# ● 左を向く
#--------------------------------------------------------------------------
def turn_left
unless @direction_fix
@direction = 4
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# ● 右を向く
#--------------------------------------------------------------------------
def turn_right
unless @direction_fix
@direction = 6
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# ● 上を向く
#--------------------------------------------------------------------------
def turn_up
unless @direction_fix
@direction = 8
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# ● 右に 90 度回転
#--------------------------------------------------------------------------
def turn_right_90
case @direction
when 2
turn_left
when 4
turn_up
when 6
turn_down
when 8
turn_right
end
end
#--------------------------------------------------------------------------
# ● 左に 90 度回転
#--------------------------------------------------------------------------
def turn_left_90
case @direction
when 2
turn_right
when 4
turn_down
when 6
turn_up
when 8
turn_left
end
end
#--------------------------------------------------------------------------
# ● 180 度回転
#--------------------------------------------------------------------------
def turn_180
case @direction
when 2
turn_up
when 4
turn_right
when 6
turn_left
when 8
turn_down
end
end
#--------------------------------------------------------------------------
# ● 右か左に 90 度回転
#--------------------------------------------------------------------------
def turn_right_or_left_90
if rand(2) == 0
turn_right_90
else
turn_left_90
end
end
#--------------------------------------------------------------------------
# ● ランダムに方向転換
#--------------------------------------------------------------------------
def turn_random
case rand(4)
when 0
turn_up
when 1
turn_right
when 2
turn_left
when 3
turn_down
end
end
#--------------------------------------------------------------------------
# ● プレイヤーの方を向く
#--------------------------------------------------------------------------
def turn_toward_player
# プレイヤーの座標との差を求める
sx = @x - $game_player.x
sy = @y - $game_player.y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
if sx.abs > sy.abs
# 左右方向でプレイヤーのいるほうを向く
sx > 0 ? turn_left : turn_right
# 縦の距離のほうが長い場合
else
# 上下方向でプレイヤーのいるほうを向く
sy > 0 ? turn_up : turn_down
end
end
#--------------------------------------------------------------------------
# ● プレイヤーの逆を向く
#--------------------------------------------------------------------------
def turn_away_from_player
# プレイヤーの座標との差を求める
sx = @x - $game_player.x
sy = @y - $game_player.y
# 座標が等しい場合
if sx == 0 and sy == 0
return
end
# 横の距離のほうが長い場合
if sx.abs > sy.abs
# 左右方向でプレイヤーのいないほうを向く
sx > 0 ? turn_right : turn_left
# 縦の距離のほうが長い場合
else
# 上下方向でプレイヤーのいないほうを向く
sy > 0 ? turn_down : turn_up
end
end
end
tìm trong script Game_Event đến dòng 209
Mã:
def update
super
# 自動イベントの起動判定
copy và paste đoạn code sau bên trên dòng 209
Mã:
def update_move
distance = 2 ** @move_speed
if @y * 128 > @real_y
@real_y = [@real_y + distance, @y * 128].min
end
if @x * 128 < @real_x
@real_x = [@real_x - distance, @x * 128].max
end
if @x * 128 > @real_x
@real_x = [@real_x + distance, @x * 128].min
end
if @y * 128 < @real_y
@real_y = [@real_y - distance, @y * 128].max
end
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
OK vậy là xong, tôi có gửi kèm demo (not encrypt) bạn mở demo ra vọc là hiểu cách thức nó hoạt động liền
Have fun!!!

:@}
share tại chỗ, kô encrypt, hướng dẫn dễ hiểu
, ông Ken cũng 1987 như tui thoai 