aliens

Author Topic: [DONE][Suggestion] Additional item trigger for mission scripts  (Read 7319 times)

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
I think it could be very useful for modders to have an additional option in mission script to check if the player has specified item. The script will check if the player has listed items and if conditions are met, it will run mission. Probably, syntax could look like that:

Code: [Select]
missionScripts:
  - type: treasureHunting
    missionWeights:
      0:
        STR_TREASURE_HUNTING: 100
    executionOdds: 100
    itemDependency:
      - item: STR_TREASURE_MAP
        needed: true #default is true
      - item: STR_TREASURE_CHEST
        needed: false #that means if already has an item, mission will not spawn
« Last Edit: September 18, 2019, 08:08:56 pm by Meridian »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11702
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #1 on: April 08, 2019, 01:16:18 pm »
I support this idea. It can be used in a variety of ways, for example having a commander in your base could provoke additional retaliations, as the aliens try to recover them. Or it would prevent missions from spawning if you already have the item they're meant to give you.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #2 on: April 08, 2019, 01:16:57 pm »
This carries the risk that important items are sold, lost or destroyed and might not be recoverable. It's already possible to tie missions to research triggers and unlock research topics via completed missions. While i can see this having a niche use, somebody who actually knows the ins and outs of mission design should have look at this.

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #3 on: April 08, 2019, 01:27:05 pm »
Its not ment to be instead research triggers, it should add extra flexability to mission desighn when you are speaking of somethin rare and special, but ment to be repeatable, so cant be configured with research triggers

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11702
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #4 on: April 08, 2019, 02:08:16 pm »
If you lose the item, them the mission starts spawning again.

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #5 on: April 08, 2019, 02:16:30 pm »
or vice versa if so intended  ;)

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #6 on: April 08, 2019, 02:56:45 pm »
As long as we are discussing additional triggers for mission sapwns, can we also implement a way to tie base functions to missions? Like building scanner/radar base modules to enable certain missions? Or building a 'support/hangar' module to enable underwater missions?


Offline Nord

  • Commander
  • *****
  • Posts: 1744
  • The Gate is open.
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #7 on: April 08, 2019, 03:18:38 pm »
As long as we are discussing additional triggers for mission sapwns, can we also implement a way to tie base functions to missions? Like building scanner/radar base modules to enable certain missions? Or building a 'support/hangar' module to enable underwater missions?
It can be done allready by specific research, allowed by facility special function.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: [SUGGESTION] Additional item trigger for mission scripts
« Reply #8 on: April 08, 2019, 04:44:55 pm »
It can be done allready by specific research, allowed by facility special function.

No, it can't be ->

It's already possible to tie missions to research triggers and unlock research topics via completed missions. While i can see this having a niche use, somebody who actually knows the ins and outs of mission design should have look at this.
Its not ment to be instead research triggers, it should add extra flexability to mission desighn when you are speaking of somethin rare and special, but ment to be repeatable, so cant be configured with research triggers

You can't enable/disable research triggers in the same way you'd be able to with items or base functions.
« Last Edit: April 08, 2019, 04:47:12 pm by krautbernd »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9047
    • View Profile
Re: [DONE][Suggestion] Additional item trigger for mission scripts
« Reply #9 on: September 18, 2019, 08:24:32 pm »
Done.

Code: [Select]
missionScripts:
  - type: treasureHunting
...
    itemTriggers:
       STR_TREASURE_MAP: true
       STR_TREASURE_CHEST: false

Items considered are ONLY items directly in base stores.

Not considered are:
1. weapons, ammo, vehicles and items in crafts
2. items in transfer
3. weapons, ammo, vehicles and items in crafts in transfer
4. items worn by soldiers (armor)
5. items being researched
6. potential manufacture refunds
7. potential facility dismantle refunds
8. anything else I forgot

And as a bonus, there is also a possibility to define minimum and maximum required score (from the previous month), similar to how the difficulty constraint works.
The score constraint is NOT checked at the beginning of the game (before first month).

Code: [Select]
missionScripts:
  - type: xxx
...
    minScore: -1000
    maxScore: 200

Test build: https://lxnt.wtf/oxem/builds//Extended/Extended-5.6.4-4e8202a0f-2019-09-18-win32.7z

EDIT: there is also a possibility to define minimum and maximum required funds (from the current month, i.e. after monthly rating), similar to how the difficulty constraint works.
The funds constraint is NOT checked at the beginning of the game (before first month).

Code: [Select]
missionScripts:
  - type: xxx
...
    minFunds: -1000
    maxFunds: 200
« Last Edit: October 11, 2019, 04:20:19 pm by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9047
    • View Profile
Re: [DONE][Suggestion] Additional item trigger for mission scripts
« Reply #10 on: May 14, 2020, 08:06:52 pm »
Added one more attribute (in OXCE v6.5).
Similar to research and item triggers, there are base facility triggers.

Code: [Select]
missionScripts:
  - type: xxx
...
    facilityTriggers:
       STR_FACILITY1: true
       STR_FACILITY2: false

Facilities from all bases are considered.

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: [DONE][Suggestion] Additional item trigger for mission scripts
« Reply #11 on: April 23, 2023, 10:19:38 am »
Added one more attribute (in OXCE v6.5).
Similar to research and item triggers, there are base facility triggers.

Code: [Select]
missionScripts:
  - type: xxx
...
    facilityTriggers:
       STR_FACILITY1: true
       STR_FACILITY2: false

Facilities from all bases are considered.

What is the conditional in the facility triggers?  Is it AND or an OR?  In other words, do STR_FACILITY1 and STR_FACILITY2 need to be both present somewhere among all bases?  Or, perhaps, the interpretation is that either of STR_FACILITY1 and STR_FACILITY2 needs to be present somewhere among all bases?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9047
    • View Profile
Re: [DONE][Suggestion] Additional item trigger for mission scripts
« Reply #12 on: April 23, 2023, 11:40:28 am »
What is the conditional in the facility triggers?  Is it AND or an OR?

It's AND.

In other words, do STR_FACILITY1 and STR_FACILITY2 need to be both present somewhere among all bases?  Or, perhaps, the interpretation is that either of STR_FACILITY1 and STR_FACILITY2 needs to be present somewhere among all bases?

None of your options is correct.

The example above means "STR_FACILITY1 is present somewhere among all bases AND STR_FACILITY2 is not present in any base".

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: [DONE][Suggestion] Additional item trigger for mission scripts
« Reply #13 on: April 23, 2023, 06:41:04 pm »
It's AND.

None of your options is correct.

The example above means "STR_FACILITY1 is present somewhere among all bases AND STR_FACILITY2 is not present in any base".

Thank you for clarifying this.

I wonder, if it could be possible to check by the BaseFunc type?  E.g. if I had two types of psi labs, how could I depend on e.g. an ADVPSILAB?  I know that I could in principle for each event (scripted ones, through configuration only, without invoking a script engine) provide two entries, each checking for a specific building type.  However, is there a better solution?  Checking by BaseFunc would be much more streamlined and would avoid duplication of entries (which is not optimal in general, even with anchors, etc., especially in extension points).