Author Topic: Panic, Berserk or Mind Control on projectile hit  (Read 4636 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Panic, Berserk or Mind Control on projectile hit
« on: October 15, 2019, 02:17:56 pm »
I'm hoping that there is a way to have a weapon or ammo type that causes a unit struck by its projectile to suffer the "Panic", "Berserk" or "Mind Control" effect without lowering the units moral.

So basically the effect itself is triggered independently of the units Morale check.

Perhaps an items: variable something like this:
- panicOnHit: 1
- berserkOnHit: 1
- mindControlOnHit: 1


After looking over the
UFOpaedia's Ruleset Reference Nightly I didn't notice any commands to perform this action, is it possible?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #1 on: October 15, 2019, 02:38:46 pm »
No.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #2 on: October 15, 2019, 02:52:13 pm »
That is disappointing.

Thank you for the information.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #3 on: October 15, 2019, 03:49:19 pm »
Instead of directly inducing those without morale damage, you could have the weapon do enough morale damage to set the unit to 0, then have a script that restores the target's morale after they panic or berserk.

I thought mind control didn't do anything to unit morale. Anyways, MC + Panic can only happen on the same item if the item is a psi-amp and you have either normal panic attack or a melee attack that does morale damage. They can't happen together on a projectile item, only the morale thing can.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #4 on: October 16, 2019, 05:47:38 pm »
I thought mind control didn't do anything to unit morale.
The UFOpaedia: Morale page mentioned that a successful Mind Control attack leaves a soldier with 0 morale.
Quote
Psionic Mind Control attack - Successful mind control leaves a soldier at 0 Morale. Thus, the turn after Mind Control, they always suffer Panic/Berserk, and end that turn with 15 Morale. This also makes them likely to Panic/Berserk the next turn, as well. (Mind Control - the gift that keeps on giving!)

It's a pity that there isn't a way to better control the type of affliction caused by a morale failure as I think it could give some additional variation to the x-com/alien equipment.

(Question)
Will aliens/enemies use a Psi-Amp type weapon if they are holding it or do they only use their psionic skill stats to psi attack without a weapon?

If they can use Psi-Amps then the LOSRequired: variable can at least make the anti-morale weapon require line of sight and I believe that I read somewhere that the Psi-Amp equipment can be configured to make it only able to do either Mind Control or Panic attacks.... so in theory that could work as a substitute.


Instead of directly inducing those without morale damage, you could have the weapon do enough morale damage to set the unit to 0, then have a script that restores the target's morale after they panic or berserk.

A weapon attack that cripples morale followed by a script that restores the morale to its state before the attack does sound like a good solution.

Are there any good tutorials or information you would recommend reading for learning to write OpenXcom scripts?
« Last Edit: October 16, 2019, 05:51:52 pm by The Martian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #5 on: October 16, 2019, 06:31:55 pm »
The UFOpaedia: Morale page mentioned that a successful Mind Control attack leaves a soldier with 0 morale.

That's not always true.

The aliens do usually prefer panicking first, until the unit is sufficiently low on morale, before trying mind-control... but they don't always wait until morale goes all the way down to 0.

Will aliens/enemies use a Psi-Amp type weapon if they are holding it or do they only use their psionic skill stats to psi attack without a weapon?

Yes.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #6 on: October 16, 2019, 07:00:07 pm »
EDIT:
I accidentally modified this old post and deleted it instead of posting a new one!

Is there a way to restore it?
« Last Edit: October 20, 2019, 06:55:24 pm by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #7 on: October 20, 2019, 06:36:54 pm »
I've been looking through the UFOpaedia: Ruleset Reference Nightly page and haven't located the variables that would control a Psi-Amp type weapon to make it either only be able to use Panic or Mind Control.

How is this accomplished?

A messy way would potentially be to increase the TU cost of the unwanted skill to be beyond the units ability to ever trigger, but then the attack option would still be displayed on the weapon action menu when it is clicked.

I'm trying to create two different Psi-Amp weapons that are for the aliens only. One that uses Panic and one that has Mind Control.

I'll post the code I've got, but so far it is just the regular X-Com Psi-Amp with LOSRequired: true added:

Code: [Select]
  - type: STR_EXAMPLE_PSI_AMP_MIND_CONTROL_ONLY
    requires:
      - STR_PSI_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 512
    floorSprite: 447
    handSprite: 1896
    hitSound: 36
    battleType: 9
    twoHanded: true
    invWidth: 2
    invHeight: 3
    tuUse: 4
    flatRate: true
    LOSRequired: true
« Last Edit: October 20, 2019, 07:08:07 pm by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #8 on: October 20, 2019, 07:20:44 pm »
I tried to alter the Psi-Amp's cost of the Panic action with costPanic: but the mod is now failing to load.

First with tuUse: still on the item:
Code: [Select]
  - type: STR_EXAMPLE_PSI_AMP_MIND_CONTROL_ONLY
    requires:
      - STR_PSI_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 512
    floorSprite: 447
    handSprite: 1896
    hitSound: 36
    battleType: 9
    twoHanded: true
    invWidth: 2
    invHeight: 3
    tuUse: 4
    flatRate: true
    LOSRequired: true
    costPanic: 200

Then with costPanic: substituting in place of the tuUse: variable:
Code: [Select]
  - type: STR_EXAMPLE_PSI_AMP_MIND_CONTROL_ONLY
    requires:
      - STR_PSI_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 512
    floorSprite: 447
    handSprite: 1896
    hitSound: 36
    battleType: 9
    twoHanded: true
    invWidth: 2
    invHeight: 3
    costPanic: 200
    flatRate: true
    LOSRequired: true

I also tried removing tuUse: and defining both costPanic: and costMindControl: but it still produced the error instead of loading:
Code: [Select]
  - type: STR_EXAMPLE_PSI_AMP_MIND_CONTROL_ONLY
    requires:
      - STR_PSI_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 512
    floorSprite: 447
    handSprite: 1896
    hitSound: 36
    battleType: 9
    twoHanded: true
    invWidth: 2
    invHeight: 3
    costPanic: 200
    costMindControl: 4
    flatRate: true
    LOSRequired: true

This is the error message that was being displayed on launch:
Quote
ERROR: failed to load 'MA'; mod disabled
standard/MA/Ruleset/items_MA.rul: operator[] call on a scalar

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #10 on: October 20, 2019, 07:49:26 pm »
Just use the correct syntax: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Cost_of_use
Thank you that got it. ^_^

Code: [Select]
  - type: STR_ALIEN_MIND_CONTROL_ONLY_PSI_AMP
    requires:
      - STR_PSI_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 512
    floorSprite: 447
    handSprite: 1896
    hitSound: 36
    battleType: 9
    twoHanded: true
    invWidth: 2
    invHeight: 3
    tuUse: 0
    flatRate: true
    LOSRequired: true
    accuracyMindControl: 50
    accuracyPanic: -50
    costMindControl:
      time: 4
    costPanic:
      time: 200

I guess since X-Com personal won't be able to actually use this equipment the player will not see the redundant Panic Unit option. So leaving it is fine as long as the enemy AI ignores it as well and only uses Mind Control.
« Last Edit: October 20, 2019, 07:52:32 pm by The Martian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #11 on: October 20, 2019, 11:43:18 pm »
Setting time unit costs to 0 disables that action for an item.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Panic, Berserk or Mind Control on projectile hit
« Reply #12 on: October 21, 2019, 08:58:48 pm »
Thank you that looks much better.