Welcome

Please register for Total War Access to use the forums. If you're an existing user, your forum details will be merged with Total War Access if you register with the same email or username. For more information please read our FAQ’s here.

Categories

How to identify military forces in certain region?

ProvincianProvincian Registered Users Posts: 1
I tried to look for the way how to identify military forces in certain region but , as I thought, no interface btw region_manager & military_force_interface exists.

Algorithm which I think is as follows:

============================


for i=0, cm:query_model():world():region_manager():region_list():num_items() - 1 do



    local current_region= region_list:item_at(i);



    for j=0, cm:query_model():world():faction_list():num_items() - 1 do



        local current_faction= faction_list():item_at(i);

        local military_force_visited = {};



        for k=0, current_faction:character_list():num_items() - 1 do



            local current_character = character_list():item_at(i);

            local current_military_force = current_character:military_force();



            if military_force_visited[current_military_force] != nil then

                military_force_visited[current_military_force]=1;

            else

                continue;

            end ;



            --[[



            I will do something in this block using

            current_military_force

            here.

            ]]--



        end

    end

end


============================

But it looks like inefficient, slow; it has triple loop and if-else is nested.

Is there other ways to figure out what military_force in certain region?
Sign In or Register to comment.