Author Topic: Terror mission behaviour  (Read 7595 times)

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Terror mission behaviour
« on: August 07, 2015, 09:18:44 am »
Non directly mission scripting but..  let's say I wan to make a new custom terror-like mission, but spawning around like alien bases instead of on cities.

alienDeployments
  - type: STR_MY_MISSION_SITE
    [...allthestuff...]
    markerName: STR_MY_MISSION_SITE
    duration: [255, 256]
    despawnPenalty: 500

alienMissions:
  - type: STR_MY_MISSION
    points: 10
    spawnZone: 4 #Mission zone for alien bases #Do I need this at all?
    waves:
      - ufo: STR_UFO_1
        count: 1
        trajectory: P0
        timer: 9000
      - ufo: STR_UFO_2
        count: 1
        trajectory: P2
        timer: 7800
      - ufo: STR_UFO_3
        count: 1
        trajectory: P6 #Last trajectory used by ALIEN_BASE mission
        timer: 6000
      - ufo: STR_MY_MISSION_SITE
        count: 1
        trajectory: P6
        timer: 0

Is this how you do it? Anything crucial missing?
ufo: STR_MY_MISSION_SITE is not intended to be a "dummy ufo" but to spawn directly the mission site.
objective: true for ufo: STR_MY_MISSION_SITE should't be needed since I have no objective for the mission itself.
« Last Edit: August 07, 2015, 09:27:08 am by robin »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Terror mission behaviour
« Reply #1 on: August 07, 2015, 02:14:00 pm »
alienMissions:
  - type: STR_MY_MISSION
    points: 10
    spawnZone: 4 #Mission zone for alien bases #Do I need this at all?

Yes, you'll need it. Spawn zone indicates the MissionZone to use when generating the alien base/mission Site/Infiltration country. You'll also need the objective: 3 line to indicate that you want to generate a missionSite (the terror marker, alert, etc.).

Quote
      - ufo: STR_MY_MISSION_SITE
        count: 1
        trajectory: P6
        timer: 0

Is this how you do it? Anything crucial missing?
ufo: STR_MY_MISSION_SITE is not intended to be a "dummy ufo" but to spawn directly the mission site.
objective: true for ufo: STR_MY_MISSION_SITE should't be needed since I have no objective for the mission itself.

You still need the 'objective: true' to indicate that this UFO will trigger the missionSite.

Basically, if a line is present on vanilla missions, then you'll also need it for your custom ones.

There's also quite a few more custom options for alienDeployments that you can use.
« Last Edit: August 07, 2015, 02:29:50 pm by Hobbes »

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Terror mission behaviour
« Reply #2 on: August 07, 2015, 03:08:47 pm »
There's also quite a few more custom options for alienDeployments that you can use.

Well what kind of options?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Terror mission behaviour
« Reply #3 on: August 07, 2015, 03:41:32 pm »
Well what kind of options?

Just check the alienDeployments entries of TFTD, they're related to the mission Briefing and other minor stuff.

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Terror mission behaviour
« Reply #4 on: August 07, 2015, 04:47:47 pm »
objective: 3
I understood that this meant "terror mission",  to indicate an ufo that spawns a TERROR_SITE at the end with "objective:true".
Just like vanilla terror mission does:

alienMissions:
  - type: STR_ALIEN_TERROR
    points: 10
    objective: 3
    spawnZone: 3 #Mission zone for terror missions
    raceWeights:
      [...]
    waves:
      - [...]
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P7
        timer: 9000
        objective: true

There is no STR_TERROR_SITE at the end, and "objective: true" is applied to the last ufo, not the mission site.

So for my custom mission, I would think that adding "objective: 3" and "objective: true" would spawn a terror site at the end.
I was quite sure that the following spawned a TERROR_SITE not long ago:

  - type: STR_MY_MISSION
    points: 10
    objective: 3
    spawnZone: 3
    waves:
      - ufo: STR_UFO_1
        count: 1
        trajectory: P0
        timer: 9000
      - ufo: STR_UFO_2
        count: 1
        trajectory: P2
        timer: 7800
      - ufo: STR_UFO_3
        count: 1
        trajectory: P6
        timer: 6000
        objective: true

So the next one spawns MY_MISSION_SITE site instead?

  - type: STR_MY_MISSION
    points: 10
    objective: 3
    spawnZone: 3
    waves:
      - ufo: STR_UFO_1
        count: 1
        trajectory: P0
        timer: 9000
      - ufo: STR_UFO_2
        count: 1
        trajectory: P2
        timer: 7800
      - ufo: STR_UFO_3 #Looking at ALIEN_TERROR I would think "objective: true" goes here.
        count: 1
        trajectory: P6
        timer: 6000
      - ufo: STR_MY_MISSION_SITE
        count: 1
        trajectory: P7
        timer: 0
        objective: true #If I put it here, it seems to me that a TERROR_SITE is spawned after MY_MISSION_SITE

I probably short-circuited on this but I don't understand.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Terror mission behaviour
« Reply #5 on: August 07, 2015, 07:26:48 pm »
So the next one spawns MY_MISSION_SITE site instead?

  - type: STR_MY_MISSION
    points: 10
    objective: 3
    spawnZone: 3
    waves:
      - ufo: STR_UFO_1
        count: 1
        trajectory: P0
        timer: 9000
      - ufo: STR_UFO_2
        count: 1
        trajectory: P2
        timer: 7800
      - ufo: STR_UFO_3 #Looking at ALIEN_TERROR I would think "objective: true" goes here.
        count: 1
        trajectory: P6
        timer: 6000
      - ufo: STR_MY_MISSION_SITE
        count: 1
        trajectory: P7
        timer: 0
        objective: true #If I put it here, it seems to me that a TERROR_SITE is spawned after MY_MISSION_SITE

I probably short-circuited on this but I don't understand.

Yes, the last ufo entry is the one that spawns the missionSite. It isn't an actual 'ufo' so you might as well just write bogus or don't enter anything. I've been having crashes if there's any reference on an existing entry on the /ufo ruleset section.

If you use this code then what will happen is that the game will generate both STR_UFO_3 and the missionSite simultaneously.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Terror mission behaviour
« Reply #6 on: August 08, 2015, 09:46:23 am »
to expand on what hobbes is saying, the final wave can be _either_ a ufo that will fly around and turn into a missionSite, or a missionSite that spawns independently, but either way it will need the objective: true flag to signal to the mission handling that "this is where the mission does magic"

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Terror mission behaviour
« Reply #7 on: August 16, 2015, 06:38:21 pm »
Dumbman Attack II


The following doesn't work (mission doesn't seem to get generated at all):

  - type: STR_ALIEN_DROP_SMALL
    points: 3
    objective: 3
    spawnZone: 4
    raceWeights:
      [...]
    waves:
      - ufo: STR_UFO_PROBE
        count: 1
        trajectory: P1
        timer: 15000
      - ufo: STR_UFO_PROBE
        count: 1
        trajectory: P1
        timer: 9600
      - ufo: STR_UFO_SCOUT
        count: 1
        trajectory: P0
        timer: 12000
      - ufo: STR_UFO_SCOUT
        count: 1
        trajectory: P6 # note that this is the route for alien base mission, terror uses P7
        timer: 9000
      - ufo: STR_ALIEN_DROP_SMALL
        count: 1
        trajectory: P6 # note that this is the route for alien base mission, terror uses P7
        timer: 0
        objective: true

But if I change "spawnZone: 4" to "spawnZone: 3" it starts working properly. The problem is that then the mission site generates on cities, while I want it to be generated "anywhere"-- which is why I used "spawnZone: 4" (the zone for alien bases) and "P6" (the route for alien bases). I don't have the slightest idea how to fix this.
(Also, does anyone have working examples for custom missions to share?)

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Terror mission behaviour
« Reply #8 on: August 16, 2015, 07:24:58 pm »
But if I change "spawnZone: 4" to "spawnZone: 3" it starts working properly. The problem is that then the mission site generates on cities, while I want it to be generated "anywhere"-- which is why I used "spawnZone: 4" (the zone for alien bases) and "P6" (the route for alien bases). I don't have the slightest idea how to fix this.

I think the issue may be that the spawnZone for missionSites (objective 3) seems to require specific coordinates, i.e., unlike alien Base where the base gets generated on a random location somewhere on missionZones 4, missionSites can't be generated 'anywhere' (random location). 

Quote
      - ufo: STR_UFO_SCOUT
        count: 1
        trajectory: P6 # note that this is the route for alien base mission, terror uses P7
        timer: 9000
      - ufo: STR_ALIEN_DROP_SMALL
        count: 1
        trajectory: P6 # note that this is the route for alien base mission, terror uses P7
        timer: 0
        objective: true

If I'm reading your intentions correctly, you want a UFO to fly to P6/7 location, perform a 'drop' of aliens on that location and then continue flying (Apocalypse style). The issue is that the 'UFO Scout' and the 'Drop Small' can head to different P6/7 locations, which completely ruin your intentions, or arrive at wrong times.

Quote
(Also, does anyone have working examples for custom missions to share?)

The examples I have are pretty much copies of TFTD's Artifact and Shipping missions. My advice would be to stick and adapt these standard missions as much as possible since the mission system doesn't give much latitude for changes. Creating a mission completely different from the vanilla ones will only bring frustration since it will be impossible to get everything to work as you wanted.

Going back to your 'alienDrop', one suggestion would be for you to create a new region called "DROP_ZONES", add several coordinates to cover all continents, and set the mission script to take place in the 'DROP ZONES' region. It won't be as random as using missionZone 4 like alien bases but if you add some 30+ coordinates no one will notice.

Here's the code I'm using for the facility attacks:
Code: [Select]
regions:
  - type: RESEARCH_FACILITIES
    missionZones:
      -
        - [243.261, 243.261, -38.598, -38.598, -5, STR_AREA51]
        - [135.199, 135.199, 23.484, 23.484, -5, STR_PINE_GAP]
        - [47.938, 47.938, -46.985, -46.985, -5, STR_KASPUTIN_YAR]
        - [358.547, 358.547, -51.249, -51.249, -5, STR_PORTON_DOWN]
        - [89.057, 89.057, -42.506, -42.506, -5, STR_LOP_NUR]
globe:
    - id: -5
      deployments:
        STR_FACILITY_EXTRACTION: 100
  - type: STR_ALIEN_FACILITY_ATTACK
    points: 0
    objective: 3
    spawnZone: 0
    raceWeights:
      0:
        STR_SECTOID_BASE: 100
    waves:
      - ufo: bogus
        count: 1
        trajectory: P10
        timer: 21000
        objective: true
ufoTrajectories:
  - id: P10
    groundTimer: 0
    waypoints:
      - [0, 0, 0]
« Last Edit: August 16, 2015, 07:29:30 pm by Hobbes »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Terror mission behaviour
« Reply #9 on: August 16, 2015, 07:40:54 pm »
If I'm reading your intentions correctly, you want a UFO to fly to P6/7 location, perform a 'drop' of aliens on that location and then continue flying (Apocalypse style). The issue is that the 'UFO Scout' and the 'Drop Small' can head to different P6/7 locations, which completely ruin your intentions, or arrive at wrong times.
Oh I didn't want it to be that complex. I just wanted a terror mission generating its terror site "around" (instead of on a city).

Quote
Going back to your 'alienDrop', one suggestion would be for you to create a new region called "DROP_ZONES", add several coordinates to cover all continents, and set the mission script to take place in the 'DROP ZONES' region. It won't be as random as using missionZone 4 like alien bases but if you add some 30+ coordinates no one will notice.
This seems the right solution. Thanks!


Offline XOps

  • Colonel
  • ****
  • Posts: 193
  • Guy who drowns first
    • View Profile
Re: Terror mission behaviour
« Reply #10 on: August 16, 2015, 11:03:06 pm »
For what it's worth

Globe Code: Defines texture id for deployment
Code: [Select]
textures:
    - id: 0
      terrain:
        - name: FOREST
          area: [0, 360, -90, 0]
        - name: JUNGLE
          area: [0, 360, 0, 90]
    - id: 1
      terrain:
        - name: CULTA
    - id: 2
      terrain:
        - name: CULTA
    - id: 3
      terrain:
        - name: CULTA
    - id: 4
      terrain:
        - name: CULTA
    - id: 5
      terrain:
        - name: MOUNT
    - id: 6
      terrain:
        - name: FOREST
          area: [0, 360, -90, 0]
        - name: JUNGLE
          area: [0, 360, 0, 90]
    - id: 7
      terrain:
        - name: DESERT
    - id: 8
      terrain:
        - name: DESERT
    - id: 9
      terrain:
        - name: POLAR
    - id: 10
      terrain:
        - name: FOREST
          area: [0, 360, -90, 0]
        - name: JUNGLE
          area: [0, 360, 0, 90]
    - id: 11
      terrain:
        - name: FOREST
          area: [0, 360, -90, 0]
        - name: JUNGLE
          area: [0, 360, 0, 90]
    - id: 12
      terrain:
        - name: POLAR
    - id: -1
      deployments:
        STR_TERROR_MISSION: 100
    - id: -2
      deployments:
        STR_CODEX_JUNGLE: 100

Regions Code: Places points on the map for mission site to spawn
Code: [Select]
regions:
  - type: STR_SOUTH_AMERICA
    cost: 600000
    areas:
      - [270, 315, -10, 0]
      - [275, 330, 0, 15]
      - [275, 325, 15, 60]
    regionWeight: 10
    missionWeights:
      STR_ALIEN_RESEARCH: 10
      STR_ALIEN_HARVEST: 24
      STR_ALIEN_ABDUCTION: 12
      STR_ALIEN_INFILTRATION: 18
      STR_ALIEN_BASE: 22
    missionZones:
      -
        - [280.375, 297.625, -11.875, -4.125]
        - [279.125, 301.375, -1, 7.75]
        - [305.5, 323.75, 0.875, 11]
        - [281.625, 292.25, 10.75, 26.625]
        - [302, 314.375, 22.75, 31.875]
        - [289.125, 297.75, 38.5, 49.5]
        - [281.375, 303.75, 48, 56.125]
      -
        - [312.875, 320.25, 6.25, 11.5]
        - [290.75, 293.75, -8.625, -6.125]
        - [290.5, 294.375, 28.875, 31.5]
        - [303, 312.75, 21.75, 24.5]
      -
        - [284.25, 289.75, -8.375, -6.5]
        - [305.375, 312, 13.25, 16.125]
        - [289.875, 294.625, 34.625, 37.625]
        - [287.875, 292.25, 47.25, 49.25]
        - [299.5, 301.125, 51.375, 51.875]
      -
        - [312.125, 312.125, 15.75, 15.75, -1, STR_BRASILIA]
        - [285.875, 285.875, -4.5, -4.5, -1, STR_BOGOTA]
        - [302.5, 302.5, 34.5, 34.5, -1, STR_BUENOS_AIRES]
        - [289.375, 289.375, 33.375, 33.375, -1, STR_SANTIAGO]
        - [316.875, 316.875, 22.875, 22.875, -1, STR_RIO_DE_JANEIRO]
        - [283, 283, 12, 12, -1, STR_LIMA]
        - [293.125, 293.125, -10.5, -10.5, -1, STR_CARACAS]
      -
        - [290.125, 305.5, 1.5, 7.625]
        - [285.875, 289.5, 13.625, 15.625]
        - [290, 294.125, 41.25, 44.875]
        - [289.375, 294.125, 22.875, 27.125]
      -
        - [0, 359.875, -90, -80]
        - [0, 359.875, 80, 90]
        - [180, 200, 0, 10]
        - [355, 365, -5, 5]
        - [170, 190, -60, -40]
        - [21.5, 51.75, -31.875, -15.875]
        - [238.625, 258.625, -53.375, -33.375]
        - [4.75, 27.625, -52, -44.375]
        - [75, 89, -39, -34.375]
        - [115, 132.5, 21, 25.5]
      - #Codex Sites
        - [294.182, 294.182, 6.914, 6.914, -2]
        - [306.06, 306.06, 0.315, 0.315, -2]
        - [298.142, 298.142, -3.643, -3.643, -2]
        - [298.911, 298.911, 18.022, 18.022, -2]
        - [307.160, 307.160, 8.344, 8.344, -2]
        - [285.824, 285.824, 2.515, 2.515, -2]
        - [298.802, 298.802, 24.180, 24.180, -2]
  - type: STR_SOUTHERN_AFRICA
    cost: 550000
    areas:
      - [5, 55, 0, 40]
    regionWeight: 8
    missionWeights:
      STR_ALIEN_RESEARCH: 7
      STR_ALIEN_HARVEST: 8
      STR_ALIEN_ABDUCTION: 8
      STR_ALIEN_INFILTRATION: 8
      STR_ALIEN_BASE: 9
    missionZones:
      -
        - [7.125, 27, -0.375, 7.625]
        - [40.875, 56.625, 12, 30.625]
        - [11.25, 37, 21.75, 35.875]
        - [27, 45.375, -3.875, 11]
      -
        - [19.875, 24.25, 28.5, 31.25]
        - [44.75, 48.75, 16.875, 21.375]
        - [14.125, 20.625, 6.125, 10.875]
        - [13.375, 21.375, 16.625, 20.5]
      -
        - [12.375, 23.25, -1.5, 4.625]
        - [30.5, 38.375, 11.625, 16.75]
        - [17.75, 29.75, 26.25, 29.875]
        - [45, 48.75, 16.25, 18.75]
      -
        - [28.125, 28.125, 26.25, 26.25, -1, STR_PRETORIA]
        - [36.75, 36.75, 1.25, 1.25, -1, STR_NAIROBI]
        - [18.5, 18.5, 34, 34, -1, STR_CAPE_TOWN]
        - [15.375, 15.375, 4.375, 4.375, -1, STR_KINSHASA]
      -
        - [17.125, 23.25, 22.75, 27.125]
        - [12, 26.875, -2.625, 4]
        - [48.5, 49.875, 15.25, 17]
        - [31.25, 36.75, 12.25, 15.625]
      -
        - [0, 359.875, -90, -80]
        - [0, 359.875, 80, 90]
        - [180, 200, 0, 10]
        - [282.25, 322.875, 9.375, 38.375]
        - [66, 102, 2.625, 39.375]
        - [354.5, 393.375, -56.625, -46.375]
        - [238.625, 258.625, -53.375, -33.375]
        - [64.5, 125.5, -55.5, -44]
        - [72.875, 105.25, -25, -11.75]
        - [115, 132.5, 21, 25.5]
      - #Codex Sites
        - [24.197, 24.197, 10.433, 10.433, -2]
        - [19.26, 19.26, -1.389, -1.398, -2]
        - [30.212, 30.212, 4.471, 4.471, -2]
        - [33.759, 33.759, 13.57, 13.57, -2]
        - [12.399, 12.399, -1.235, -1.235, -2]
        - [26.665, 26.665, 15.653, 15.653, -2]
Alien Missions Code
Code: [Select]
alienMissions:
  - type: STR_CODEX_JUNGLE
    points: 10
    objective: 3
    spawnZone: 6
    raceWeights:
      0:
          STR_SECTOID: 10
          STR_FLOATER: 70
          STR_SNAKEMAN: 0
          STR_ETHEREAL: 0
          STR_MUTON_ELITE: 0
          STR_MUTON: 0
          STR_ARMORED_SECTOID: 0
          STR_OVERLORD: 0
          STR_ROACHER: 20
          STR_ARMORED_MUTON: 0
      1:
          STR_SECTOID: 20
          STR_FLOATER: 20
          STR_OVERLORD: 0
          STR_ROACHER: 60
          STR_ARMORED_MUTON: 0
      2:
          STR_SECTOID: 50
          STR_FLOATER: 25
          STR_ROACHER: 25
      3:
          STR_SECTOID: 30
          STR_FLOATER: 30
          STR_SNAKEMAN: 10
          STR_ROACHER: 30
      5:
          STR_SECTOID: 10
          STR_SNAKEMAN: 50
          STR_FLOATER: 20
          STR_ARMORED_SECTOID: 10
          STR_ROACHER: 10
      7:
          STR_SECTOID: 10
          STR_SNAKEMAN: 20
          STR_ETHEREAL: 0
          STR_MUTON: 40
          STR_FLOATER: 10
          STR_ARMORED_SECTOID: 10
          STR_OVERLORD: 0
          STR_ROACHER: 10
          STR_ARMORED_MUTON: 0
      9:
          STR_SECTOID: 10
          STR_SNAKEMAN: 10
          STR_ETHEREAL: 10
          STR_MUTON_ELITE: 10
          STR_MUTON: 10
          STR_FLOATER: 10
          STR_ARMORED_SECTOID: 10
          STR_OVERLORD: 10
          STR_ROACHER: 10
          STR_ARMORED_MUTON: 10
    waves:
      - ufo: STR_SCANNER
        count: 1
        trajectory: P1
        timer: 15000
      - ufo: STR_MEDIUM_SCOUT
        count: 1
        trajectory: P1
        timer: 9600
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P0
        timer: 12000
      - ufo: STR_CODEX_JUNGLE
        count: 1
        trajectory: P12
        timer: 9000
        objective: true

Trajectories Code
Code: [Select]
ufoTrajectories:
  - id: P12
    groundTimer: 9000
    waypoints:
      - [5, 4, 100]
      - [0, 3, 60]
      - [0, 2, 30]
      - [6, 1, 20]
      - [5, 0, 100]

Basic explanation of code
Unlike the TFTD code, I found that adding a new section to the regions code makes another mission zone. This allows you to add points to existing regions. For the alien mission itself, it will target zone 6 to spawn a mission site which it will do instantly like artifact sites (I could never get a terror ship to land and then spawn a site like a terror mission). Finally the trajectory P12 targets zone 6. This so far has worked for me.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Terror mission behaviour
« Reply #11 on: August 17, 2015, 01:14:39 am »
Basic explanation of code
Unlike the TFTD code, I found that adding a new section to the regions code makes another mission zone. This allows you to add points to existing regions. For the alien mission itself, it will target zone 6 to spawn a mission site which it will do instantly like artifact sites (I could never get a terror ship to land and then spawn a site like a terror mission). Finally the trajectory P12 targets zone 6. This so far has worked for me.

Nice. I had wondered about creating a new MissionZone for a region but hadn't tried it yet. Thanks for sharing.

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Terror mission behaviour
« Reply #12 on: October 18, 2015, 11:11:40 am »
I wonder if we could have all this info on Ufopaedia or something? It looks super useful.

Scripting in general needs more love.