Announcement

Collapse
No announcement yet.

How to make regions work.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make regions work.

    Hi guys, well here I go explaning how to make regions work and what will cause regions not to work.

    Code:
            119,108 y1
             \--\
              \  \
    x1,114,115 \  \119,115 x2
                \  \
                 \  \
                  \__\
              114,123 y2
    region showme [114,108,119,123];
    // example[x1=114,y1=108,x2=119,y2=123]
    the above example is only to make it more clear to all of you.

    Now you have a region called show me. The above diagram demonstrates how the parameters must be entered. It will not work if you reverse the order of the cooridinates entered.

    Here's a more detailed example of what all the syntax means.
    Code:
              
            119,108 
            \--\
             \  \
     (114),115\  \ 119,115 
               \  \
                \  \
                 \__\
             (114),123
    region point [114,108,119,123];
    // example
    [x1,114,y1,108,x2,119,y2,123];

    In ctp x cooridinates run diagonal.
    Y coordinates run horizontal.
    So x1 to x2 shows how wide your parallelogram is going to be and y1, to y2 show how high it will be. So X1 will run diagonally down the hex coordinates x114 from y108 to y123 and x119 will run from y108 to y123.

    I have created all kinds of different shaped parallelograms including straight lines only one hex wide and it worked!!!!!


    Now there is a catch. And here we go.

    Code:
              
            5,108 
            \--\
             \  \
       114,115\  \ 5,115 
               \  \
                \  \
                 \__\
                 114,123
    Region wontwork [114,108,5,123];

    Regions will not work if it overlaps the start of the map cooridinate x0.

    Since the above region does have coordinates with the x0 coordinate between them.([x,114,108,x,5,123]), this will not work. So you must be careful and remember this otherwise you should have no problems making your own regions.

    Now there is one more thing.

    I do not believe that the complex region thingy works. I have made several different attempts with no success. The reason I think this is because when I used a complex region name in the function
    isinregion(unit.location,complexregionname);
    it would always kick me back to the desktop and say invalid argument in isinregion function.

    Well that's it I think. Hope this is a clear enough explanation about the mysteries of the activision ctp region.

    Hey maybe someone can create a bermuda triangle thingy in a game, so if units go in they don't come out.



    ------------------
    Gemini

  • #2
    Very useful info, gemini. It'll come in handy some day.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment

    Working...
    X