Project1
标题:
區域遇敵的缺陷
[打印本页]
作者:
ms0688987
时间:
2011-1-21 22:33
标题:
區域遇敵的缺陷
以下的區域遇敵有一個缺陷
Type==0的時候,獨立區域遇敵,一個區域只能遇一種敵人
如何修改成一個區域很多種敵人呢??
=begin
■ 区域遇敌-脚本版 By 茄子
联系QQ 9244579
轻松设置某个区域遇敌的敌人ID
在每个地图上放一个并行事件
事件内容为脚本(也就是设置该地图的敌人)
如:
Control_Enemys::RANGS = [
[1,[0,3],[0,3]],
数据分别为
[数据库里敌人队伍1,[起始X坐标0,目的X坐标3],[起始Y坐标0,目的Y坐标3]]
==>该敌人ID=1)<== ================>该敌人遇到的范围<=============
该ID是数据库中队伍的ID,不是敌人的ID。
遇敌概率还是在地图上设置
如果不需要区域遇敌,类型 0 = 单独区域遇敌, 1 = 区域遇敌+普通遇敌 , 2 = 普通遇敌
Control_Enemys::TYPE = 2
]
设置完后在最后需要设置现在地图原来的敌人编号
如:
原来地图设置敌人两个编号为 1 2 都是幽灵
Control_Enemys::OLD_ENEMYS = [1,2] 这样以便返回以前的敌人。
=end
module Control_Enemys
OLD_ENEMYS = [1,2]
RANGS = [
[1,[0,3],[0,3]],
[4,[16,19],[0,3]]
]
TYPE = 0
end
class Game_Player
attr_writer :encounter_count
end
class Game_Map
attr_writer :encounter_list
end
class Scene_Map
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if Control_Enemys::TYPE == 1
if $game_player.encounter_count == 0 and Control_Enemys::OLD_ENEMYS != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand(Control_Enemys::OLD_ENEMYS.size)
troop_id = Control_Enemys::OLD_ENEMYS[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
else
for i in Control_Enemys::RANGS
if $game_player.x >= i[1][0] and $game_player.x <= i[1][1] and
$game_player.y >= i[2][0] and $game_player.y <= i[2][1]
if $game_player.encounter_count == 0 and i[0] != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
enemys = []
enemys.push(i[0])
n = rand(enemys.size)
troop_id = enemys[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
end
if Control_Enemys::TYPE == 2
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
复制代码
作者:
qaz4633063
时间:
2011-1-22 02:57
提示:
作者被禁止或删除 内容自动屏蔽
作者:
ms0688987
时间:
2011-1-22 11:53
那個是敵人隊伍的ID
要變成一個區域多個敵人隊伍才對
上面打錯了不是多種是多個敵人隊伍
作者:
Wind2010
时间:
2011-1-22 12:04
=begin
■ 区域遇敌-脚本版 By 茄子
联系QQ 9244579
轻松设置某个区域遇敌的敌人ID
在每个地图上放一个并行事件
事件内容为脚本(也就是设置该地图的敌人)
如:
Control_Enemys::RANGS = [
[[1],[0,3],[0,3]],
数据分别为
[数据库里敌人队伍1,[起始X坐标0,目的X坐标3],[起始Y坐标0,目的Y坐标3]]
==>该敌人ID=1)<== ================>该敌人遇到的范围<=============
该ID是数据库中队伍的ID,不是敌人的ID。
遇敌概率还是在地图上设置
如果不需要区域遇敌,类型 0 = 单独区域遇敌, 1 = 区域遇敌+普通遇敌 , 2 = 普通遇敌
Control_Enemys::TYPE = 2
]
设置完后在最后需要设置现在地图原来的敌人编号
如:
原来地图设置敌人两个编号为 1 2 都是幽灵
Control_Enemys::OLD_ENEMYS = [1,2] 这样以便返回以前的敌人。
=end
module Control_Enemys
OLD_ENEMYS = [1,2]
RANGS = [
[[1],[0,3],[0,3]],
[[4,5],[16,19],[0,3]]
]
TYPE = 0
end
class Game_Player
attr_writer :encounter_count
end
class Game_Map
attr_writer :encounter_list
end
class Scene_Map
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if Control_Enemys::TYPE == 1
if $game_player.encounter_count == 0 and Control_Enemys::OLD_ENEMYS != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand(Control_Enemys::OLD_ENEMYS.size)
troop_id = Control_Enemys::OLD_ENEMYS[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
else
for i in Control_Enemys::RANGS
if $game_player.x >= i[1][0] and $game_player.x <= i[1][1] and
$game_player.y >= i[2][0] and $game_player.y <= i[2][1]
if $game_player.encounter_count == 0 and i[0] != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
enemys = []
if i[0].size == 1
enemys.push(i[0][0])
else
enemys.push(i[0][rand(i[0].size-1)])
end
n = rand(enemys.size)
troop_id = enemys[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
end
if Control_Enemys::TYPE == 2
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
复制代码
小改了一下,不知道行不行
作者:
ms0688987
时间:
2011-1-22 12:12
本帖最后由 ms0688987 于 2011-1-22 14:07 编辑
應該怎麼用呢?
是這樣[[1]+[2],[1,11],[6,6]],
還是[[1][2],[1,11],[6,6]],
還是[[1],[1,11],[6,6]],
[[2],[1,11],[6,6]],兩個同區域判定
可是都不行 同區域2個隊伍以上要怎麼設定???
作者:
Wind2010
时间:
2011-1-22 14:54
回复
ms0688987
的帖子
把我那个脚本的113行去掉,114行改成 troop_id = enemys[0]
作者:
ms0688987
时间:
2011-1-22 15:06
本帖最后由 ms0688987 于 2011-1-22 18:52 编辑
測試出來了
可是我用[[1,2,3,4],[1,11],[5,5]],
只會有1,2,3種怪遇的到
遇了10幾場沒半場4的隊伍
不知道是遇不到還是人品太差
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1