aliens

Author Topic: [Solved] Custom alien Psi attacks  (Read 5956 times)

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
[Solved] Custom alien Psi attacks
« on: August 01, 2017, 11:06:25 pm »
Is it in the current OXCE version possible to customize alien psi attacks?
For example:
- LOSrequired for some units
- Unit can do only control attacks
- Unit can do only morale attacks
- strength drop off with distance

I have the impression that currently all alien units with psiSkill > 0 use automatically the same psi weapon item

Code: [Select]
  - type: ALIEN_PSI_WEAPON
    hitSound: 36
    battleType: 9
    tuUse: 25
    flatRate: true
    recover: false


and if  I modify this item, all ai units use the modified one.
« Last Edit: February 11, 2023, 04:21:08 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8578
    • View Profile
Re: Custom alien Psi attacks
« Reply #1 on: August 07, 2017, 06:25:09 pm »
Is it in the current OXCE version possible to customize alien psi attacks?
For example:
- LOSrequired for some units

Yes.

- Unit can do only control attacks

Yes. Set TU cost for other types above 100%.

- Unit can do only morale attacks

Yes. Set TU cost for other types above 100%.

- strength drop off with distance

Yes.

I have the impression that currently all alien units with psiSkill > 0 use automatically the same psi weapon item

Code: [Select]
  - type: ALIEN_PSI_WEAPON
    hitSound: 36
    battleType: 9
    tuUse: 25
    flatRate: true
    recover: false


and if  I modify this item, all ai units use the modified one.

ALIEN_PSI_WEAPON is the default, but you can override it (per unit type).

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Re: Custom alien Psi attacks
« Reply #2 on: August 12, 2017, 05:08:48 pm »
Thank you for the information. I did a few tests and post the result here in case anyone else wants to mod alien psi abilities:


1. You can define psi-amp items and configure them as you want.

2. You can overwrite the default psi weapon when you give the unit a "meleeWeapon:" with battletype:9 (the item does not appear in the inventory)
However, you cannot modifiy the stats for mind-control and panic independently, because the specific action cannot be chosen. I do not know how the AI choses the attack type. (If the player controls this unit, the attack is initiated by the psi icon in the upper right corner, without the possibility to choose the attack type).

3. You can give the unit a "builtInWeapons", which is basically a fixed weapon psi-amp (uses up an inventory slot). This can be configured freely.
However, this does not overwrite the default psi weapon, which means the unit will have two different psi weapons. I do not know how the AI chooses which psi weapon to use then.


EDIT: For testing purposes, it would be good if the player could choose the attack type (mind control or panic) when using the psi icon (top right corner) of psi capable unit.
 

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8578
    • View Profile
Re: Custom alien Psi attacks
« Reply #3 on: August 12, 2017, 05:22:45 pm »
2. You can overwrite the default psi weapon when you give the unit a "meleeWeapon:" with battletype:9 (the item does not appear in the inventory)
However, you cannot modifiy the stats for mind-control and panic independently, because the specific action cannot be chosen. I do not know how the AI choses the attack type. (If the player controls this unit, the attack is initiated by the psi icon in the upper right corner, without the possibility to choose the attack type).

Why not use "psiWeapon: " instead of meleeWeapon?

I do not know how the AI choses the attack type.

Fancy algorithm...

But you can force AI to use panic attack or mind control by changing the TU cost of the other type above 100%.

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Re: Custom alien Psi attacks
« Reply #4 on: August 12, 2017, 05:51:50 pm »
Why not use "psiWeapon: " instead of meleeWeapon?
Because this command is not referenced in  the Wiki or in OpenXcomEx.txt? Or probably I just did not find it  ;)
Anyway it seems to work.


But you can force AI to use panic attack or mind control by changing the TU cost of the other type above 100%.

Yes, this seems to work. I used the following:
Code: [Select]

  - type: BENE_GESSERIT_SISTER_PSI_WEAPON
    hitSound: 36
    battleType: 9
    tuUse: 10
    costMindControl:
      time: 1000
    flatRate: true
    recover: false
    LOSRequired: true




Offline Nord

  • Commander
  • *****
  • Posts: 1623
  • The Gate is open.
    • View Profile
Re: Custom alien Psi attacks
« Reply #5 on: August 12, 2017, 06:15:54 pm »
Thanks, it is very useful.
By the way, how to change alien psi attack icon?
( Imean how it calls in interface ruleset?)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8578
    • View Profile
Re: Custom alien Psi attacks
« Reply #6 on: August 12, 2017, 07:20:10 pm »
Thanks, it is very useful.
By the way, how to change alien psi attack icon?
( Imean how it calls in interface ruleset?)

SPICONS.DAT
- frame 0 is launch button
- frame 1 is psi button

32x24 pixels

https://www.ufopaedia.org/index.php/SPICONS.DAT

Code: [Select]
add(_btnLaunch);
_game->getMod()->getSurfaceSet("SPICONS.DAT")->getFrame(0)->blit(_btnLaunch);
add(_btnPsi);
_game->getMod()->getSurfaceSet("SPICONS.DAT")->getFrame(1)->blit(_btnPsi);

Offline Yankes

  • Commander
  • *****
  • Posts: 3185
    • View Profile
Re: Custom alien Psi attacks
« Reply #7 on: August 12, 2017, 07:29:20 pm »
Because this command is not referenced in  the Wiki or in OpenXcomEx.txt? Or probably I just did not find it  ;)
Anyway it seems to work.
This is was added to nightly long time ago. Alterative you can use `specialWeapon` in armor (this is too in nightly) that will be usable by solders.
Right now AI can use only one psi amp, priority get items in hands, if not find it will check "internal" weapons.
When you set `psiWeapon` for armor then it will override default psi item (but only for aliens with Psi, other wise you can hack it by `specialWeapon` that can be too psi amp)

Quote

Yes, this seems to work. I used the following:
Code: [Select]

  - type: BENE_GESSERIT_SISTER_PSI_WEAPON
    hitSound: 36
    battleType: 9
    tuUse: 10
    costMindControl:
      time: 1000
    flatRate: true
    recover: false
    LOSRequired: true

Proper way to disable is set time to `0`, this will not only prevent AI from using it but will remove this from popup too.
Another way is change accuracy of attacks, it will change with attack will be preferred by alien.

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Re: Custom alien Psi attacks
« Reply #8 on: August 12, 2017, 08:43:37 pm »
This is was added to nightly long time ago. Alterative you can use `specialWeapon` in armor (this is too in nightly) that will be usable by solders.
Right now AI can use only one psi amp, priority get items in hands, if not find it will check "internal" weapons.
When you set `psiWeapon` for armor then it will override default psi item (but only for aliens with Psi, other wise you can hack it by `specialWeapon` that can be too psi amp)
Proper way to disable is set time to `0`, this will not only prevent AI from using it but will remove this from popup too.
Another way is change accuracy of attacks, it will change with attack will be preferred by alien.

Thank you. This is good to know.

I tried to put it in the ufopaedia wiki, but I cannot log into my account and I cannot generate a new one   :(
(cookie error message)

Offline Nord

  • Commander
  • *****
  • Posts: 1623
  • The Gate is open.
    • View Profile
Re: Custom alien Psi attacks
« Reply #9 on: August 13, 2017, 05:12:44 am »
SPICONS.DAT
- frame 0 is launch button
- frame 1 is psi button

32x24 pixels

https://www.ufopaedia.org/index.php/SPICONS.DAT

Code: [Select]
add(_btnLaunch);
_game->getMod()->getSurfaceSet("SPICONS.DAT")->getFrame(0)->blit(_btnLaunch);
add(_btnPsi);
_game->getMod()->getSurfaceSet("SPICONS.DAT")->getFrame(1)->blit(_btnPsi);
Yes, i know how vanilla sprite calls. But how to change it in mod? Is it even possible?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8578
    • View Profile
Re: Custom alien Psi attacks
« Reply #10 on: August 13, 2017, 10:10:52 am »
Yes, i know how vanilla sprite calls. But how to change it in mod? Is it even possible?

uhm, yes, same as everything else?

Code: [Select]
extraSprites:
  - type: SPICONS.DAT
    width: 32
    height: 24
    files:
      1: Resources/Sprites/psi.png
« Last Edit: August 13, 2017, 10:14:07 am by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1623
  • The Gate is open.
    • View Profile
Re: Custom alien Psi attacks
« Reply #11 on: August 13, 2017, 10:33:04 am »
My bad, an excess (extra? Unnecessary?) string
singleImage: true
was added. And this dat file contain two sprites.
Thanks.