Announcement

Collapse
No announcement yet.

Geeting the x and Y of a location

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

  • Geeting the x and Y of a location

    How is it possible to get the x and y coordinates of a location and assign them to a variable? I have tried to use location.x and location.y (even location.location), but everytime I use these, CTP2 says "Location is not a structure".

    I did a search trough the CTP2 directory and mods and there is not a single line of code that uses location.x or .y. The disasters mod gets the X and Y by using Random(tmpX) and then assigning tmpX to another variable -- pretty clever.

    But if you want a city's x and y location you can't use city[0].location.x and city[0].location.y

    How do you get these values?

  • #2
    IIRC, you have to have the location variable first: either a builtin "location[0]" or a user defined "tmpLoc" and then use "location[0].x" or "tmploc.x" So try "location[0]=city[0].location;"

    BTW, at the time of this post, 6 people have previously viewed this thread. Are there really that many lurkers out there interested in such obscure subjects? If so, more posters are always welcome.

    Comment


    • #3
      Oh, I forgot the '[0]'. Sometimes you work a problem so much you lose all perspective and someone else has to come along and tell you what you're overlooking.

      Thanks, Peter.

      Comment

      Working...
      X