Code:
!?FU701;
** x1 = new type (140 = boars, 112 = Air Elemental)
** [Algor: add check for empty slots and same type of monsters]
!!UN:U17/-1/-1/600; [get dwelling location into v600-v602]
!!DW600:M0/?y1/d M1/?y2/d M2/?y3/d M3/?y4/d; [get y1-y4 type in slot 0-3]
!!MA:Ly1/?y5; // get monster Level in slot 0
!!FU|y5=0/y1=x1/y2=x1/y3=x1/y4=x1:E; // exit for lelel 1 monsters or if monsters in any slot are the same type
!!DW600&y2>-1/y3>-1/y4=-1:M3/x1/12; [12 boars / Air Elementals in slot 3]
!!DW600&y2>-1/y3=-1:M2/x1/12; [12 boars / Air Elementals in slot 2]
!!DW600&y2=-1:M1/x1/12; [12 boars / Air Elementals in slot 1]
** end of function