Please advise. I have many identical objects on the map, and a hero can buy creatures from them using a script. The object names are "dw1", "dw2", "dw3", etc. Can I assign the same trigger to them so that the function receives the object number as a parameter, represented as a number, when the hero enters. Then, I can define the type, quantity, and cost of creatures for each object using an array.for i=1,15 do
Trigger(OBJECT_TOUCH_TRIGGER,"dw"..i,"dwellingF")
end;
cr_count={10,30,20.....20}
cr_type={92,94,96.....105}
cr_cost={20,40,80.....1000}
function dwellingF(hero, obj_name)
n=<how do I get the object number here?>
AddHeroCreatures(hero,cr_type[n],cr_count[n])
SetPlayerResource(1,GOLD,GetPlayerResource(1,GOLD)-cr_count[n]*cr_cost[n]);
end;
for i=1,15 do
if obj_name=="dw"..i then
n=i
end
end
Added 4 minutes later
That is, should all the skills necessary for it be present? And is there any way to do it without that?
consoleCmd('enable_cheats')
consoleCmd('add_skill 98')