Auto-translated
Hello. Maybe someone can help me with the script and suggest the right solution:
Basically, there is a certain group of creatures that need to be destroyed as part of a task. At the same time, on a specific game day, a check needs to be performed to see if they still exist, in order to indicate whether the task has been completed or not. And if some of these creatures are still on the map, they should be transferred to the army of a specific hero. I know that something similar was implemented in the first mission of Frida's campaign, but unfortunately, I don't understand how it was done there.
Okay, I don't know what your general knowledge of scripts is, so I'll try to explain it simply:
First, you need to assign script names to the required units in the editor and configure them so that they reliably join the heroes of the player you need (the necessary items are highlighted in the screenshot).
Then, in the script, for convenience, create a table through which the presence of units on the map will be determined:
stacks = {'script_name_of_unit_1', 'script_name_of_unit_2'... and so onThen, use a new day trigger to check for the existence of units daily:
function NewDay()
if GetDate(DAY) == 'day when the check needs to be performed' then
-- then check for the existence of units and transfer them to the desired hero
for i, stack in stacks do
if IsObjectExists(stack) then
MakeHeroInteractWithObject('Script_name_of_the_desired_hero', stack)
end
end
end
end
Trigger(NEW_DAY_TRIGGER, 'NewDay')
Нет войне.