Author Topic: Adding custom cities?  (Read 4750 times)

Offline mauirixxx

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Adding custom cities?
« on: February 05, 2018, 11:15:47 am »
Aloha, a few years ago a made a tiny mod that add's 3 cities in the Hawaiian islands chain, and it worked.

After a few years, I'm back and am looking to play with my 3 cities in Hawaii, but while the mod appears, it doesn't seem to actually DO anything :(

Here's what I did (and worked circa 2014). I'm using the 1.0 "nightly" release downloaded 2-3 days ago.

Code: [Select]
# Ruleset to add new cities to the geoscape map

regions:
  - type: STR_PACIFIC
    cities:
      - name: STR_HONOLULU
        lon: 207.074
        lat: -21.3902
      - name: STR_LIHUE
        lon: 205.479
        lat: -22.0707
      - name: STR_HILO
        lon: 209.757
        lat: -19.6007
extraStrings:
  - type: en-US
    strings:
      STR_HONOLULU: Honolulu
      STR_LIHUE: Lihue
      STR_HILO: Hilo
  - type: en-GB
    strings:
      STR_HONOLULU: Honolulu
      STR_LIHUE: Lihue
      STR_HILO: Hilo

Can anyone take a peek and let me know what's not working now? I've tried poking around all the default rulesets and can't seem to see anything wrong with this one :(

I created a folder in OpenXcom\standard\Hawaiian_Islands, and in there I placed "Hawaiiain_Islands.rul" and I copied over a metadata.yml from one of the stock mods and edited it to fit, like so:

Code: [Select]
#
# metadata.yaml for Hawaiian Islands

name: "Hawaiian Islands"
version: 1.0
description: "Adds Honolulu, Lihue, and Hilo to the Geoscape"
author: mauirixxx

master: xcom1

Is adding cities just not possible any more, or is my code 3 years outdated? :P

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Adding custom cities?
« Reply #1 on: February 05, 2018, 04:15:42 pm »
The rulesets concerning cities have changed on the Nightlies. You'll need to adapt your mod. This an example taken from the Terrain Pack (which has 144 cities)

Code: [Select]
regions:
  - type: STR_NORTH_PACIFIC
    cost: 600000
    areas:
      - [180, 195, -70, -55]
      - [180, 230, -55, -30]
      - [180, 240, -30, -10]
      - [180, 270, -10, -0]
      - [150, 180, -50, -5]
    missionZones:
      -
        - [194.5, 225.625, -29.25, -15.25]
        - [172.5, 186.875, 10.875, 26.375]
        - [158.375, 171.375, 12.25, 27.75]
        - [202.625, 245.625, -2.25, 18.375]
      -
        - [203.9, 204.7, -19.92, -19.24]
        - [203.29, 203.69, -20.97, -20.66]
        - [177.75, 178.25, 17.5, 17.875]
        - [164.625, 164.75, 20.5, 20.75]
      -
        - [203.9, 204.7, -19.92, -19.24]
        - [203.29, 203.69, -20.97, -20.66]
        - [177.75, 178.25, 17.5, 17.875]
        - [164.625, 164.75, 20.5, 20.75]
      -
        - [144.8, 144.8, -13.5, -13.5, -1, STR_GUAM]
        - [182, 182, -28, -28, -1, STR_MIDWAY_ISLAND]
        - [151.5, 151.5, -46.5, -46.5, -1, STR_KURIL_ISLANDS]
        - [209.25, 209.25, -60.72, -60.72, -1, STR_ANCHORAGE]
        - [204.39, 204.39, -19.64, -19.64, -1, STR_HAWAII]
      -
        - [203.9, 204.7, -19.92, -19.24]
        - [203.29, 203.69, -20.97, -20.66]
      -
        - [170, 190, -60, -40] #N Pac
        - [195.75, 238, -29, 2] #N Pac

To add more cities just add the respective entry on the MissionZone 3 field and the corresponding text string.
« Last Edit: February 05, 2018, 04:17:47 pm by Hobbes »

Offline mauirixxx

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Adding custom cities?
« Reply #2 on: February 05, 2018, 08:52:18 pm »
Awesome, thank you :D

Do I need to have all that in my mod, or do I just need regions, type, & missionZones?

Is there a breakdown somewhere of what each section does?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Adding custom cities?
« Reply #3 on: February 07, 2018, 07:17:34 pm »
Awesome, thank you :D

Do I need to have all that in my mod, or do I just need regions, type, & missionZones?

Is there a breakdown somewhere of what each section does?

https://www.ufopaedia.org/index.php?title=Ruleset_Reference_Nightly_(OpenXcom)#Regions

Offline mauirixxx

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Adding custom cities?
« Reply #4 on: February 07, 2018, 08:30:22 pm »
ohhh. duh. I saw that but it didn't register with me what I was actually looking at.

Finally, last question I hope - how do I get the dual set of co-ordinates? I enabled debug, and hit ctrl-d and see:

rad: 3.64313, -0.360721
deg: 208.736, -20.6678

is rad "lon1, lat1" and deg "lon2, lat2" ? And what's the "-1" supposed to be for? In your terrain pack I see there's some listings that show -22 and other negative numbers.

EDIT: I figured it all out, lon1/lat1 & lon2/lat2 just repeat themselves, and the -22 is the region zone (pulled the -22 from HERE).

Now I just need to figure out why the island of Maui refuses to show "Kihei" and instead shows STR_KIHEI, even though Oahu, Kauai, and the Big Island all show the proper name styles (Lihue, Hilo, Honolulu).

Here's my final code:
Code: [Select]
# Ruleset to add cities to the Hawaiian islands
# this will allow for terror missions in Hawaii

regions:
  - type: STR_PACIFIC
    cost: 1200000
    missionZones:
      -
        - [205.482, 205.482, -22.153, -22.153, -22, STR_LIHUE]
        - [207.081, 207.081, -21.343, -21.343, -22, STR_HONOLULU]
        - [208.726, 208.726, -20.741, -20.741, -22, STR_KIHEI]
        - [209.813, 209.813, -19.625, -19.625, -22, STR_HILO]

I wonder if it's a bug for that particular land mass out in the Pacific? :(
« Last Edit: February 07, 2018, 09:10:30 pm by mauirixxx »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Adding custom cities?
« Reply #5 on: February 07, 2018, 09:10:09 pm »
deg: 208.736, -20.6678

Those are the coordinates you need. With cities you'd need to set it as [208.736, 208.736, -20.6678, -20.6678, -1, STR_CITYNAME] and they appear as single green dots on Geoscape on debug mode.

Quote
is rad "lon1, lat1" and deg "lon2, lat2" ? And what's the "-1" supposed to be for? In your terrain pack I see there's some listings that show -22 and other negative numbers.

If you wanted to define a rectangular area instead you'd place [208.736, 212, -20.6678, -10] where lat1, long1 mark the top left corner of the rectangle and lat2, long2 the bottom right corner.

The -1 indicates the alienDeployment to use on missions spawned at that location and it is defined on globe.rul. On the original game -1 corresponds to the TERROR_MISSION alienDeployment, but on Area51 and the Terrain Pack there are dozens of different alienDeployments used, going up to -106 on A51. 

Offline mauirixxx

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Adding custom cities?
« Reply #6 on: February 07, 2018, 09:11:36 pm »
got it, thanks. Also, I edited the post you were responding too, can you possibly take another look? Sorry, didn't think you would respond so fast :D

Offline mauirixxx

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Adding custom cities?
« Reply #7 on: February 07, 2018, 09:17:17 pm »
I figured it out.

I forgot to make an extraStrings entry, and the reason the other names were showing up properly is because I had my old 2014 rul in there that had the 3 cities entered already, but not the 4th one.

Figured that out after I deleted my 2014 rul and then fired up OXC and now all 4 cities are STR_CITYNAME :D

I'll get this eventually :/
« Last Edit: February 07, 2018, 09:23:26 pm by mauirixxx »