Auto-translated
It worked! And it also works with the mod! Thank you very much!
Added 22 hours 28 minutes ago
One more thing, if I want to place several of these units on the map, do they all need their own names and their own function? I tried simply placing another unit with the same name, but the script only works when the first one is killed.
The 'Name' parameter must be unique for each object.
If the functionality after victory is always the same (give the hero 999999999 experience), then it is enough to number the names of all the units (UnitExp1, UnitExp2, UnitExp3, etc.) and place the line with the trigger Trigger(OBJECT_TOUCH_TRIGGER, "UnitExp", "FightUnitExp") in a for loop.
for i = 1,5 do --5 for 5 objects
Trigger(OBJECT_TOUCH_TRIGGER, "UnitExp"..i , "FightUnitExp")
end
Now, each object with the name UnitExp from 1 to 5 will have a trigger that, when touched, will launch the FightUnitExp function