It's a pity that the custom script editor complains about the "%" symbol.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
New here? I'm Roha — want a quick tour?
It's a pity that the custom script editor complains about the "%" symbol.
while GetLastSavedCombatIndex() == combat_index do
sleep()
end change during simultaneous turns?
For example, if two players are conducting battles at the same time, the hero might still be in combat, but the index has already changed. As a result, he might lose, but the function will return that he is still alive.
Therefore, it would be desirable to call the function only at the end of the battle.
local wrapStartCombat = StartCombat
function StartCombat(hero, enemy, stacks, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18)
%wrapStartCombat(hero, enemy, stacks, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18)
local combat_index = GetLastSavedCombatIndex()
while 1 do
if GetLastSavedCombatIndex() ~= combat_index then
if GetSavedCombatArmyHero(combat_index, 0) ~= hero and GetSavedCombatArmyHero(combat_index, 1) ~= hero then
combat_index = GetLastSavedCombatIndex()
else
break
end
end
sleep()
end
local result = IsHeroAlive(hero)
return result
end
StartCombat(hero, nil,4,CREATURE_FIRE_ELEMENTAL,5, CREATURE_WATER_ELEMENTAL,5, CREATURE_EARTH_ELEMENTAL,5, CREATURE_AIR_ELEMENTAL,5,nil,'NHF_Touch_hero_treasury_reward_F("'..hero..'","'..MASS.. '","'..NHF_mass_CYCLOPS_STOCKPILE.variant1.treasury.spell[1]..'")',nil,not nil);Manually convert the array into its string representation.
Added 32 seconds ago
Does the method mentioned above work?
Added 38 seconds ago
Converting arrays to strings is a complex and slow operation.
Remind me, please, what advantage does using % before a variable give?
And is it possible to pass the MASS array somehow? The console complains that it is not allowed.
You can also place it before the names of global variables and passed parameters so that the function uses the variable as a constant (i.e., subsequent changes to the variable's value will not affect the function's operation).
Alternatively, you can pass it through a global variable.
Options:
Also, when upgrading creatures or taking them from a garrison, the change in available authority is not taken into account, so the hero can gather an army larger than what his authority allows.