OpenXcom Forum

Modding => Work In Progress => Topic started by: Solarius Scorch on November 13, 2016, 01:08:51 pm

Title: How to run research-dependent mission once?
Post by: Solarius Scorch on November 13, 2016, 01:08:51 pm
One way to make the mission only run once is to use the same value on firstMonth and lastMonth. But is it possible to have a unique, one-time mission that is unlocked by research rather than a set month?
Title: Re: How to run research-dependent mission once?
Post by: Nord on November 13, 2016, 02:31:40 pm
How about:
 
Code: [Select]
    lastMonth: 0
    researchTriggers: STR_SECRET_MISSION_RESEARCH
?
Title: Re: How to run research-dependent mission once?
Post by: Warboy1982 on November 14, 2016, 04:55:40 am
#    maxRuns: 12                         # this mission type can only execute this number of times, -1 for infinite (default -1)
Title: Re: How to run research-dependent mission once?
Post by: Solarius Scorch on November 14, 2016, 01:59:15 pm
#    maxRuns: 12                         # this mission type can only execute this number of times, -1 for infinite (default -1)

Great, thanks!
(I feel silly now)
Title: Re: How to run research-dependent mission once?
Post by: Hobbes on November 15, 2016, 07:09:08 pm
From Area 51 missionScripts:

Code: [Select]
  - type: bluebookD
    label: 7
    firstMonth: 1
    maxRuns: 1
    missionWeights:
      0:
        STR_COUNCIL_MISSION: 100
    researchTriggers:
      STR_DATA_DISK_2: true
    regionWeights:
      0:
        BLUEBOOKD: 100
    varName: bluebookd
    useTable: false
Title: Re: How to run research-dependent mission once?
Post by: Solarius Scorch on November 16, 2016, 08:36:05 pm
From Area 51 missionScripts:

Code: [Select]
  - type: bluebookD
    label: 7
    firstMonth: 1
    maxRuns: 1
    missionWeights:
      0:
        STR_COUNCIL_MISSION: 100
    researchTriggers:
      STR_DATA_DISK_2: true
    regionWeights:
      0:
        BLUEBOOKD: 100
    varName: bluebookd
    useTable: false

What would happen if you don't discover STR_DATA_DISK_2 within the first few months?
Title: Re: How to run research-dependent mission once?
Post by: Chiko on November 17, 2016, 01:27:42 am
...Wait, wut? Research-dependent missions? How, wut? D_D
Title: Re: How to run research-dependent mission once?
Post by: Hobbes on November 17, 2016, 03:57:50 pm
What would happen if you don't discover STR_DATA_DISK_2 within the first few months?

It's irrelevant when you discover STR_DATA_DISK_2. The 'firstMonth: 1' means that the mission can only be generated from February onwards and there isn't a limit set to when the mission can take place.

...Wait, wut? Research-dependent missions? How, wut? D_D

They were already present on the original game regarding alien retaliations. The missionScript adds a monthly Retaliation once the game reaches a certain month (depending on the difficulty level) or The Martian Solution is researched, in addition to the retaliations caused by UFO shoot downs.
Title: Re: How to run research-dependent mission once?
Post by: Solarius Scorch on November 17, 2016, 06:35:36 pm
It's irrelevant when you discover STR_DATA_DISK_2. The 'firstMonth: 1' means that the mission can only be generated from February onwards and there isn't a limit set to when the mission can take place.

OK, I'm in a really bad shape. I meant if it was lastMonth, not first:

Code: [Select]
  - type: bluebookD
    label: 7
    lastMonth: 1
    maxRuns: 1
    missionWeights:
      0:
        STR_COUNCIL_MISSION: 100
    researchTriggers:
      STR_DATA_DISK_2: true
    regionWeights:
      0:
        BLUEBOOKD: 100
    varName: bluebookd
    useTable: false
Title: Re: How to run research-dependent mission once?
Post by: Nord on November 17, 2016, 07:27:43 pm
How i understand description, lastmonth 1 means "no missions after january", lastmonth 0 means " only one time."
Title: Re: How to run research-dependent mission once?
Post by: Hobbes on November 17, 2016, 07:59:58 pm
OK, I'm in a really bad shape. I meant if it was lastMonth, not first:

Code: [Select]
  - type: bluebookD
    label: 7
    lastMonth: 1
    maxRuns: 1
    missionWeights:
      0:
        STR_COUNCIL_MISSION: 100
    researchTriggers:
      STR_DATA_DISK_2: true

On this case the mission can never take place in January if the player starts the game with STR_DATA_DISK_2 already researched. And for the mission to take place in February, the player needs to recover and research STR_DATA_DISK_2 before January ends. The important thing to remember is that the missionScript is only run at the beginning of a new month, so if the conditions aren't met, then no mission is generated.

How i understand description, lastmonth 1 means "no missions after january", lastmonth 0 means " only one time."

Everytime you see on a ruleset the value 0 associated with a list (of months, damageType, etc.) it means the first entry of the list, on this case January.  maxRuns: 1 is used to run the mission 'only one time'
Title: Re: How to run research-dependent mission once?
Post by: Solarius Scorch on November 17, 2016, 09:07:59 pm
OK, I thought so. Thanks!
Title: Re: How to run research-dependent mission once?
Post by: Thirsk on February 02, 2017, 12:29:55 pm
I'm having trouble trying to work out the opposite of this.

How do you stop a mission script (with no lastmonth variable) from continuing? I tried to put in research trigger: STR_SABOTAGE to false. So that would mean that if I researched SABOTAGE, then the mission script would finally stop? Seems to keep going for me..

Or is it that the mission will keep repeating each month and I have to research it every single month to prevent it from executing? How is that possible..lol I'm so confused.

EDIT: Strangely I can't seem to stop missions from repeating at all. Setting lastmonth to 0, maxruns to 1...nothing seems to prevent it from coming back month after month. Is there some kind of bug?
Title: Re: How to run research-dependent mission once?
Post by: Solarius Scorch on February 02, 2017, 03:08:03 pm
I'm having trouble trying to work out the opposite of this.

How do you stop a mission script (with no lastmonth variable) from continuing? I tried to put in research trigger: STR_SABOTAGE to false. So that would mean that if I researched SABOTAGE, then the mission script would finally stop? Seems to keep going for me..

Or is it that the mission will keep repeating each month and I have to research it every single month to prevent it from executing? How is that possible..lol I'm so confused.

EDIT: Strangely I can't seem to stop missions from repeating at all. Setting lastmonth to 0, maxruns to 1...nothing seems to prevent it from coming back month after month. Is there some kind of bug?

This is a mission script that definitely works for me:

Code: [Select]
  - type: CultActivityEXALT
    firstMonth: 0
    executionOdds: 8
    missionWeights:
      0:
        STR_CULT_INVESTIGATION_EXALT: 100
    regionWeights:
      0:
        REGION_EXALT: 100
    useTable: false
    researchTriggers:
      STR_EXALT: true
      STR_EXALT_OPERATIONS: false
    startDelay: 1200

It is enabled by STR_EXALT and disabled by STR_EXALT_OPERATIONS. And it works! (Of course, starting next month.)
Title: Re: How to run research-dependent mission once?
Post by: Thirsk on February 03, 2017, 03:01:31 am
Thanks Solarius! Actually I figured out after many hours of hair pulling that the problem was I was using the wrong IDs for global locations  :-\ funny how just a few numbers can make or break a game!