Author Topic: Combat analysis code  (Read 2394 times)

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Combat analysis code
« on: December 12, 2023, 04:44:29 pm »
Hello XCF authors.

I am very keen of your combat analysis feature. Would like to borrow it for other OXCE based mods. Would anyone explain how it works in game and where is the main piece of the code that makes it happen? Thank you in advance.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • ***
  • Posts: 11738
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Combat analysis code
« Reply #1 on: December 12, 2023, 06:02:27 pm »
Hi, it's just a plain old armour entry. Exactly the same as for X-com armours, but used for enemies.

Here's a sample entry:

Code: [Select]
ufopaedia:
  - id: STR_SECTOID_STANDARD_ARMOR
    type_id: 5
    section: STR_ALIEN_LIFE_FORMS
    requires:
      - STR_SECTOID_STANDARD_ARMOR
    text: STR_SECTOID_STANDARD_ARMOR_UFOPEDIA
    listOrder: 163001

In-game result attached.

Should work with basic OXC, too.

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #2 on: December 12, 2023, 06:11:56 pm »
Awesome! This is exactly what I wanted to do in my mod.
Can you show how do you order them in ufopaedia sections? Are they just added to "Alien Creatures" section?

Also, is it modified sectoid article or is it a separate article?
Also, how do you deal with multiple armors could be assigned to different sectoid ranks?
« Last Edit: December 12, 2023, 06:13:33 pm by Alpha Centauri Bear »

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Combat analysis code
« Reply #3 on: December 12, 2023, 06:31:05 pm »
Note that there's a somewhat hidden positive and a similar negative to these armour articles. Upside: the paperdoll can be reused for in-combat MMB enemy display and Ufopedia access. Downside: the armour articles use a different palette than Battlescape (Battlepedia, I think?), so your paperdoll might look fine in combat and suck in the pedia. You can either rework the image or change the palettes to conform, but it's a mildly involved task.

Articles are ordered by listOrder (but go into their respective sections, which can change that order), and sections are ordered by... their order of appearance in the ruleset, I think?

XCF entries are put into an 'Enemies and Allies' section, which is largely 'Alien Creatures' plus all other units that can appear in battle, from civilians to shadowy cults, military units and cryptids.

Also, you can move some info from the nerdpedia (INFO button) to the text if you wanted. That's how Piratez does things. Stuff like night vision, camo values, melee dodge, etc.

It's a separate article with its own article type, different from the general text/image type used by interrogations/autopsies.

Multiple armours can be handled in different ways. Solarius uses the base Sectoid (Soldier) and provides a short text that hints at the abilities of more advanced aliens. You could have a separate article for each armour if you wanted, though, or a combination of the two.

Also, you can move some of the info from the nerdpedia (INFO button) to the text if you wish. That's how Piratez does it. Stuff like night vision, camo, melee dodge, etc.
« Last Edit: December 12, 2023, 06:35:14 pm by Juku121 »

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #4 on: December 12, 2023, 06:39:00 pm »
Thank you for insights!

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • ***
  • Posts: 11738
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Combat analysis code
« Reply #5 on: December 14, 2023, 05:51:26 pm »
One thing I can add to what Juku has already said is that I use the ufopediaType flag on some armours:

Code: [Select]
armors:
  - type: STR_SECTOID_MEDIC_ARMOR
    ufopediaType: STR_SECTOID_STANDARD_ARMOR

So if you M-click on a Sectoid Medic, the game displays the standard Sectoid armour article.

Of course, you can also have multiple armour entries, if it makes more sense for your particular case.

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #6 on: December 14, 2023, 06:43:15 pm »
That is the neat feature.

So if you M-click on a Sectoid Medic, the game displays the standard Sectoid armour article.

How do you click on it? Just in the battlescape when you see it?

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Combat analysis code
« Reply #7 on: December 14, 2023, 08:07:32 pm »
Yes, click on the unit. The result looks like this. You can customise the background and everything.

You can even click on your own units or civilians.

Both the armour paperdoll and the stuff in their hands can be further middle-clicked for pedia access, assuming you've researched the relevant article.

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #8 on: December 14, 2023, 10:40:21 pm »
Neat. Thank you. Never new that. That solves many problems instanteneously.

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #9 on: December 15, 2023, 06:29:14 pm »
Hmm. When I click on Gillman I don't see the paper doll or the armor. What am I missing?

Do I need to research live Gillman?
Do I need to research dead Gillman?
Do I need to tie articles to a Gillman, its armor?
« Last Edit: December 15, 2023, 06:31:16 pm by Alpha Centauri Bear »

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Combat analysis code
« Reply #10 on: December 15, 2023, 06:39:48 pm »
The paperdoll, most likely. The base game only has paperdolls for X-Com armours, and only a few of those.

You also need an Ufopedia topic for the armour. Base game has none of those, either.

There's a set of paperdolls floating around in many mods, with some improvements by individual mod authors, but the UFO ones tend to be much better than their TFTD equivalents.
« Last Edit: December 15, 2023, 06:42:28 pm by Juku121 »

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #11 on: December 15, 2023, 06:55:41 pm »
Is paper doll absolutely required to generate clickable space or it may be just empty without it?

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Combat analysis code
« Reply #12 on: December 15, 2023, 07:05:37 pm »
A paperdoll is just an image, so I guess you can fill it with the 'index 0' colour and it will be transparent.

Edit: I'm wrong. But I suppose you can put in some sort of fake button instead, and use it for everything that doesn't have a paperdoll.

Edit2: Like this.
« Last Edit: December 15, 2023, 07:31:32 pm by Juku121 »

Offline Alpha Centauri Bear

  • Colonel
  • ****
  • Posts: 466
    • View Profile
Re: Combat analysis code
« Reply #13 on: December 15, 2023, 07:47:24 pm »
That seems like complicated image creation. I'll see if I can steal one from other mod.

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Combat analysis code
« Reply #14 on: December 15, 2023, 09:38:54 pm »
Well, depends on how fancy you want to get. The above very simple image took me a few minutes to make and put into the game. A proper one would be more involved.

Paperdolls would certainly be more immersive. The biggest issue with this is that I understand you're trying to make a TFTD mod - and TFTD aliens have the worst-looking community-created paperdolls by far.