Author Topic: Help create a mission from the base  (Read 785 times)

Offline Kronos913

  • Colonel
  • ****
  • Posts: 124
    • View Profile
Help create a mission from the base
« on: October 04, 2024, 02:05:03 pm »
Please help create a mission that will start every month from each alien base. That is, how many bases - so many mission starts. As usual, a mission of several UFOs - from scouts to target UFOs

For example, STR_ALIEN_HARVEST. Then, I will try to create the rest myself by analogy

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: Help create a mission from the base
« Reply #1 on: October 04, 2024, 02:19:48 pm »
Not exactly one mission per month per base, but very close to it:

Code: [Select]
alienDeployments:
  - type: STR_ALIEN_BASE_ASSAULT
...
    genMission:
      STR_ALIEN_HARVEST: 100
    genMissionFreq: 3

Offline Kronos913

  • Colonel
  • ****
  • Posts: 124
    • View Profile
Re: Help create a mission from the base
« Reply #2 on: October 05, 2024, 01:43:35 am »
If it's not too much trouble, please help me make the full code.

As far as I understand, I need to write something in other sections, not just in alienDeployments?

And what should be in place...?

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: Help create a mission from the base
« Reply #3 on: October 05, 2024, 10:50:40 am »
Examples of the alien missions themselves can be seen in the original game's rule set “...\OpenXCom\standard\xcom1\alienMissions.rul”, including STR_ALIEN_HARVEST.
And the alienDeployments.rul file contains the full code of alien base behavior, you just need to edit it as you need it.
For example, for your task in your submod you should write something like this:

Code: [Select]
alienDeployments:
  - update: STR_ALIEN_BASE_ASSAULT
    genMission:
      STR_ALIEN_SUPPLY: 50
      STR_ALIEN_HARVEST: 50
    genMissionFreq: 6

Offline Kronos913

  • Colonel
  • ****
  • Posts: 124
    • View Profile
Re: Help create a mission from the base
« Reply #4 on: October 09, 2024, 02:50:22 pm »
I tried to do something similar. It seems like the number of missions has increased. BUT. They still start from space. And I would like to make it so that the UFO starts from the alien base and returns there.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: Help create a mission from the base
« Reply #5 on: October 09, 2024, 05:05:35 pm »
By default, all missions start from space, even base generated ones. If you want it to start from a base you'll need to specify an operationType in the alienMission itself. You probably should check out this particular thread about the topic here (https://openxcom.org/forum/index.php/topic,6557.msg104669.html#msg104669). Note that if in the example code provided by Kozinsky you also update the mission for STR_ALIEN_HARVEST to use, let's say:
Code: [Select]
alienMissions:
  - update: STR_ALIEN_HARVEST
    operationType: 1
It will work, but now, ALL of these instances of the mission will be earth-based ONLY and in this particular example case, require at least 1 alien base present in the region to function or it will be aborted. If your idea is to have bases generate already defined missions but not alter the vanilla "from space" behaviour, you'll have to duplicate those missions to a different name (STR_ALIEN_HARVEST_FROM_BASE for example) and give them an operationType. Also, depending on the type you specify, you might have to set other properties too, all of that is explained in the thread linked earlier.

Offline Kronos913

  • Colonel
  • ****
  • Posts: 124
    • View Profile
Re: Help create a mission from the base
« Reply #6 on: November 15, 2024, 01:55:58 pm »
Is there any example of working code for any mission from the base?
I'll figure out how to further remake it into what I need. It's easier to experiment with working code than to try to put everything together from scratch

In another topic, I also asked for a small example, from which I then developed a full-fledged task.

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: Help create a mission from the base
« Reply #7 on: November 15, 2024, 03:29:22 pm »
Example from the mod "The X-Com Files".

This describes the conditions for establishing a new alien base, in this exampe it is called STR_CULT_MANOR_BLACK_LOTUS_ASSAULT:
Code: [Select]
missionScripts:
  - type: CultManorBlackLotus
    firstMonth: 10
    lastMonth: 14
    executionOdds: 2
    missionWeights:
      0:
        STR_CULT_MANOR_BLACK_LOTUS_ASSAULT: 100
    regionWeights:
      0:
        STR_SOUTH_EAST_ASIA: 100
        STR_AUSTRALASIA: 20
        STR_PACIFIC: 10
        STR_INDIAN_OCEAN: 2
    useTable: false
    researchTriggers:
      STR_DESTROY_BLACK_LOTUS: false
    startDelay: 30
    randomDelay: 43500

Now let's describe the parameters of this alien base and what missions it will generate during its existence. In this example these are the STR_CULT_INFILTRATION_BLACK_LOTUS and STR_CULT_STREET_FIGHTING_BLACK_LOTUS missions (I do not include the “data:” section in the example because it contains a lot of lines - you should fill it in according to your scenario):
Code: [Select]
alienDeployments:
  - type: STR_CULT_MANOR_BLACK_LOTUS_ASSAULT
    width: 60
    length: 60
    height: 10
    alert: STR_ALERT_CULT_MANOR_ASSAULT
    alertBackground: CULT_BACKGROUND.SCR
    alertDescription: STR_CULT_MANOR_BLACK_LOTUS_ASSAULT_DESCRIPTION
    briefing:
      background: NINJA_BACKGROUND.SCR
      palette: 1
      music: GMENBASE
    music:
      - SW_MONSTER
    markerName: STR_CULT_MANOR_ASSAULT
    markerIcon: 29
    points: 3
    abortPenalty: 100
    baseDetectionRange: 300
    baseDetectionChance: 80
    huntMissionMaxFrequency: 10000 # in minutes
    huntMissionWeights:
      0:
        STR_CULT_MANOR_CAR_INTERCEPTION: 100
    genMission:
      STR_CULT_INFILTRATION_BLACK_LOTUS: 30
      STR_CULT_STREET_FIGHTING_BLACK_LOTUS: 15
    genMissionFreq: 5
    alienBaseUpgrades:
      0:
        STR_CULT_MANOR_BLACK_LOTUS_ASSAULT: 100
      5:
        STR_CULT_MANOR_BLACK_LOTUS_ASSAULT: 70
        STR_CULT_GREATER_MANOR_BLACK_LOTUS_ASSAULT: 30
      10:
        STR_CULT_GREATER_MANOR_BLACK_LOTUS_ASSAULT: 100
    terrains:
      - COMRCURBAN
    script: MANOR
    data:
      ...

Finally, let's describe the parameters of one of those missions that the alien base generates during its existence:
Code: [Select]
alienMissions:
  - type: STR_CULT_INFILTRATION_BLACK_LOTUS
    operationType: 1
    objective: 3
    spawnZone: 3
    siteType: STR_CULT_INFILTRATION_BLACK_LOTUS_SITE
    raceWeights:
      0:
          STR_BLACK_LOTUS: 100
    waves:
      - ufo: STR_MEDIUM_GROUND_CONVOY
        count: 1
        trajectory: P_CHWC1_Z3
        timer: 9000
        objective: true
        objectiveOnTheLandingSite: true
« Last Edit: November 15, 2024, 03:32:07 pm by Kozinsky »