aliens

Author Topic: How do I make psionics require same-turn discovery?  (Read 15895 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #15 on: August 08, 2016, 08:47:29 pm »
I'm more concerned with the two alien rule.

I wish I could access the ruleset reference. Ever since UFOPaedia went down, I've been getting stuck making my mods.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #17 on: August 09, 2016, 07:48:20 am »
Going through the code again and this makes it look like the 2 alien rule only applies if turn > cheatturn / 2.

https://github.com/SupSuper/OpenXcom/blob/8d51815ee0aeeeab0fb9764e1f7a389023f7219f/src/Savegame/SavedBattleGame.cpp#L857

So, if you try the cheatturn option in the ruleset set to 255, that might work for you.

/edit: I'm away from my testing computer right now - but quick test would be to add cheatTurn: 1 to the small scout in aliendeployments and do a quick battle in a lightning with an ethereal small scout mission and immediately end the turn.  If he PSI attacks you on his first turn; you'll know it works.
« Last Edit: August 09, 2016, 07:54:21 am by Starving Poet »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #18 on: August 09, 2016, 10:30:50 am »
do a quick battle in a lightning with an ethereal small scout mission
Small scout has a soldier, Ethereal Soldiers can't use psionics (which is weird because they have a psi skill attribute).

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #19 on: August 09, 2016, 02:51:37 pm »
Yes they do - they're just not likely to because they have low stats. 
« Last Edit: August 09, 2016, 03:39:05 pm by Starving Poet »

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #20 on: August 09, 2016, 08:13:38 pm »
Alright - just tested this in the latest nightly:

adding cheatTurn: 255 to the small scout deployment gives you until turn 123 before the 2 alien cheat turn rule goes into effect.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #21 on: August 09, 2016, 10:55:47 pm »
Alright - just tested this in the latest nightly:

adding cheatTurn: 255 to the small scout deployment gives you until turn 123 before the 2 alien cheat turn rule goes into effect.
Where do I add it? I tried adding it to the medium scout and used the value 1 but they still waited until turn 20.
alienDeployments:
  - type: STR_MEDIUM_SCOUT
    cheatTurn: 1


Also when I set their intelligence to 0 it doesn't seem to work properly. They can use psi attacks on someone they saw last turn. They don't have to see the soldier in the same turn as they use psi attacks. This means once they have seen your squad, it's all over and you'll never be free of psi attacks until you kill the aliens doing it. And that's the entire problem I'm seeking to avoid.

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #22 on: August 09, 2016, 10:59:46 pm »
This works for me - again using the latest nightly.  It didn't work with OXCE when I tried that executable.
Code: [Select]
- type: STR_MEDIUM_SCOUT
    data:
      - alienRank: 5
        lowQty: 2
        highQty: 4
        dQty: 2
        percentageOutsideUfo: 60
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_PLASMA_PISTOL_CLIP
          -
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_PLASMA_RIFLE_CLIP
          -
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP
            - STR_ALIEN_GRENADE
      - alienRank: 4
        lowQty: 1
        highQty: 2
        dQty: 1
        percentageOutsideUfo: 20
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_MIND_PROBE
          -
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
          -
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP
    width: 40
    length: 40
    height: 4
    cheatTurn: 2

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #23 on: August 09, 2016, 11:28:54 pm »
After some testing, I figured out it has to go on each individual alien rank.

alienDeployments:
  - type: STR_MEDIUM_SCOUT
      - alienRank: 5
        cheatTurn: 1
      - alienRank: 4
        cheatTurn: 1

It also doesn't work when the cheat turn is set to 0.


Setting intelligence to 0 does work. It seems to allow them to use psionics on soldiers they saw during their turn or in your turn before it. You can theoretically make your psiweak soldiers hide from either the aliens or your squad, or you can kill the psiweak soldiers, and that will make the psi attacks stop. It's almost what I want, but not quite. It's still a bit cheaty on their part.
« Last Edit: August 09, 2016, 11:31:03 pm by The Reaver of Darkness »

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #24 on: August 09, 2016, 11:52:56 pm »

It also doesn't work when the cheat turn is set to 0.

That makes sense in hindsight - you can't divide 0 / 2 after all.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #25 on: August 10, 2016, 01:59:40 am »
That makes sense in hindsight - you can't divide 0 / 2 after all.
It doesn't seem to be dividing it by 2. The default value as stated in the cached ruleset reference you linked is 20. When I set it to 2, they used psi attacks on the third turn. When I set it to 4, they used psi attacks on the 5th turn. I think perhaps it has a range of only 1-127. I didn't test it that many times, but it seemed to be taking the number of turns and adding one to it, not dividing it in half.

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #26 on: August 10, 2016, 02:36:03 am »
Right, but the code for activating cheatMode is a single line checking for (turn > cheatTurn) OR (aliens <= 2 AND turn > cheatTurn / 2).

There is no code making sure cheatTurn is > 0 so when it hits that conditional it's probably just silently failing.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9107
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #27 on: August 10, 2016, 09:32:15 am »
That makes sense in hindsight - you can't divide 0 / 2 after all.

Why not? 0 / 2 = 0

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #28 on: August 10, 2016, 03:12:10 pm »
And of course you can, no idea why I said that.  I think my toddler is eating my brain when I sleep.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do I make psionics require same-turn discovery?
« Reply #29 on: August 10, 2016, 03:51:58 pm »
And of course you can, no idea why I said that.  I think my toddler is eating my brain when I sleep.

I really didn't need this image in my head. :P