Skip to content
User Avatar
#3941
Auto-translated
LetoX
I don't quite understand this part -

for i=0,6 do
local type, num = GetObjectArmySlotCreature("ritual", i)
if (type >= 30 and type <= 42 and mod(type, 2) == 0) or (type >= 152 and type <= 158) then
startThread(NecroRitual)
SetObjectOwner("ritual", PLAYER_2)
end
end.

and then in the ritual function -

for i=0,6 do
local type, num = GetObjectArmySlotCreature("ritual", i)
if GetObjectArmySlotCreature("ritual", i) == 30 then
RemoveObjectCreatures('ritual', type, num, i) ...

Why are you setting the hero as the owner for each slot? Ideally, this could be done outside the loop. And why are you starting a new thread for each slot? I haven't run the script, but it looks like you're starting 2 threads for two slots that run in parallel (sort of), and when the processing of the second cycle in the ritual function goes through all the slots again, the first slot hasn't been cleared yet (by the first thread). It seems that if you remove the loop in the function or remove the duplicated threads, everything should work.
I don't understand these scripts very well myself, so I probably did it twice.
LetoX

Like this:

MakeHeroInteractWithObject(hero, "ritual")
sleep(10)
startThread(NecroRitual)
SetObjectOwner("ritual", PLAYER_2)
local x,y = GetObjectPosition(Hero) ...
Also, this is purely aesthetic, but since you're taking the hero's name from the function, why are you writing "Hafad" in other places?
Well, it's just that Hafad is the one who should perform the ritual and receive the troops; no one else has this ability, and I left the hero's name from the function in other places.


Added 44 seconds ago
Right now, I'm tinkering with the Redhaven script for turning ordinary people into green ones. This is quite a challenge...

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники