Author Topic: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command  (Read 6191 times)

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
I'm planning to make some additions to XCF terrains (ofc, its free to everyone else to use it), and as it has a lot of deployments, that uses its very own UFO (that looks like cults houses, for example).
For that the use specific mapScripts with defined UFO in addUfo command. First, it leads to tons of copypasting in mapScripts. Second, it does not let them use default mapScript from the terrain, and that's an issue to my concept. Also, it's impractical to match deployment name with its UFO, as we have many-to-many relations here.

So I'd really love to have the option to define ufo directly in the deployment rule, I'm proposing such syntax:

Code: [Select]
alienDeployments:
  - type: STR_MY_FAVORITE_CULT_HOUSE
    width: 40
    length: 40
    height: 4
    customUfo: STR_CULT_HOUSE                 # <------
    terrains:
      - TERRAIN_WITH_OWN_SCRIPT1
      - TERRAIN_WITH_OWN_SCRIPT1
    data:
...

I'm not sure if I did it all right, I guess there could be a more elegant solution, but I hope that could help a little:
https://github.com/FinnikXCF/OpenXcom/commit/12ec74f3a77f2e458b3ffb8c801dca208b73dd0f
It looks to me like its possible to merge it https://github.com/MeridianOXC/OpenXcom/compare/oxce-plus...FinnikXCF:oxce-plus

With it, map generator will look, if there is addUfo command, but we have no UFO defined in the usual way, so it gets ufo rules for optional alienDeployment property.

I would really appreciate any feedback on that, and I really want to know if such a ruleset option would become available in the upcoming release of OXCE, as I really need it in my work with terrains for compensation for recent events.
@Devs, if there is anything I can do to make it more fitting to OXCE, please, let me know, I'm really motivated in that feature.

Update by Meridian: ruleset attribute name changed to 'customUfo'. Code modified and merged.
« Last Edit: December 04, 2019, 03:19:11 pm by Meridian »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5460
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [SUGGESTION] Defining UFO directly in alienDeployment
« Reply #1 on: November 29, 2019, 02:04:11 pm »
It certainly looks like an improvement, as it would allow to use very complex or compoud terrains... Just gotta make a sanity check if all terrains have spawnUFO command.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Defining UFO directly in alienDeployment
« Reply #2 on: November 29, 2019, 02:41:58 pm »
I definitely applaud this feature. It would save us a lot of coding space, and mindless duplicates. What's more, it would eliminate the need to keep multiple versions of the same terrain for various purposes, which is a bit of a pain to control.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #3 on: December 04, 2019, 03:20:16 pm »
Merged.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #4 on: January 02, 2020, 02:15:06 pm »
Thank you!

EDIT:

It certainly looks like an improvement, as it would allow to use very complex or compoud terrains... Just gotta make a sanity check if all terrains have spawnUFO command.

As Finnik discovered, scripts can have the addUFO command even if there is no UFO, it is just ignored. So, there is no ned to put addUFO in any script.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #5 on: January 02, 2020, 02:22:14 pm »
As Finnik discovered, scripts can have the addUFO command even if there is no UFO, it is just ignored. So, there is no ned to put addUFO in any script.


That sentence doesn't make sense... what did you want to say?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #6 on: January 02, 2020, 03:36:57 pm »

That sentence doesn't make sense... what did you want to say?

I reread it and it makes perfect sense.

I meant to say that you don't need two scripts, with and without UFO (for UFO landings and terror missions). I assume it has to do with the improvement you coded on Dioxine's request to skip unplaceable UFOs, though I could be wrong.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #7 on: January 02, 2020, 04:31:09 pm »
Quote
So, there is no ned to put addUFO in any script.

If there was no need to put addUFO in any script... why would addUFO command even exist?

If you don't put addUFO into any script, no UFO will ever be generated.

Or am I missing something?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #8 on: January 03, 2020, 07:29:23 pm »
If there was no need to put addUFO in any script... why would addUFO command even exist?

If you don't put addUFO into any script, no UFO will ever be generated.

Or am I missing something?

*facepalm*
Okay... Sorry, I meant in every script.

So, previously we had two different terrains (a generic example, but also true for some mods):
- terrain URBAN (vanilla), with mapScript URBAN, for vanilla alien terror missions
- terrain URBANUFO, with mapScript URBANUFO, for crashed/landed UFOs (must be added to globe textures as possible terrains.
Both terrains consist of exactly the same mapblocks. The only difference is in the mapScript: URBANUFO has addUFO in the commands, while URBAN doesn't (because it's meant for terror missions only).

But it turned out that if there is the addUFO command in a mapScript, and there is no UFO to spawn (like in standard terror), the addUFO command is simply skipped with no ill effects. This means that we don't actually need two separate terrains and two separate mapScripts, it can be done with one and the same mapScript.
And let us rejoice :)

wcho035

  • Guest
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #9 on: January 04, 2020, 03:53:05 am »
This can be done already. If you are going to create a new mapscript for URBANUFO alone. Just for the sake of an ufo added to the vanilla terror mission.

For example.

  - type: URBANUFO
    commands:   
    - type: addUFO
      groups: 1
      UFOName: STR_FLEET_SUPPLY_CRUISERLAND
      terrain: URBAN
    - type: addCraft
      terrain: URBAN
      groups: 1   
    - type: addBlock
      size: 2
      execution: 2
      terrain: URBAN
    - type: fillArea
      terrain: URBAN

This will pretty much call the urban map from the terror mission and it became a ufo crash mission in the aliendeployment. May the aliendeployment can be a missionsite or ufo aliendeployment.
« Last Edit: January 04, 2020, 08:54:25 am by Precentor Apollyon »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #10 on: January 04, 2020, 03:41:57 pm »
This can be done already. If you are going to create a new mapscript for URBANUFO alone. Just for the sake of an ufo added to the vanilla terror mission.

Which is what I've been talking about all the time. (Assuming I understood your point.)

wcho035

  • Guest
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #11 on: January 04, 2020, 06:09:02 pm »
Sorry, I should have written, it can be done already, before the addufo feature was added to oxce.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Custom UFO for dummy/blank 'addUFO' mapscript command
« Reply #12 on: January 04, 2020, 09:46:22 pm »
Sorry, I should have written, it can be done already, before the addufo feature was added to oxce.

If you mean customUFO, then yes.