Skip to content

Current questions and answers regarding the map editor.

User Avatar
#5593
Auto-translated
}{0TT@6bI4
I asked my friend Dolgiy to write a script.
I don't remember being asked to write a script, but my idea is generally similar to Jewill's script. Only, I'm not much of a programmer (I don't really understand tables; 2D arrays are closer to my understanding). 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
Jewill
This is sad, although logical. I just think that these manipulations with subtraction are not the right solution.
Although, based on my personal experience and the experience of this entire thread, sometimes there is no right solution, or rather, there is, but it is not feasible.
In any case, thank you, I won't waste time trying to bypass the Nival events.
You can also do this with 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 --Replace "number of mines on the map" 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.