Author Topic: [DONE][Suggestion]Pass through shield  (Read 8472 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
[DONE][Suggestion]Pass through shield
« on: November 20, 2018, 03:06:48 pm »
It will be good to allow one or more damage types to bypass shields, damaging health without lowering shield charge.
(I think i can do this by self, but script master can avoid possible bugs)
Thanks.
« Last Edit: February 01, 2023, 10:29:14 am by Meridian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #1 on: November 20, 2018, 03:26:49 pm »
This is already in the scripts I wrote for shields in the battlescape, both Piratez and XCF have examples of shields that just let certain damage types pass through.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #2 on: November 20, 2018, 03:50:11 pm »
Sorry, did not noticed. Where can i find it? (How to define which type of damage goes through)

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #3 on: November 20, 2018, 05:21:48 pm »
Here's an example of a shield that only protects against a few damage types. The important lines for letting certain damage types pass through are
Code: [Select]
            if or eq damaging_type 0 eq damaging_type 1 eq damaging_type 2 eq damaging_type 3 eq damaging_type 6;
              return power part side;
            else or eq damaging_type 7 eq damaging_type 8 eq damaging_type 9 eq damaging_type 10 eq damaging_type 11;
              return power part side;
            else or eq damaging_type 15 eq damaging_type 16 eq damaging_type 17;
              return power part side;
Any damage type that's placed in one of these lines returns from the script function before it has a chance to apply the shields. The reason to have them split across multiple lines like this is that the script engine can only accept so many arguments in the if statement before being overloaded.

The_Funktasm

  • Guest
Re: [Suggestion]Pass through shield
« Reply #4 on: November 20, 2018, 05:32:21 pm »
For a moment I interpreted this as an object that blocks projectiles but not unit movement, like a forcefield/shield membrane.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #5 on: November 20, 2018, 05:36:14 pm »
For a moment I interpreted this as an object that blocks projectiles but not unit movement, like a forcefield/shield membrane.

I think that's possible without scripts, just with MCD properties.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #6 on: November 20, 2018, 05:41:21 pm »
Thank you very much.
It is easy to do. But i think these MCD's will be not transparent.

--- posts merged ---

Sorry for doublepost.

One more question:
If we use two damage types in item rule, like this:
Code: [Select]
    damageType: 1
    damageAlter:
      ResistType: 2
Which tipe of damage will use shield script?
« Last Edit: November 23, 2018, 02:38:32 pm by Solarius Scorch »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #7 on: November 23, 2018, 10:18:00 pm »
One more question:
If we use two damage types in item rule, like this:
Code: [Select]
    damageType: 1
    damageAlter:
      ResistType: 2
Which tipe of damage will use shield script?
There is only one damage type, and it is `ResistType`. `damageType` exists only for backward compatibility and for default values for `damageAlter`.
Load first process `damageType` (if exists) and then process `damageAlter` (if exists).

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #8 on: November 24, 2018, 01:25:30 pm »
So, the second one will be used.
Thanks, it is good.

Upd.: (no one will see it, but doubleposting is bad :)
More questions:
1. If an item is not researched and not available for use(artifact). And it have special abilities like space towel from piratez. Will these effects apply if an item is held in inventory?
2. If a unit have armor with shield, and holds in hand activated item with shield, which one will be used?

--- posts merged ---

3. Am i doing something wrong, or is item-based shield not shows blinking time over time?
« Last Edit: December 14, 2018, 05:48:04 pm by Solarius Scorch »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #9 on: December 14, 2018, 05:46:32 pm »
Yes, the effects for unresearched items should still apply - the script can't check research status.

Handheld shields are used first, starting with the left hand.

Only armor-based shields will have the periodic flash.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #10 on: December 26, 2018, 05:54:24 am »
Ok, figured out about flashing.
Thanks.
Next question: item shield without priming does'nt work: what do i do wrong?
Spoiler:
Code: [Select]
items:
  - type: STR_ROUND_SHIELD
    categories: [STR_HAND_SHIELD]
    size: 0.3
    weight: 10
    costSell: 14000
    bigSprite: 1100
    floorSprite: 1100
    handSprite: 1572
#!    meleeHitSound: 79
    meleeAnimation: 0
    power: 0
    damageType: 6
    damageBonus:
      strength: 0.1
    damageAlter:
      RandomType: 2
      FixRadius: 0
      IgnoreDirection: false
      ArmorEffectiveness: 1.5
      ToHealth: 0.2
    accuracyMelee: 85
    meleeMultiplier:
      melee: 0.5
      bravery: 0.4
    costMelee:
      time: 9
      energy: 7
    costThrow:
      energy: 10
      time: 20
    flatThrow:
      time: true
    flatRate: true
    battleType: 3
    clipSize: -1
    invWidth: 2
    invHeight: 2
    tags:
      PHYSICAL_SHIELD_ARMOR: 1
      ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT: 35
      ITEM_ENERGY_SHIELD_CAPACITY: 300
      ITEM_ENERGY_SHIELD_PER_TURN: 0
      ITEM_ENERGY_SHIELD_TYPE: 1
      ITEM_ENERGY_SHIELD_FLASH_COLOR: 5
      ITEM_ENERGY_SHIELD_INDICATOR_COLOR: 2
      ITEM_ENERGY_SHIELD_COLOR_REPLACED_BY_INDICATOR: 2
      ITEM_ENERGY_SHIELD_DOWN_COLOR: 15
      ITEM_ENERGY_SHIELD_NEEDS_PRIMING: 0
And one more question: does AI know how to use priming of shields? What about physical shields?
Thanks.
By the way, maybe this topic must be not in "OXCE", but in "help" section?
« Last Edit: December 26, 2018, 05:56:40 am by Nord »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #11 on: December 26, 2018, 06:47:09 am »
AI do not have clue about priming to enable anything other that throwing atomic rocks at xcom.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #12 on: January 16, 2019, 01:55:37 pm »
AI can't use priming shields. They can use non-priming ones, but you might as well just use the version on their armor. Physical shields will work for them, but it's better to just bump up their regular armor and melee dodge. In general AI cannot use script features that require active input. It's best to only give AI scripts that work passively with what it's already doing.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #13 on: January 16, 2019, 06:02:32 pm »
Ok, got it. But what about non-priming shield? Should it work? Because it is not. :-(

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Suggestion]Pass through shield
« Reply #14 on: January 16, 2019, 07:48:05 pm »
That's because AI doesn't like putting anything but weapons in their hands, and it has to be in their hands in order to work. It's best to just put it on a unit's armor.