Author Topic: [SUGGESTION] Deployment switch by research  (Read 4522 times)

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
[SUGGESTION] Deployment switch by research
« on: August 10, 2020, 04:49:04 pm »
I would like to suggest a following feature:


Code: [Select]
  - type: STR_SMALL_SCOUT
    researchSwitch:
      STR_LASER_RIFLE:
        - STR_SMALL_SCOUT_WITH_LASER_RIFLES

STR_SMALL_SCOUT_WITH_LASER_RIFLES is another, separate deployment. If you don't have STR_LASER_RIFLE researched, the deployment is loaded as normal; but if you do, the game uses STR_SMALL_SCOUT_WITH_LASER_RIFLES instead of STR_SMALL_SCOUT.

If a deployment has multiple research switches, like in this case:

Code: [Select]
  - type: STR_SMALL_SCOUT
    researchSwitch:
      STR_LASER_RIFLE:
        - STR_SMALL_SCOUT_LASER_RIFLE
      STR_MEDI_KIT:
        - STR_SMALL_SCOUT_MEDI_KIT

and you have both prerequisites, then the game picks one of these two deployments at random.

The second-level deployment (the one the game uses instead of the basic one, because you have the necessary research) may also have researchSwitch of its own; when used, it forces the game to use yet another deployment. (This would be used to make "tiered" sets: the game normally uses deployment 1, but when you have research X it uses deployment 2, and if you have researches X and Y the game uses deployment 3.)

But what for?
In more story-driven mods, players' decisions are often represented as completing a certain research. Some such decisions may have impact on the battlescape. For example, in XCF you can either share some weapon techs with your allies or not; and if you do, they should use this tech in combat on cooperative missions (which is something the players request regularly).

Why not simply make a new mission and use scripts to differentiate between having and not having a certain research?
It's doable, but with more complex scripts becomes rather impractical. Many of my missions are launched from multiple scripts (depending on time, research projects etc.) despite having one and the same deployment. I wouldn't want to double that amount just to introduce more research conditions, if I can help it, and also make duplicates of the corresponding missions, regions and all that jazz. A simple switch on the deployment level as shown above would be a nice, simple solution (from a modder's perspective).

EDIT: Also would be nice to set some odds of the deployment switch (a chance for the switch to happen).
« Last Edit: August 10, 2020, 04:59:01 pm by Solarius Scorch »

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [SUGGESTION] Deployment switch by research
« Reply #1 on: August 10, 2020, 05:59:33 pm »
I see that research grown more and more to STATE of game :)

From my perspective, I think it should not check one but multiple research projects:

Code: [Select]
STR_SMALL_SCOUT_WITH_LASER_RIFLES:
  - STR_LASER_RIFLE
STR_SMALL_SCOUT_WITH_LASER_RIFLES_AND_WC:
  - STR_LASER_RIFLE
  - PERSONAL_WC
And game should find one that have more "hits", if its tie, then choose random as you wanted.

(this was only loose thoughts)

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Deployment switch by research
« Reply #2 on: August 10, 2020, 11:03:22 pm »
Yep, reversing the order is much better. I won't insist on my syntax at all, this looks cleaner anyway.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [SUGGESTION] Deployment switch by research
« Reply #3 on: August 11, 2020, 11:13:23 am »
and you have both prerequisites, then the game picks one of these two deployments at random.

Can't do random... deployment must be known before you go on a mission, so that we can check Starting Conditions.

STR_SMALL_SCOUT_WITH_LASER_RIFLES is another, separate deployment. If you don't have STR_LASER_RIFLE researched, the deployment is loaded as normal; but if you do, the game uses STR_SMALL_SCOUT_WITH_LASER_RIFLES instead of STR_SMALL_SCOUT.

Is this about full alien deployment definition ( https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Alien_Deployments )
or just about number of aliens and their weapons, similar to what 'craftCustomDeploy' attribute does today ( https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Deployment_Data )?

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Deployment switch by research
« Reply #4 on: August 11, 2020, 11:28:23 am »
Can't do random... deployment must be known before you go on a mission, so that we can check Starting Conditions.

Understood.
The random factor isn't important for me, it was simply a suggested way to solve issues with having multiple deployments and researches... But Yankes' suggestion eliminates that need, if I understand correctly.

Is this about full alien deployment definition ( https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Alien_Deployments )
or just about number of aliens and their weapons, similar to what 'craftCustomDeploy' attribute does today ( https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Deployment_Data )?

Ranks and weapons alone would be nice, but nicer would be also having access to modify civilians (mostly to enable better allies if you share tech with them).

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Deployment switch by research
« Reply #5 on: August 11, 2020, 12:21:27 pm »
I already have a similar feature in FtA if anybody cares, though syntaxis is simpler. In my realization, deployment is switched near the point when it altered because of _UNDERWATER and it alters not just data, but also all map generated. Not sure if its the best way (actually, I think you can do it much better, so would be interesting to compare it in learning purposes), but works just fine to player choose the way how to assault an alien base (I have 4 cases for my Advent regional HQ).

UPD:
I see that research grown more and more to STATE of game :)
So true, some times it is hard for new modders to realize how powerful a tool it is. In FtA, I think? ~1/3 or researches would be just technical, used only to set up scenarios to trigger missions, events, and triggered with deployments, events, arcs, covert operations, etc, etc. I thought if I should make a new entity for stuff like that, but for now, it's fine, having all that rich API. IMO next logical step is binding discovering of research (not just normal research with scientists, but from any source) to a y-script hook, for all that stuff affects the battlescape. With the topic's feature it would allow, us, for example, also manage additional effects to make story missions even more interesting and unique.
« Last Edit: August 11, 2020, 02:37:49 pm by Finnik »

Offline efrenespartano

  • Commander
  • *****
  • Posts: 765
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: [SUGGESTION] Deployment switch by research
« Reply #6 on: August 14, 2020, 07:27:20 am »
but nicer would be also having access to modify civilians (mostly to enable better allies if you share tech with them).

Hehehe I'm particularly interested on that! Civilians with better weapons is something that I've wanted since a long time))

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Deployment switch by research
« Reply #7 on: August 16, 2020, 02:16:18 pm »
Hehehe I'm particularly interested on that! Civilians with better weapons is something that I've wanted since a long time))

Already doable with FtA  ;) :-X