Skip to content

Current questions and answers regarding the map editor.

User Avatar
#935
Auto-translated
function Sera_Gold(hero)
if GetObjectOwner(hero)==1 then
if GetPlayerResource(1,SULFUR) > 19 then
SetPlayerResource(1,GOLD,GetPlayerResource(1,GOLD)+1000);
SetPlayerResource(1,SULFUR,GetPlayerResource(1,SULFUR)-20);
Trigger(OBJECT_TOUCH_TRIGGER,hut_name, nil);
end;
end;
end;
SetObjectEnabled(hut_name, nil);
Trigger(OBJECT_TOUCH_TRIGGER,hut_name, "Sera_Gold");
However, in this case, I would use the built-in functions of the hut: it has an assignment editor in the ObjectPropertiesTree, and you can create an assignment to collect resources in exchange for another resource. This method is good because the entire script is already written, and when you enter the hut, a beautiful window with pictures appears.
 

К А
Стикеры GBF в Telegram