Posts from How do you create monsters by combining multiple creatures?
You place any unit on the map (for example, an archer), select it, then in the table on the left, there is a setting called "AdditionalStacks". Click on it with the left mouse button, press "add", then click on the plus signs that appear, and then choose who will be in the squad with the archers.
CreateCaravan('random_caravan_1',PLAYER_2,GROUND,2,2,GROUND,2,3)
for i=1,3 do
creature=random(115)+1
count=random(99)+1
CreateMonster('monster'..i,creature,count,4,4,GROUND,MONSTER_MOOD_AGGRESSIVE,MONSTER_COURAGE_CAN_FLEE_JOIN)
AddObjectCreatures('random_caravan_1',creature,count)
SetObjectEnabled('monster'..i,nil)
SetDisabledObjectMode('monster'..i,DISABLED_INTERACT)
SetObjectPosition('monster'..i,(96+i/3),96,GROUND)
Trigger(OBJECT_TOUCH_TRIGGER,'monster'..i,'fight_caravan_1')
end
function fight_caravan_1(hero)
for i=1,3 do
RemoveObject('monster'..i)
end
MakeHeroInteractWithObject(hero,'random_caravan_1')
end
It looks a bit strange because the coordinates in SetObjectPosition('monster'..i,(96+i/3),96,GROUND) cause two monsters to appear in the same place, and they overlap. You can, of course, arrange them as you like, in a square, or in a line, but just not in one point (it won't work). You can avoid the hassle of arranging the units and simply place the caravan filled with random monsters at the desired coordinates.
I suspect that there is a way to attach a combat script and arrange the random monsters on the battlefield, but in any case, the main question is how to display a composite unit on the adventure map.
And yes, if anyone doesn't understand how this script works, feel free to ask, I'll explain it line by line
Added 1 minute ago
Medyan, did you manage to do this in Heroes of Might and Magic V? As far as I know, there is only a script for creating a single monster, and you can only add to neutral units those creatures that they already have, so you cannot assemble a composite unit using scripts.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
AddObjectCreatures(mob, stype, snum)
and the function description states that only units of the same type can be added to a mob. Is the description incorrect? Or am I missing something?
I wonder, if a mob initially consists of creatures of different types, will it then be possible to add any creature? I'll try it when I get home.
Added 13 minutes later
You can add any creature from the existing units to a composite army, as well as a new one, if there is a free slot.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In the RM mod, there's a script that replaces regular random units with composite ones.