Author Topic: [Solved] damage that is negated by morale as shield? possible?  (Read 7893 times)

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
is any way to do a damage that needs surpass moral? in OXCE+of course
« Last Edit: February 12, 2023, 02:23:22 pm by Meridian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #1 on: March 05, 2018, 01:37:43 pm »
Yes, with scripts. If you have some mechanics in mind, I can write a prototype script for you.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #2 on: March 05, 2018, 02:11:53 pm »
My idea is to make a seductive weapon for chaos sisters/demonette  like Chryssalid but instead of instant convert to zombie with no change, only get´s  successful attack  if unit was no moral  (meanwhile it damages moral after each attack)
Making way for some more units have damage to moral and more diverse combat

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #3 on: March 05, 2018, 02:50:03 pm »
This exactly case is not possible right now, transformation can only have flat `specialChance` percent change to success. In future I could add option to control it by scripts.

[ps]

Right now you can using scripts create that some attacks only do normal damage if morale is depleted.
« Last Edit: March 05, 2018, 02:52:29 pm by Yankes »

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #4 on: March 05, 2018, 04:16:13 pm »
well in that case , nevermind the zombie part.

i guess i will make seduce do stun damage, still need a attack that does stun damage if morale is depleted.

Are there any strange effects ( expect mind control/ zombification) like petrification (i guess i can deplete tu/ energy/ moral with no energy recover ), beserker touch (unit becomes beserker ), blind ? i thinking spells HOMM now  :P

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #5 on: March 05, 2018, 08:34:02 pm »
Right now you can alter all basic stats (max values too) of unit when its hit or at start of new turn.
This mean petrification is fully possible (for X turns 0 energy and half TU)

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #6 on: March 05, 2018, 09:33:57 pm »
So where can i find the script that only does dmage if moral depletad

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #7 on: March 05, 2018, 09:58:22 pm »
You'd have to write it using the damageUnit script hook.  All you'd need to do is have the to_stun (or to_health, etc.) variable reduced/set to 0 if the unit's morale (unit.getMorale) is 0.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #8 on: March 06, 2018, 03:02:22 pm »
You'd have to write it using the damageUnit script hook.  All you'd need to do is have the to_stun (or to_health, etc.) variable reduced/set to 0 if the unit's morale (unit.getMorale) is 0.

i should refrase my question  ("on witch mod" can i find a "already" made script similar that i only need to replace some words), i appreciate the help but i only understand rullset and the basics

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #9 on: March 06, 2018, 03:17:09 pm »
Ah okay. The problem is that this doesn't really exist in any mod; the energy shields I wrote that are in use in Piratez and XCF are related, but it would be easier to write a new script than to modify that.

Code: [Select]
items:
  - type: STR_ITEM_THAT_STUNS_ON_LOW_MORALE
    tags:
      ITEM_STUN_ON_LOW_MORALE: 1

extended:
  tags:
    RuleItem:
      ITEM_STUN_ON_LOW_MORALE: int
  scripts:
    damageUnit:
      - offset: 1
        code: |
          var ptr RuleItem itemRuleset;
          var int targetMorale;
          var int stunOnLowMorale;

          damaging_item.getRuleItem itemRuleset;
          itemRuleset.getTag stunOnLowMorale Tag.ITEM_STUN_ON_LOW_MORALE;

          if eq stunOnLowMorale 0;
            return;
          end;

          unit.getMorale targetMorale;
          if neq targetMorale 0;
            set to_stun 0;
          end;

          return;

          unit.getMorale targetMorale;
          if neq targetMorale 0;
            set to_stun 0;
          end;

          return;

Try this. Set your weapon to have some ToStun and ToMorale, and give it a value for the tag ITEM_STUN_ON_LOW_MORALE other than 0. The script will set ToStun to 0 unless the target has 0 morale.  If you want it to be more complex, e.g., maybe reduced stun damage when morale is higher instead of just 0 stun damage, you'll just need to change the last 3 lines before the final 'return;' to set to_stun however you'd like.
« Last Edit: March 06, 2018, 03:31:48 pm by ohartenstein23 »

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #10 on: March 06, 2018, 09:55:57 pm »
Try this. Set your weapon to have some ToStun and ToMorale, and give it a value for the tag ITEM_STUN_ON_LOW_MORALE other than 0. The script will set ToStun to 0 unless the target has 0 morale.  If you want it to be more complex, e.g., maybe reduced stun damage when morale is higher instead of just 0 stun damage, you'll just need to change the last 3 lines before the final 'return;' to set to_stun however you'd like.

Thks! i will try it and give feedback soon enough

--- posts merged ---

so i just tested and got my mind puzzled

  - type: STR_SEDUCE
    requires:
      - STR_ALIENS_ONLY
    tags:
      ITEM_STUN_ON_LOW_MORALE: 1
    size: 0.2
    costSell: 2050
    weight: 5
    bigSprite: 267
    floorSprite: 150
    handSprite: 480
    meleeSound: 753
    meleeHitSound: 709
    meleeAnimation: 48
    power: 30
    damageAlter:
      RandomType: 3 #3-> Flat  [100% - 100%]
      ToStun: 1.0
      ToMorale: 1.0
      ArmorEffectiveness: 0.0
    damageType: 6
    accuracyMelee: 110
    tuMelee: 15
    clipSize: -1
    battleType: 3
    twoHanded: false
    invWidth: 1
    invHeight: 3
    armor: 12
    recover: true
    attraction: 7
    listOrder: 3011

So Stun damage is still applied before complete depletion of moral , so i guess i´m doing something wrong , also i don´t understand why with   
      power: 30
      RandomType: 3 #3-> Flat  [100% - 100%]
      ArmorEffectiveness: 0.0                     
also the armor damage modifier is 1.0 to stun
and the damage is not a constant 30 (does some melee dodge plays a part in this?)
« Last Edit: March 06, 2018, 11:28:34 pm by Solarius Scorch »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #11 on: March 06, 2018, 10:09:04 pm »
Did you put it in the same file as the script, or at least the part of the code that defines the tag ITEM_STUN_ON_LOW_MORALE?  The part of the item ruleset that contains the tag needs to be in the same file as
Code: [Select]
extended:
  tags:
    RuleItem:
      ITEM_STUN_ON_LOW_MORALE: int

The morale damage by the attack won't be exactly 30, since this is reduced by the target's bravery.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #12 on: March 06, 2018, 10:39:17 pm »
A made a file .rul with this

Code: [Select]
items:
  - type: STR_SEDUCE #                 3011           TEST
    requires:
      - STR_ALIENS_ONLY
    tags:
      ITEM_STUN_ON_LOW_MORALE: 1
    size: 0.2
    costSell: 2050
    weight: 5
    bigSprite: 267
    floorSprite: 150
    handSprite: 480
    meleeSound: 753 #753 Powerswrod miss
    meleeHitSound: 709 #709 chainhit
    meleeAnimation: 48
    power: 30
    damageAlter:
      RandomType: 3 #3-> Flat  [100% - 100%]
      ToStun: 1.0
      ToMorale: 1.0
      ArmorEffectiveness: 0.0   #how effective armor is against this damage. Default `0.0` for smoke and stun, `1.0` rest.
    damageType: 6
    accuracyMelee: 110
    tuMelee: 15
    clipSize: -1
    battleType: 3
    twoHanded: false
    invWidth: 1
    invHeight: 3
    armor: 12
    recover: true
    attraction: 7
    listOrder: 3011
extended:
  tags:
    RuleItem:
      ITEM_STUN_ON_LOW_MORALE: int
  scripts:
    damageUnit:
      - offset: 1
        code: |
          var ptr RuleItem itemRuleset;
          var int targetMorale;
          var int stunOnLowMorale;

          damaging_item.getRuleItem itemRuleset;
          itemRuleset.getTag stunOnLowMorale Tag.ITEM_STUN_ON_LOW_MORALE;

          if eq stunOnLowMorale 0;
            return;
          end;

          unit.getMorale targetMorale;
          if neq targetMorale 0;
            set to_stun 0;
          end;

          return;

          unit.getMorale targetMorale;
          if neq targetMorale 0;
            set to_stun 0;
          end;

          return;

still apllys stun damage with some moral

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #13 on: March 06, 2018, 10:50:19 pm »
You accidentally copied the last 6 lines of the script twice, so the script throws an error and isn't loading.  Remove everything past the second-to-the-last "return;".

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 685
    • View Profile
Re: damage that is negated by moral as shield? possible?
« Reply #14 on: March 06, 2018, 10:55:20 pm »
its workkss! hurray!  ;D thank man
sorry about the trouble