OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Nord on November 20, 2018, 03:06:48 pm

Title: [DONE][Suggestion]Pass through shield
Post by: Nord 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.
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 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.
Title: Re: [Suggestion]Pass through shield
Post by: Nord 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)
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 on November 20, 2018, 05:21:48 pm
Here's an example of a shield that only protects against a few damage types (https://github.com/ohartenstein23/Yankes-Scripting/blob/master/Yankes_Scripts.rul#L1898). 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.
Title: Re: [Suggestion]Pass through shield
Post by: The_Funktasm 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.
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 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.
Title: Re: [Suggestion]Pass through shield
Post by: Nord 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?
Title: Re: [Suggestion]Pass through shield
Post by: Yankes 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).
Title: Re: [Suggestion]Pass through shield
Post by: Nord 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?
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 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.
Title: Re: [Suggestion]Pass through shield
Post by: Nord 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?
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?
Title: Re: [Suggestion]Pass through shield
Post by: Yankes 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.
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 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.
Title: Re: [Suggestion]Pass through shield
Post by: Nord on January 16, 2019, 06:02:32 pm
Ok, got it. But what about non-priming shield? Should it work? Because it is not. :-(
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 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.
Title: Re: [Suggestion]Pass through shield
Post by: Solarius Scorch on January 16, 2019, 07:57:10 pm
AI units can hold one melee weapon and one ranged weapon.

What I am planning to do (but haven't done yet) is creating two types of shields, one being a melee weapon, the other a ranged weapon (but with no actual range).

The melee shield is to be used with a ranged weapon, and vice versa.
Title: Re: [Suggestion]Pass through shield
Post by: Nord on January 17, 2019, 02:21:44 am
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.
You dont understand. I put this item in hands of my units. And then shoot them. And shield does not absorb damage.

AI units can hold one melee weapon and one ranged weapon.

What I am planning tobut do (but haven't done yet) is creating two types of shields, one being a melee weapon, the other a ranged weapon (but with no actual range).

The melee shield is to be used with a ranged weapon, and vice versa.
Good idea. Must remember.
Title: Re: [Suggestion]Pass through shield
Post by: ohartenstein23 on January 20, 2019, 11:05:02 pm
When you load the game, does the openxcom.log file mention any script errors? Also, is this a unit and item already in TWoTS or an uploaded mod, or could you upload a copy of the mod you're testing?
Title: Re: [Suggestion]Pass through shield
Post by: Nord on January 22, 2019, 05:25:38 pm
Sent to pm.