Skip to content
User Avatar
#3782
Auto-translated

When initializing each region in the list, a function is created on the spot for it, which will be called by the trigger. For the function, the name of the region is written into a local variable using upvalues. After that, you can perform any actions with the region's name (and, accordingly, its properties) and the hero.

regions = {
list = {
["Region123"] = {active=nil, activator=nil},
...
},

init = function()
for region, props in regions.list do
regions.list[region].enter = function(hero)
local reg = %region
regions.list[reg].active = 1
regions.list[reg].activator = hero
-- Actions with the region, access to whose properties can be found by the local name reg
end
Trigger(REGION_ENTER_AND_STOP_TRIGGER, region, "regions.list['"..region.."'].enter")
end
end,
}

regions.init()
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________