Skip to content
User Avatar
#2075
Auto-translated
Jack_of_shadows
Abyss Knight, using additional flags. I used to do similar things like this (the code isn't complete, but it illustrates the principle):
-- table storing region names and visit flags
region_table =
{
{name = 'NAME_OF_THE_FIRST_REGION', visited = 0},
{name = 'NAME_OF_THE_SECOND_REGION', visited = 0},
...
};

-- initialization function
function RegionInit()
for i, region in region_table do
Trigger(REGION_ENTER_AND_STOP_TRIGGER, region.name, 'RegionVisit');
end
end

-- unified visit function
function RegionVisit(hero)
-- check which region we are in
for i, region in region_table do
if(IsObjectInRegion(hero, region.name)) then
Trigger(REGION_ENTER_AND_STOP_TRIGGER, region.name, nil);
region.visited = 1;
-- here you can do what you need, depending on the region number (variable i is the number in the region_table table)
end
end
end

-- returns true if the region with the name name has been visited
function IsRegionVisited(name)
for i, region in region_table do
if((region.name == name) and (region.visited == 1)) then
return true
end
end
return nil
end

I would never have come up with that myself, thank you so much!

I apologize, but what can I do, I'm just a newbie... My last question.

So, please tell me how to make it so that when all 5 regions from the table are visited, the quest to visit these regions is completed? I understand that this needs to be done using NEW_DAY_TRIGGER and startThread, but I don't have enough brainpower to figure out how to implement it all...

Statistics

Welcome our newest member: dylanyamaha