I don't remember being asked to write a script, but my idea is generally similar to Jewill's script. Only, I'm not a very good programmer (I don't really understand tables; 2D arrays are closer to me). It should be taken into account that there are also weeks of mining 2x (wood + ore), as well as the same for Sulfur + Mercury and Crystals + Gems, the names of which I don't remember. And another week for gold.
Added 3 hours 6 minutes ago
You can also do this using a while 1 do loop. Where mines that don't pass the check for the presence of creatures become neutral.
Added 18 minutes ago--Name all mines with the same name plus a number starting from 1 and onwards: For example, mine1, mine2, mine3, mine4, etc.
while 1 do
sleep(10);
for i = 1,"number of mines on the map" do --"number of mines on the map" replace with the number
if GetObjectCreatures("mine"..i,"creature ID") == 0 and GetObjectOwner("mine"..i) ~= 0 then --replace "creature ID" with the desired creature ID
SetObjectOwner("mine"..i,0);
end;
end;
end;
Added 1 hour 2 minutes ago
However, something is needed to stop the mine from becoming neutral when a hero captures it and places creatures in the garrison. Otherwise, the mine will become neutral, and you will have to fight these creatures. Something like a region around the active tile of the mine and a condition that if there is no hero in the region, then SetObjectOwner("mine"..i,0) is executed. But I think there is a better idea, but it doesn't come to mind yet.
Perhaps a multithreaded approach is an option, but I don't quite understand how to implement it here. Besides, for some reason, I think that any script with a dozen threads is monstrous.
If the person who asked the question doesn't have knowledge of scripts, a multithreaded approach (which needs to be stopped and started at the right time) will ruin all desire to work on the map, in my opinion.
In your example, it would be great to implement stopping the thread and checks based on interaction with the mine, but there is no event for completing the interaction, i.e., closing the modal window with the garrison.
Added 20 hours 7 minutes ago
Hello everyone!
I have repeatedly read that TalkBoxForPlayers breaks saves in Multiplayer. And just as many times I have read that it does not break them.
Is there any truth to this? And if it does break them, does anyone know the approximate reason?
I'm not hoping for a solution :)
Because it's a great tool.
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!
Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.