| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 8 |
| 经验 | |
| 最后登录 | 2026-9-30 |
| 在线时间 | 81 小时 |
- 梦石
- 0
- 星屑
- 787
- 在线时间
- 81 小时
- 注册时间
- 2025-7-10
- 回帖
- 6
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
用deepsick写的两个脚本,感觉用处不大,也不知道有没有和其他人写的重复,总之顺手分享出来了。
区域速度
[pre lang="ruby"]class Game_Player < Game_Character
RUN_SWITCH_ID = 1
# 设置不同区域的速度限制
# 格式:区域ID => 最大允许速度
REGION_SPEED_LIMITS = {
1 => 3, # 区域1:慢速行走(如沼泽)
2 => 4, # 区域2:正常速度(禁止奔跑)
3 => 4, # 区域3:正常速度(禁止奔跑)
4 => 3, # 区域4:慢速行走
5 => 2 # 区域5:极慢速度(如深水)
}
alias region_speed_update update
def update
region_speed_update
update_speed_with_region_limits
end
def update_speed_with_region_limits
current_region_id = $game_map.region_id(@x, @y)
# 如果当前区域有速度限制
if REGION_SPEED_LIMITS.has_key?(current_region_id)
max_speed = REGION_SPEED_LIMITS[current_region_id]
@move_speed = [@move_speed, max_speed].min
# 如果没有区域限制且奔跑开关为ON,则奔跑
elsif $game_switches[RUN_SWITCH_ID]
@move_speed = 5 # 奔跑速度
else
@move_speed = 4 # 正常速度
end
end
end[/pre]
区域开关
[pre lang="ruby"]class Game_Player < Game_Character
alias region_switch_update update
def update
region_switch_update
check_region_switch
end
def check_region_switch
region_id = $game_map.region_id($game_player.x, $game_player.y)
# 当进入区域ID为5时,打开开关10
if region_id == 5
$game_switches[10] = true
end
# 当进入区域ID为7时,打开开关15
if region_id == 7
$game_switches[15] = true
end
end
end[/pre] |
|