idArray3 = $game_map.events.keys.find_all{|id| $game_map.events[id].name == '丧尸'}
#==============定义常量
if $hash_mun != 0
a_array = []
a_hash = {}
hash_a = {}
total_number = -1
array_number = -1
a_c = 0
$hash_mun = 0
end
#=============判定有多少不同的X
hash_many = idArray3.size
hash_many2 = hash_many - 1
#================生成X个数组
c2 = Array.new(hash_many){[]}
a2 = 0
b2 = 0
while a2 <= hash_many2
a2 = a2 + 1
c2[b2][0]
b2 = b2 + 1
end
#================全部X和id写入哈希表
#================a_hash为要压入的数组序号
for @event_id in idArray3
a_a = $game_map.events[@event_id].x
total_number = total_number + 1
a_hash[a_a] = total_number
end
#================================开始迭代
#========要压入两种数组,一个a_array总,一些若干真
for @event_id in idArray3
# 去除重复元素
a_array.uniq!
# 迭代delete指令
for a_e in 0..hash_many2
c2[a_e].delete(nil)
end
# 开始迭代
a_a = $game_map.events[@event_id].x
a_array_size = a_array.size
a_array_size = a_array_size - 1
array_number = array_number + 1
$array_number = $array_number + 1
#-----------------------如果数组有数就执行
if a_array_size != -1
for a_b in 0..a_array_size
# 确实相等的时候 # 所有都不对的时候
if a_a == a_array[a_b] then
# 压入数组
a_d = a_hash[a_a]
c2[a_d][$array_number] = @event_id
a_array[array_number] = a_a
total_number = -1
break
else a_a != a_array[a_b]
a_c = a_c + 1
if a_c == a_array_size + 1
a_c = 0
a_nothing = 0
end
end
end
# 在所有都不对的时候压入数组
if a_nothing == 0 then
# 压入数组
a_d = a_hash[a_a]
c2[a_d][$array_number] = @event_id
a_array[array_number] = a_a
total_number = -1
end
else
# 把第一个数压入数组
# a_array用来比较X的值,全部是X的值
a_array[array_number] = a_a
end