Author Topic: [DONE] [Suggestion] Geoscape pop-up events  (Read 22929 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #30 on: October 21, 2021, 06:25:05 pm »
I find this very interesting, as it is a tool which could immensely increase player's immersion if a modder puts enough work into it. Important: it must be possible for such events to fire in the 1st month. I'm not sure, however, how this should be linked to bases other than 1st one (if at all?) because it's complicated topic. Should it be "if ANY base exists which meets prerequisites" like it is now with events?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #31 on: October 22, 2021, 12:35:43 pm »
Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT           
    eventWeights:                         
      0:                                 
        STR_TEST_EVENT1: 50         
        STR_TEST_EVENT2: 50
        STR_TEST_EVENT3: 50
    xcomBaseInRegionTriggers:
       STR_EUROPE: true              # at least 1 xcom base in Europe
       STR_SOUTH_AMERICA: false      # and no xcom bases in South America
    xcomBaseInCountryTriggers:
       STR_FRANCE: false             # and no xcom bases in France

I'd add something like the above.

For event scripts, arc scripts and mission scripts.
« Last Edit: October 24, 2021, 01:49:45 pm by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #32 on: October 22, 2021, 12:54:09 pm »
Looks great!

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #33 on: December 30, 2021, 11:07:28 am »
More event script attributes added in OXCE 7.3

Ability to access the mission script internal variables for mission generation tracking.

Example: spawn an event after 3 shipping lane missions were generated in TFTD

EDIT: more info and examples here: https://openxcom.org/forum/index.php/topic,10318.0.html
« Last Edit: January 09, 2022, 11:02:59 pm by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #34 on: February 06, 2022, 10:48:01 am »
Two questions:
1. Will "itemTriggers" work with live alien in prison?
2. Is it somehow possible to remove items from store instead of adding one?
Thanks.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #35 on: February 06, 2022, 10:59:43 am »
Two questions:
1. Will "itemTriggers" work with live alien in prison?
2. Is it somehow possible to remove items from store instead of adding one?
Thanks.

1. yes... but only the ones that are not currently being researched (...unless the research doesn't need/destroy items)

2. not yet... how would that work?

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #36 on: February 06, 2022, 11:06:27 am »
2. not yet... how would that work?
Well, if we have an item (checked with itemTriggers), then we can remove it.
But i understand, that such feature can lead to multiple bugs if not implemented properly by modder.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #37 on: February 06, 2022, 11:11:20 am »
Well, if we have an item (checked with itemTriggers), then we can remove it.
But i understand, that such feature can lead to multiple bugs if not implemented properly by modder.

Just gathering info how would it work, let's start with the simple questions:

1. should the item be removed immediately when checked, i.e. when the event is generated ..... or later when the event pops up? (which could be days or weeks later and the item might not exist anymore)

1b. should the item be "returned" if the event gets cancelled between generation and popup?

2. if during event popup... what if the player sold or used the item in the meantime? or if the item is not in the stores but in a craft, or worn on a soldier, or being researched, or being transferred, etc.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #38 on: February 06, 2022, 11:25:54 am »
Yep, as i say, it will cause many misunderstandings and bugs. Maybe it is not worth it?

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #39 on: February 20, 2022, 03:39:16 pm »
I'd say that the only reasonable way to implement item removing. We use `itemTriggers` to check if we should spawn the event. Then, when the time has come, at the very beginning of the process, even before opening the state, we process this removing item event's property. We cycle through all player bases to find and delete the item. If we fail to do so, we terminate the event, deleting it from the save before the event state would occur.
A bit more code if you want to handle multiple items, you would need to check if you can delete all of them, and only then delete it. Probably, it is worth to invest in some RNG in case when we can delete item from different base, so this would be less predictable.
Not very elegant, I guess, as now all event logic is located in its state. BTW, that is why I initially made it like a savegame thing (like alien missions), with visible state displayed only if desired.
« Last Edit: February 20, 2022, 03:40:56 pm by Finnik »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #40 on: March 09, 2022, 06:48:45 pm »
I've implemented eventScripts and events to TechComm, along with arcScripts and I have feedback:

1) Are eventScripts and arcScripts redundant? I made the suggestion for arcScripts for storytelling proposes and I've been using it, but when I implemented eventScripts the only difference I saw was that one is executed before missionScripts and the other after missionScripts. Or perhaps codewise it's necessary to split them because of this crucial difference.

2) It's on my testing list, but I might ask it: can craft be added through events? I'm doing by giving an item (Craft Fuselage) that can be manufactured into a craft. It fits the TechComm universe, but at the same time I'm wishing for a simpler system where you just get the craft.

3) Also on my testing list: can negative values be used in events for score/funding/etc. loss?

4) randomItemList - can it be set to give more than 1 item? That's the only option missing from all the others.

And to conclude great work with the event generator. :)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #41 on: March 10, 2022, 10:31:00 am »
1) they started as separate functionality:
- arc scripts were invisible behind-the-scenes highest-level game progression tool
- event scripts were player-focused small cosmetic and sometimes annoying lowest-level info messages and fluff

But since everybody wants to misuse everything for everything, they have grown to have a significant overlap.

They still have differences, like the mentioned order of operations, and several more.

Even if redundant, they're not going anywhere, for backwards-compatibility reasons, so feel free to use whichever suits your needs better.

2) no, you can't give a craft via events directly... I can put it on todolist... but there are questions like: what should happen if there's not enough hangar space when the event pops up?

3) yes

4) `everyItemList` and `everyMultiItemList` give all items; `randomItemList` and `weightedItemList` give one item

None of these options allows giving multiple items (e.g. 7 from 34), they either give 1 or all.
If you have a syntax example, I can add a fifth option suited to your needs.
« Last Edit: March 10, 2022, 10:33:48 am by Meridian »

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #42 on: March 10, 2022, 10:50:39 pm »
I use arc scripts for hidden triggers, if I don't want to notify the player about it.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #43 on: March 12, 2022, 09:55:03 pm »
1) they started as separate functionality:
- arc scripts were invisible behind-the-scenes highest-level game progression tool
- event scripts were player-focused small cosmetic and sometimes annoying lowest-level info messages and fluff

But since everybody wants to misuse everything for everything, they have grown to have a significant overlap.

They still have differences, like the mentioned order of operations, and several more.

Even if redundant, they're not going anywhere, for backwards-compatibility reasons, so feel free to use whichever suits your needs better.

Now you made me curious about the additional differences... I guess I'll have to keep using both to find out :)

Quote
2) no, you can't give a craft via events directly... I can put it on todolist... but there are questions like: what should happen if there's not enough hangar space when the event pops up?

I agree, better leave it as it is.

Quote
4) `everyItemList` and `everyMultiItemList` give all items; `randomItemList` and `weightedItemList` give one item

None of these options allows giving multiple items (e.g. 7 from 34), they either give 1 or all.
If you have a syntax example, I can add a fifth option suited to your needs.

What I'm looking for would either be a randomMultiItem option, in order to regularly give the player different quantities of items. It would have two possible syntaxes:

Code: [Select]
    randomMultiItemList:
      - STR_FUEL
        quantity: 3
      - STR_PISTOL_AMMO
        quantity: 3
      - STR_RIFLE_AMMO
        quantity: 3

Or, even better, a true randomMultiItemList. I have already this functionality implemented in TechComm through multiple events and yaml anchors, where there are 20 random events that each gives a different craft weapon and ammunition:
Code: [Select]
    randomMultiItemList
      Item List 1:
      - STR_HYDRA_LAUNCHER: 1
      - STR_HYDRA_ROCKETS: 50
      Item List 2:
      - STR_SIDEWINDER_LAUNCHER: 1
      - STR_SIDEWINDER_MISSILES: 6

Thank you for the answers!
« Last Edit: March 12, 2022, 10:04:46 pm by Hobbes »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [DONE] [Suggestion] Geoscape pop-up events
« Reply #44 on: August 05, 2022, 04:17:38 pm »
What I'm looking for would either be a randomMultiItem option, in order to regularly give the player different quantities of items. It would have two possible syntaxes:

<snip>

Or, even better, a true randomMultiItemList. I have already this functionality implemented in TechComm through multiple events and yaml anchors, where there are 20 random events that each gives a different craft weapon and ammunition:

<snip>

Added.

Example:

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    oneTimeSequentialEvents:
      - STR_TEST_EVENT
events:
  - name: STR_TEST_EVENT
    description: STR_TEST_DESCRIPTION1
    randomMultiItemList:
      -
        STR_AVALANCHE_LAUNCHER: 2
        STR_AVALANCHE_MISSILES: 10
      -
        STR_STINGRAY_LAUNCHER: 3
        STR_STINGRAY_MISSILES: 15
      -
        STR_CANNON: 4
        STR_CANNON_ROUNDS_X50: 20
    timer: 100
    timerRandom: 200
extraStrings:
   - type: en-US
     strings:
       STR_TEST_EVENT: "Test title"
       STR_TEST_DESCRIPTION1: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."