Auto-translated
By default, the console does not display the return value of functions; you need to wrap it in a print statement. Here's how it works for me:
@print(GetPlayerHeroes(PLAYER_1))
@print(GetPlayerHeroes(PLAYER_1))
New here? I'm Roha — want a quick tour?
In this example, startThreadOnce starts the function only if it is not already running. isFunctionRunning checks if the function is currently running.
local threads = {}
local startExec = function(func)
local threads = threads
errorHook(function()
%threads[%func] = nil
end)
threads[func] = 1
func()
threads[func] = nil
end
function startThreadOnce(func)
if not %threads[func] then
startThread(%startExec, func)
end
end
function isFunctionRunning(func)
return %threads[func]
end
Thank you. If the function returns an error, will it change its status to completed?
errorHook(function()
%threads[%func] = nil
end)
Where in the game files are the properties of skills and artifacts defined?
1) +5% if the hero and neutral creatures have the same alignment (good/evil – as in the calculation of Battle Spirit)
2) +5% if the hero and neutral creatures belong to the same castle
3) +5% if the hero's army contains the exact same creatures as the neutral army (regular and upgraded creatures are considered different)
4) +5% if the neutral creatures are regular creatures, and the hero's army contains their upgraded version (e.g., neutral creatures are peasants, and the hero's army contains militia)
5) +10% if the hero has the "Diplomacy" skill.
6) +20% if the hero has a specialization in creatures from the neutral army
if GetObjectOwner(hero) == 1 then
.....
end` The hero must be the first parameter of the function called by the trigger. For example: `function message(hero, region)`