encounter_list = $game_map.encounter_list encounter_list.clear $game_map.encounter_list.push(2) $game_map.encounter_list.push(3)
无忧谷主幻 发表于 2025-10-22 04:00
3,如果以上皆不愿的话
encounter_list = $game_map.encounter_list
encounter_list.clear

class Game_Map def encounter_list return [] if (f=@map.encounter_list).empty? tag = 1.to_s return f.find_all{|i| $data_troops[i].name[/【(\d+)】/] ; ($1.nil? or $1 == tag)} end end
灯笼菜刀王 发表于 2025-10-22 11:59
class Game_Map
def encounter_list
return [] if ([email protected]_list).empty?
123.jpg (185.01 KB, 下载次数: 80)
傀儡马夫 发表于 2025-10-26 13:17
大佬,您说的这个我大概理解意思了,可能我的思路有点窄,假如是大地图遇敌普通的怪,地图中这一个区域要 ...
class Game_Player def tag_set(ary) (@tag_list = nil ;return) if ary.nil? @tag_list = ary end alias old_increase_steps increase_steps def increase_steps #[id,x1,y1,x2,y2] old_increase_steps return if @tag_list.nil? or @tag_list.empty? f = @tag_list.find{|j| @x >= j[1] && @x <= j[3] && @y >= j[2] && @y <= j[4]} $game_variables[10086] = f.nil? ? 0 : f[0] end end class Interpreter def 区域设置(*ary) ($game_player.tag_set(nil)) if ary[0] == nil $game_player.tag_set(ary) end end
灯笼菜刀王 发表于 2025-10-27 10:29
栗子, 比如你想要 A区域出现 幽灵 , B区域出现 丧尸, 那, 在数据库建两个敌群, 起名为 ”【0】幽灵“ ...
#范围暗雷遇敌 #2018/10/5 By真可乐 #配置步骤 #创建配置事件 # 在地图上放置一个事件 # 事件名称设置为:/encounter_list # 在事件的第一页中,选择“注释”命令 # 在注释框中输入配置信息 # 每行一个敌群区域配置 # 支持多个敌群在不同区域同时生效 # # 例子 ,在地图的x坐标2到12,y坐标3到13区域内遇到敌群15,t[15]r[2,12,3,13] #====================================================================================================================================================== module RangEncounter RANG_EC = 46 #几号开关控制范围暗雷遇敌开启,默认设置为46号 end class Game_Event attr_reader :event end class Rang_Troop #范围遇敌队伍 attr_reader :troop_id attr_reader :xmax attr_reader :xmin attr_reader :ymax attr_reader :ymin def initialize(troop_id,xmin,xmax,ymin,ymax) @troop_id = troop_id ; @xmax = xmax ; @xmin = xmin ; @ymax = ymax ;@ymin = ymin end end class Game_Map #-------------------------------------------------------------------------- # * 先阉掉原来的遇敌 #-------------------------------------------------------------------------- def encounter_list return ($game_switches[RangEncounter::RANG_EC] ? [] : @map.encounter_list) end alias setup_zcl20181005 setup def setup(map_id) setup_zcl20181005(map_id) @encounter_list_range = Array.new @events.values.each do |ev| if ev.event.name == "/encounter_list" @encounter_list_range = get_troop(ev) #以检索到的首个为准 break end end end def get_troop(ev) return [] unless ev.is_a?(Game_Event) return [] if ev.list.nil? encounter = [] for i in 0...ev.list.size next if ev.list[i].code != 108 pa = ev.list[i].parameters[0] /(t\[(.*)\])/ =~ pa next if $1.nil? troop = $1.delete("t[").delete("]").to_i unless $1.nil? /(r\[(.*)\,(.*)\,(.*)\,(.*)\])/ =~ pa # rang = [$2.to_i,$3.to_i,$4.to_i,$5.to_i] next if $1.nil? or $2.nil? or $3.nil? or $4.nil? or $5.nil? encounter.push(Rang_Troop.new(troop,$2.to_i,$3.to_i,$4.to_i,$5.to_i)) end return encounter end #-------------------------------------------------------------------------- # * 再定义一个新的遇敌列表 #-------------------------------------------------------------------------- def encounter_list_range return @encounter_list_range end end class Scene_Map alias update_zcl20181005 update def update update_zcl20181005 # If encounter list isn't empty, and encounter count is 0 if $game_player.encounter_count == 0 and $game_map.encounter_list_range != [] and $game_switches[RangEncounter::RANG_EC] # If event is running or encounter is not forbidden unless $game_system.map_interpreter.running? or $game_system.encounter_disabled or (tr = confirm_troop).nil? troop_id = tr.troop_id # If troop is valid if $data_troops[troop_id] != nil # Set battle calling flag $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 def confirm_troop p_x = $game_player.x p_y = $game_player.y str = Array.new $game_map.encounter_list_range.each do |tr| next unless tr.is_a?(Rang_Troop) if p_x >= tr.xmin and p_x <= tr.xmax and p_y >= tr.ymin and p_y <= tr.ymax str.push(tr) end end return nil if str.empty? return str[rand(str.size)] end end
真·可乐 发表于 2025-10-28 12:01
写过一个类似的,范围暗雷遇敌。
#范围暗雷遇敌
#2018/10/5 By真可乐

灯笼菜刀王 发表于 2025-10-27 10:29
栗子, 比如你想要 A区域出现 幽灵 , B区域出现 丧尸, 那, 在数据库建两个敌群, 起名为 ”【0】幽灵“ ...
灯笼菜刀王 发表于 2025-10-27 10:29
栗子, 比如你想要 A区域出现 幽灵 , B区域出现 丧尸, 那, 在数据库建两个敌群, 起名为 ”【0】幽灵“ ...
灯笼菜刀王 发表于 2025-10-27 10:29
栗子, 比如你想要 A区域出现 幽灵 , B区域出现 丧尸, 那, 在数据库建两个敌群, 起名为 ”【0】幽灵“ ...
| 欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |