OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Solarius Scorch on July 03, 2019, 04:40:34 pm

Title: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on July 03, 2019, 04:40:34 pm
I would like to request a new type of geoscape feature, based on a new type of script.

What it does: displays a custom pop-up message and awards points.

When it happens: same as alien missions, triggered by chance, month, research and other associated parameters.

I don't want to get into actual technicalities, but I imagine it could be done as a missionScript, except no UFO or site is generated (you get the popup instead) and there is no region or race.

Why do I want it?
I want a new tool for the game to affect the player. Right now we have two options: alien missions and arc scripts. Both are partially applicable, but none can do it well; most notably, missions require actual objects on the geoscape, while arc events cannot be repeatable, etc.

What will I do with this?
All sorts of fun stuff.

Example 1) Hurry up. If you haven't accomplished something by a certain time, something bad will happen.
Haven't destroyed a cult, even though you should have done this ages ago? They just assassinated a politician, costing you points.

Example 2) Rewards. Having something researched or being within some timeframe enables you to get something at random, outside the mission system.
So you discovered some alien conspiracy? An anonymous donor sent you a crate of weapons to further your cause. May be influenced by month (the earlier, the better chance).

Example 3) Random events, Microprose-style.
Something explodes, costing you points. You impressed a UN official, giving you points. Your daughter suddenly got married to a Hybrid representative, so they give you some research as a wedding gift. Etc., etc.

Finnik already expressed interest in coding it, but we'd like to hear your opinion first. Would you agree to add something like this? If yes, what are your requirements/advice?

EDIT: The event can also give research, items, etc. If not a problem, chosen randomly from a given list.
Title: Re: [Suggestion] Pop-up events
Post by: Meridian on July 03, 2019, 04:47:18 pm
Requirement: "displays a custom pop-up message and awards points"


Example 1: doesn't award points but steals them

Example 2: no points awarded or stolen, and there is something about items which was not in the requirements

Example 3: points stolen again, mixed with items that were not required


None of the examples matches the requirement.


In general, OK with me.
Title: Re: [Suggestion] Pop-up events
Post by: Solarius Scorch on July 03, 2019, 04:53:06 pm
Oops, the part with assigning items/research disappeared from my post... Corpo bathroom is not a good place to type long posts :)
As for the points, I thought I could simply give an event a negative value, but if it's not how it works, then whatever should be done.
Thanks for greenlighting the idea!
Do you think it can be done with missionScripts, or we need some new entity?
Title: Re: [Suggestion] Pop-up events
Post by: Meridian on July 03, 2019, 05:25:20 pm
new, let's say eventScript
Title: Re: [Suggestion] Pop-up events
Post by: Solarius Scorch on July 03, 2019, 05:27:48 pm
OK, thanks.
In this case I propose to keep exactly the same flags/format, since they generally overlap.
I just know I'll mix them up otherwise!
Title: Re: [Suggestion] Pop-up events
Post by: luke83 on July 05, 2019, 12:56:00 am
Could be useful for me also... Watching with interest.
Title: Re: [Suggestion] Pop-up events
Post by: Nord on July 05, 2019, 06:32:24 am
Yes indeed, great idea.
Title: Re: [Suggestion] Pop-up events
Post by: Finnik on July 07, 2019, 01:01:50 am
I've made some progress with that feature. Thanks to all who helps me to understand how the code works!
I'm sure my code is not perfect, but as a very initial thing it looks working, any advise how to make it better are welcome.
At the moment, I accept such rulset input:
Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT             # the type/name is used for overwriting or deleting purposes
    eventWeights:                           # list of event names with weights, nothing will happen if omitted
      0:                                    # these are split into monthly chunks, just like in mission scripts do
        STR_TEST_EVENT1: 50         
        STR_TEST_EVENT2: 50
    firstMonth: 0                           # months this command runs on, 0 runs on startup of a new game (default 0)
    lastMonth: 12                           # don't run after this month. -1 denotes no limit (default -1)
    executionOdds: 100                      # % chances of this command executing (default 100)
    minDifficulty: 0                        # this command only applies to difficulty levels of this or above (default 0)
    maxDifficulty: 4                        # this command only applies to difficulty levels of this or below (default 4)
    researchTriggers:                       # a list of research topics that can influence the execution of this command (default empty)
       STR_THE_MARTIAN_SOLUTION: true       # in this case, the command would only run if the player has the Martian Solution
       STR_CYDONIA_OR_BUST: false           # and does NOT have Cydonia or Bust

events:
  - name: STR_TEST_EVENT1                   # name of the event, used for linking to eventScripts
    description: STR_TEST_DESCRIPTION       # text, that describes the event and shows in the popup window. If omitted, no popup window will open, so you can design it as a hidden event or just Ufopedia article (see below).
    background: BACK01.SCR                  # sets the background to the popup window. Defaul is BACK13.SCR
    points: -8000                           # amount of global score points (or research score), that player will have at the end of the month (a positive value means bonus, negative - penalty)
    funds: 1000000                          # amount of money in $ that will receive player as an event outcome (a positive value means bonus, negative - penalty)
    timer: 2100                             # fixed delay timer in minutes for the event to occur after the start of the month (rounded down to the nearest 30, default 0)
    timerRandom: 600                        # additional random part for delay timer, the game chooses a value between 0 and this number to add to event delay timer (default 0)
    bonusResearch: STR_EVENT_RESEARCH       # research project, that will be discovered after an event occurs. can also trigger its getOneFree and getOneFreeProtected and respect its sequentialGetOneFree and spawnItem properties
    abortResearch: STR_TERMINATE_EVENT      # research project, the discovery of which will terminate already spawned event from occurring to the player and delete ongoing event from the game
    spawnedItem: STR_LASER_PISTOL           # this item will be transferred to players first base after event spawned

Here is a small presentation of how it works in-game. Sorry my poor English, I was really nervous about events future while recording it.

I'd like to hear your feedback about events feature and if there could be some code or game design improvement. Also, I would like to discuss these topics:

1) As research discovering processing individually, id like to make possible for bonusResearch to also respect research properties, such as getOneFree, getOneFreeProtected and sequentialGetOneFree. That will make possible for a modder to design more complex events scenarios, making it random and predictable at the same time. You can set up several events with one project as bonusResearch, having a sequence of getOneFrees (let's say, a chain of investigation for XCF). So, your player will come to a single chain of opened Ufopedia articles, that will describe sequentional arc story, but the player will have access to it in different ways in order, that you as a modder can't predict, but it will outcome as a solid story that will be told in the order you specify. I'd guess, we will be closer to it if another bonus researches could trigger getOneFrees, but this is a different topic. Anyway, as a modder and game designer that helps in the development of XCF, I definitely need that one.

2) As for the score, I'm operating with the global score (or researchScore, if you prefer), as there is no specification for the region. It's not hard to add processing of region with what spawned event should be associated. I didn't do it as it was not in initial suggestion and I'd like to know if someone needs that. I think it would be a good upgrade to my logic.

3) Should there be moddable colors as event property and if yes, maybe devs will share their wisdom how to do that.

4) As an outcome for that discussion I'd really would like to know if there any chance for my thing to be integrated to OXCE and if yes, what changes to it I need to do.
Title: Re: [Suggestion] Pop-up events
Post by: Solarius Scorch on July 14, 2019, 09:25:19 pm
Respecting research properties would be neat, as it's a decent tool for modding fuckery and also easily avoided if so desired.
But what's really interesting is the option to run events by region. After all, "A group of Chaos cultists in STR_SOUTH_AMERICA" sounds much more interesting than "A group of Chaos cultists in buggerall on Earth".


To reiterate: in the current code from Finnik, the points from events count against the research pool - the only pool which is global. Which is fine and correct for general events, unrelated to any region. Like for example, "you impressed the Council with your mad juggling skills".
But I would also like a subset which works with regions. For example a terrorist attack which costs you points should be region-based rather than general, because that's how the game works. Also, "Something rotten in Scandinavia" sounds better than ""Something rotten in some unspecified location on Earth."

To expand it even further, it would be cool if the message displayed could optionally also mention a random city in the region. "Political assassination in Irkutsk" just sound way better than "Political assassination in Siberia".
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on September 12, 2019, 09:46:03 am
Test build: https://lxnt.wtf/oxem/builds//Extended/Extended-5.6.3-2eae16abd-2019-09-12-win64.7z

Sample ruleset (also attached as zip):

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    eventWeights:
      0:
        STR_TEST_EVENT1: 90
        STR_TEST_EVENT2: 10
      6:
        STR_TEST_EVENT1: 100
    firstMonth: 0
    lastMonth: 12
    executionOdds: 100
    minDifficulty: 0
    maxDifficulty: 4
  - type: STR_TEST_EVENT_SCRIPT2
    eventWeights:
      0:
        STR_TEST_EVENT2: 100
    firstMonth: 0
    lastMonth: 12
    executionOdds: 100
    minDifficulty: 0
    maxDifficulty: 4
    researchTriggers:
       STR_THE_MARTIAN_SOLUTION: true
       STR_CYDONIA_OR_BUST: false

events:
  - name: STR_TEST_EVENT1
    description: STR_TEST_DESCRIPTION1
    background: BACK13.SCR
    regionList: [STR_NORTH_AMERICA, STR_EUROPE]
    city: true
    points: 2000
    funds: 100000000
    itemList: [STR_LASER_PISTOL, STR_SOMETHING_ELSE]
    randomItem: false        # false = all items from the list are given, true = only one item is given (randomly)
    researchList: [STR_LASER_PISTOL]
    interruptResearch: STR_LASER_PISTOL
    timer: 1700
    timerRandom: 60
  - name: STR_TEST_EVENT2
    description: STR_TEST_DESCRIPTION2
    background: BACK01.SCR
#    regionList: []
#    city: false
    points: -2000
    funds: -100000000
#    itemList: [YYY]
    researchList: [STR_LASER_RIFLE]
#    interruptResearch: XXX
    timer: 2700
    timerRandom: 150

extraStrings:
   - type: en-US
     strings:
       STR_TEST_EVENT1: "Political assassination in {0}"
       STR_TEST_EVENT2: "Test title"
       STR_TEST_DESCRIPTION1: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
       STR_TEST_DESCRIPTION2: "This one is rather short."
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on September 12, 2019, 01:19:14 pm
Thank you.

I'm having lots of fun with this!
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord on September 12, 2019, 02:50:15 pm
Really great. Many ideas hovering in air around my head...
Meridian we praise.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on September 18, 2019, 08:41:10 pm
Added more attributes.
First, similar to research triggers, there are item triggers.

Code: [Select]
eventScripts:
  - type: xxx
...
    itemTriggers:
       STR_ITEM1: true
       STR_ITEM2: 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

Second, 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]
eventScripts:
  - 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]
eventScripts:
  - type: xxx
...
    minFunds: -1000
    maxFunds: 200
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on October 10, 2019, 08:24:23 pm
More attributes added (oneTimeSequentialEvents and oneTimeRandomEvents) into the eventScript for one-time (non-repeatable) events.

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    eventWeights:                 # randomly generated repeatable events
      0:
        STR_TEST_EVENT_A: 100
        STR_TEST_EVENT_B: 100
    oneTimeSequentialEvents:      # sequentially generated one-time events (cannot repeat)
      - STR_TEST_EVENT2
      - STR_TEST_EVENT3
      - STR_TEST_EVENT4
      - STR_TEST_EVENT5
    oneTimeRandomEvents:          # randomly generated one-time events (cannot repeat)
      STR_TEST_EVENT1R: 100
      STR_TEST_EVENT2R: 100
      STR_TEST_EVENT3R: 100
      STR_TEST_EVENT4R: 100
      STR_TEST_EVENT5R: 100

Although you can use all 3 types in one script, I suggest using only one type at a time (i.e. split it into multiple scripts)
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on October 31, 2019, 12:05:39 pm
More attributes added for events:

1. music - String ID of the music to play when this event pops up on the Geoscape.
2. everyItemList - A list of item IDs. When this event pops up they are all transferred to the HQ (within 1 hour).
3. randomItemList - A list of item IDs. When this event pops up one of them is selected randomly and transferred to the HQ (within 1 hour).
4. weightedItemList - A weighted list of item IDs. When this event pops up one of them is selected randomly (respecting given weights) and transferred to the HQ (within 1 hour).

Attributes itemList and randomItem have been deprecated (and will be removed in oxce 6.2).

Edit:

5. everyMultiItemList - A list of item IDs and their quantities. When this event pops up they are all transferred to the HQ (within 1 hour).
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on January 14, 2020, 09:27:45 pm
Can I use both randomItemList and everyItemList in the same event?

Code: [Select]
   - name: STR_COLD_PACKAGE
    description: STR_COLD_PACKAGE_DESCRIPTION
    background: BACK13.SCR
    randomItemList: [STR_SECTOID_CORPSE, STR_FLOATER_CORPSE, STR_SNAKEMAN_CORPSE]
    everyItemList: [STR_PISTOL, STR_PISTOL_CLIP, STR_PISTOL_CLIP]
    timer: 20

In this case, you get the pistol, two clips, and a random corpse: Sectoid, Floater or Snakeman.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on January 14, 2020, 11:45:05 pm
Can I use both randomItemList and everyItemList in the same event?

Code: [Select]
   - name: STR_COLD_PACKAGE
    description: STR_COLD_PACKAGE_DESCRIPTION
    background: BACK13.SCR
    randomItemList: [STR_SECTOID_CORPSE, STR_FLOATER_CORPSE, STR_SNAKEMAN_CORPSE]
    everyItemList: [STR_PISTOL, STR_PISTOL_CLIP, STR_PISTOL_CLIP]
    timer: 20

In this case, you get the pistol, two clips, and a random corpse: Sectoid, Floater or Snakeman.

yes
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on January 15, 2020, 02:11:33 pm
Thanks! This will make things more fun.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on May 14, 2020, 08:06:06 pm
Added more attributes (in OXCE v6.5).
Similar to research and item triggers, there are base facility triggers.

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

Facilities from all bases are considered.

-------

Also, there is a "affectsGameProgression" flag.

If set to true, research topics from "researchTriggers" will display a small disclaimer in the TechTreeViewer about affecting game progression.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: efrenespartano on June 04, 2020, 04:08:41 pm
Hi, Meridian!

I have a suggestion: could be possible to have soldierTypes as reward for the events? I have some "Reinforcements have arrrived" event in mind,  where some new soldiers and their weapons are send to the player, but AFAIK only points/score/research/items are granted
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on June 04, 2020, 04:17:52 pm
Hi, Meridian!

I have a suggestion: could be possible to have soldierTypes as reward for the events? I have some "Reinforcements have arrrived" event in mind,  where some new soldiers and their weapons are send to the player, but AFAIK only points/score/research/items are granted

The issue is that the living quarters will get overfull.

If that doesn't bother you, I can add it.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: efrenespartano on June 04, 2020, 04:48:36 pm
The issue is that the living quarters will get overfull.

If that doesn't bother you, I can add it.

Not at all! I want to make impossible to get certain soldiers only available by events, to balance it. Thanks a lot for accepting my suggestion! :D
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on June 04, 2020, 04:55:20 pm
I am okay with that too.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord on June 04, 2020, 07:49:32 pm
The issue is that the living quarters will get overfull.

If that doesn't bother you, I can add it.
But you allready can gain an item, let's say "squaddie", which will be manufactured into soldier.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on June 04, 2020, 07:51:21 pm
But you allready can gain an item, let's say "squaddie", which will be manufactured into soldier.

I know.
Looks like people don't like it.

Repeating the same thing over and over is not fun, eventually I just give up.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on October 07, 2020, 12:03:55 pm
Hi, Meridian!

I have a suggestion: could be possible to have soldierTypes as reward for the events? I have some "Reinforcements have arrrived" event in mind,  where some new soldiers and their weapons are send to the player, but AFAIK only points/score/research/items are granted

Added.

spawnedPersons: how many persons to spawn
spawnedPersonType: scientists, engineers or soldier types
spawnedPersonName: translatable fixed name
spawnedSoldier: overrides for randomly generated soldiers, using saved game syntax, you can override anything except soldier ID

Examples:

Code: [Select]
events:
  - name: STR_TEST_EVENT1                 
    spawnedPersons: 5                     
    spawnedPersonType: STR_SCIENTIST     

  - name: STR_TEST_EVENT2                 
    spawnedPersons: 10                   
    spawnedPersonType: STR_ENGINEER       

  - name: STR_TEST_EVENT3                 
    spawnedPersons: 3                     
    spawnedPersonType: STR_SOLDIER       
    spawnedSoldier:
      nationality: 0
      rank: 3  # captain
      currentStats:
        tu: 100
        stamina: 100
        health: 100
        strength: 100

eventScripts:
  - type: STR_TEST_EVENT_SCRIPT           
    eventWeights:                         
      0:                                 
        STR_TEST_EVENT1: 50         
        STR_TEST_EVENT2: 50
        STR_TEST_EVENT3: 50

Living quarters availability is not checked.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: tarkalak on October 12, 2020, 06:09:22 pm
Would it be useful to have events that have several possible outcomes that the player must chose from?

Example:
A group of hikers have wandered near X-COM base 1 and have seen something that we don't want them to talk about. We can quietly dispose of them, detain them or let them go with a few bruises and a stern warning to never talk about it ever.
Option 1: You pay money to have them disposed of. (-30000)
Option 2: You detain them. (they show up in your prison)
Option 3: You let them go. (-200 points)

Where each Option is a different button.

I am not a moder, so I am not sure if that will be of any interest. I assume that it can be used for choosing different paths in a campaign too.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: QuybiT on October 20, 2021, 01:29:56 pm
Hi Meridian.

I would like to see a dependence on the location of the base by country and region and linking them to events.
Depending on where we built a base, we will be given different bonuses through pop-up events. So players will have the variety to start the game anywhere, rather than where it is more convenient to cover most of the countries radar. For example, you can bind the event on the issuance of the MiG-31 on promotion 2 if you have the first base in Russia. Or the locals from Fuso decided to introduce us to their famous weapons. These are examples of different mods in which you can add something unique, and allow players to feel all the charm of the countries in which the modder will put his soul.
So for modders there will be a chance to implement base location mechanics like in the numbered parts of x-com.
And I apologize for my English, I hope you understand.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on October 20, 2021, 02:38:08 pm
Understood.
It's easy to do.

If some modder shows interest in it, I'll put it on the todolist.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Solarius Scorch on October 21, 2021, 06:21:44 pm
It's a good idea. Some mods (like Chronicles) aim to make the base location a meaningful choice, and this would fit in nicely.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Dioxine 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?
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord on October 22, 2021, 12:54:09 pm
Looks great!
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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?
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Nord 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?
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Hobbes 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. :)
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik 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.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Hobbes 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!
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian 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."
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik on August 11, 2022, 09:23:20 am
What about check for having specific soldier types on the base? Like stacking 20 dogs on a base would spawn something fun :)
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on August 11, 2022, 09:50:03 am
You know how I hate sentences beginning with "What about".

Either you need it or you don't need it... say it clearly please.
I cannot read minds.

If that wasn't a question for me, I apologize in advance.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik on August 13, 2022, 09:53:23 am
Sorry. I do need this property. I wonder if it can be done in OXCE?
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on August 14, 2022, 10:31:37 am
OK.

Do you have any specific syntax in mind?

Do you want to do a PR or should I implement it myself?
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik on August 14, 2022, 12:12:41 pm
OK.

Do you have any specific syntax in mind?

Do you want to do a PR or should I implement it myself?

I was thinking about something like that.
Code: [Select]
  - type: wildDogs
    oneTimeSequentialEvents: [STR_WILD_DOGS]
    soldierTypeTriggers:
      STR_SOLDIER: false
      STR_DOG: true
    executionOdds: 100

So once you process scripts, you iterate through all bases to see if a single base match those conditions. Would be enough for me, but AFAIK there is a regional system for event scripts (what region causes the event), not sure if those should interact somehow...
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Meridian on August 22, 2022, 09:13:39 pm
I was thinking about something like that.
Code: [Select]
  - type: wildDogs
    oneTimeSequentialEvents: [STR_WILD_DOGS]
    soldierTypeTriggers:
      STR_SOLDIER: false
      STR_DOG: true
    executionOdds: 100

Added.
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Finnik on October 21, 2022, 09:31:14 am
Thanks!
Title: Re: [DONE] [Suggestion] Geoscape pop-up events
Post by: Aldorn on December 16, 2023, 03:07:11 am
More attributes added for events:

1. music - String ID of the music to play when this event pops up on the Geoscape.
2. everyItemList - A list of item IDs. When this event pops up they are all transferred to the HQ (within 1 hour).
3. randomItemList - A list of item IDs. When this event pops up one of them is selected randomly and transferred to the HQ (within 1 hour).
4. weightedItemList - A weighted list of item IDs. When this event pops up one of them is selected randomly (respecting given weights) and transferred to the HQ (within 1 hour).

Attributes itemList and randomItem have been deprecated (and will be removed in oxce 6.2).

Edit:

5. everyMultiItemList - A list of item IDs and their quantities. When this event pops up they are all transferred to the HQ (within 1 hour).
All these new features are really wonderful  ::)

I hope you know that OpenXCom and OXCE are the best remastered game ever (in this I include both: the best game, and the best way to remaster a game)



I would have a question about eventScripts >> facilityTriggers

Definition of facilityTriggers is: A list of base facilities that can influence the execution of this script. Similar to research triggers; checks the presence of a facility (in any xcom base).

Apparently, it does not wait for a facility to be built. As soon as you build it, event is triggered, even if the facility will be available/functional in 1 month

Is it expected, or do I miss something?

Code: [Select]
eventScripts:
  - type: STR_TRAINING_TICKET_MONTHLY_EVENT_SCRIPT
    facilityTriggers:
       STR_TRAINING_ROOM
    eventWeights:
      0:
        STR_TRAINING_TICKET_MONTHLY_EVENT: 100
    #firstMonth: 0
    #lastMonth: -1
    executionOdds: 100

EDIT: in fact, I think what I wrote does not work, as it triggers even if I don't build anything

I made other attempts writing it differently, unsuccessfully (i.e., the event is triggered after the first hour):
Removing 1 space before STR_TRAINING_ROOM
Code: [Select]
eventScripts:
  - type: STR_TRAINING_TICKET_MONTHLY_EVENT_SCRIPT
    facilityTriggers:
      STR_TRAINING_ROOM
Using brackets
Code: [Select]
eventScripts:
  - type: STR_TRAINING_TICKET_MONTHLY_EVENT_SCRIPT
    facilityTriggers: [STR_TRAINING_ROOM]
Do as for researchTriggers
Code: [Select]
eventScripts:
  - type: STR_TRAINING_TICKET_MONTHLY_EVENT_SCRIPT
    facilityTriggers:
      STR_TRAINING_ROOM: true

EDIT2: forget that, I will do this differently by adding some research, making training tickets availble for purchase, with a monthlyBuyLimit