import(Module_Map)
import(Module_Defines)
import(Module_DataTypes)
import(Module_Table)
import(Module_Objects)
import(Module_Globals)
import(Module_Commands)
import(Module_Players)

local ReincPos = {
  MAP_XZ_2_WORLD_XYZ(60, 26),
  MAP_XZ_2_WORLD_XYZ(32, 100),
  MAP_XZ_2_WORLD_XYZ(84, 84),
  MAP_XZ_2_WORLD_XYZ(120, 68),
  MAP_XZ_2_WORLD_XYZ(186, 134),
  MAP_XZ_2_WORLD_XYZ(166, 172),
  MAP_XZ_2_WORLD_XYZ(140, 212),
  MAP_XZ_2_WORLD_XYZ(216, 204)
}

local teamOne = {}
local teamTwo = {}

for i,k in ipairs(ReincPos) do
  local me = world_coord3d_to_map_ptr(k)
  me.MapWhoList:processList(function(t)
    if (t.Type == T_PERSON) then
      if (t.Model == M_PERSON_MEDICINE_MAN) then
        if (i <= 4) then
          table.insert(teamOne, t.Owner)
        else
          table.insert(teamTwo, t.Owner)
        end
      end
    end
    return true
  end)
end


for i, v in ipairs(teamOne) do
    for k, t in ipairs(teamOne) do
        set_players_allied(v, t)
    end
end

for i, v in ipairs(teamTwo) do
    for k, t in ipairs(teamTwo) do
        set_players_allied(v, t)
    end
end