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

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
How do I make psionics require same-turn discovery?
« on: August 06, 2016, 08:18:04 am »
I know there's already a default mod that forces psionics to only be used when the user has line of sight to the target. But in default settings X-Com soldiers can only use psionics on aliens whom any of your units have seen in the same turn, however the aliens have no such restriction and can use psionics on your units when none of the aliens can see your units. I want to make it so that the aliens have to have any unit see your soldier that turn in order for them to use psionics on that soldier. The one using the psionics doesn't need to see them, but at least one of the aliens does. That's what I want.



Also I want to put in the TFTD default of ranged psionics into UFO Defense, such that psionic attacks are weakened with range.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11454
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do I make psionics require same-turn discovery?
« Reply #1 on: August 06, 2016, 12:47:53 pm »
It's a tough problem.

Once an X-Com alien spots you, it knows exactly where you are for a period of several turns, as per Intelligence stat. It can't shoot you if it doesn't see you, but it can still psi you up.

So the only way to prevent them from remembering where you are is to minimize their Intelligence, which will also make them very stupid.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #2 on: August 06, 2016, 09:39:55 pm »
What if all of the aliens on the map shared the knowledge of your troops' location, but only for one turn?

If their intelligence attribute was reduced, it wouldn't make them stupid. They're already stupid. AFAIK the only thing it affects is their "memory" which is really cheating on their part anyway.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: How do I make psionics require same-turn discovery?
« Reply #3 on: August 06, 2016, 10:18:45 pm »
What if all of the aliens on the map shared the knowledge of your troops' location, but only for one turn?

That is exactly what happens.  When one of your troops is spotted, they all know where it is and will continue to track it mentally.  The Intelligence score is how fast they lose track of you.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #4 on: August 07, 2016, 12:48:36 am »
That is exactly what happens.  When one of your troops is spotted, they all know where it is and will continue to track it mentally.  The Intelligence score is how fast they lose track of you.
That doesn't appear to be how it works. I just tested with a sectoid leader. All other aliens on the map were eliminated and the sectoid leader can use psionic attacks on units it cannot see and has never seen. Even after many turns, it is still able to use these attacks. I reduced its intelligence from 7 to 1 and then stuck it in a room and had my soldiers all evacuate the area. It didn't see a single soldier of mine for eight turns, yet was still able to mind control my soldiers every turn.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: How do I make psionics require same-turn discovery?
« Reply #5 on: August 07, 2016, 12:53:12 am »
That doesn't appear to be how it works. I just tested with a sectoid leader. All other aliens on the map were eliminated and the sectoid leader can use psionic attacks on units it cannot see and has never seen. Even after many turns, it is still able to use these attacks. I reduced its intelligence from 7 to 1 and then stuck it in a room and had my soldiers all evacuate the area. It didn't see a single soldier of mine for eight turns, yet was still able to mind control my soldiers every turn.
When it mind controls a soldier, it sees them and any in their view too. 
Warboy might be your best resource as to how the actual code works.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #6 on: August 07, 2016, 01:28:31 am »
When it mind controls a soldier, it sees them and any in their view too. 
It seems to gain vision of my whole squad when it sees any one of them. I can hide the two psi-weak soldiers from the rest, I can control the alien and have it face a wall for multiple turns, and it'll still be able to mind control the psiweak soldiers even though it hasn't seen any of my soldiers in a long time, and the psiweak ones are on the other side of the map.

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #7 on: August 07, 2016, 02:05:16 am »
That doesn't appear to be how it works. I just tested with a sectoid leader. All other aliens on the map were eliminated and the sectoid leader can use psionic attacks on units it cannot see and has never seen. Even after many turns, it is still able to use these attacks. I reduced its intelligence from 7 to 1 and then stuck it in a room and had my soldiers all evacuate the area. It didn't see a single soldier of mine for eight turns, yet was still able to mind control my soldiers every turn.

After turn 20 or less than 3 aliens left - they get full knowledge of your troops location.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #8 on: August 07, 2016, 03:53:02 am »
After turn 20 or less than 3 aliens left - they get full knowledge of your troops location.
Ah, that explains it.

I was running a second test using lots of smoke to prevent my soldiers from being seen, and it seemed to be working but then they began attacking one of my soldiers that they couldn't see. It probably happened on or after turn 20.

So how do I change that? I want to make it so they never get vision of my squad, at least the ones that can perform psionic attacks anyway.

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #9 on: August 07, 2016, 05:22:38 am »
You'd need to modify the executable.  It shouldn't be too difficult to add some sort of ruleset that disallows targeting based on a specific 'turnssincespotted' variable.

As far as the turn 20 / 2 alien rule - I don't know how that works internally - whether it changes the turnssincespotted to 0 or something else.  I guess that would be easy enough to check - if you have a save from past turn 20, just do a search to see what that value is. 


Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #10 on: August 07, 2016, 09:21:28 am »
I have such a save file but I have no idea how to look up the value. You're saying something about looking at the executable code?

Offline bladum

  • Colonel
  • ****
  • Posts: 213
  • Bladum
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #11 on: August 07, 2016, 03:49:23 pm »
why not make it work like that:

Alien will remember any soldier he spots in his field off view for N turns where N = intelligence, other aliens are not aware of these soldiers
Alien will make other aliens remember any soldier he spots in his field of view for K turns where K = group intelligence (new alien stat)
Alien will pass his memory of soldiers to any other alien that is with his field of view for M turns, where M = telepathy (new alien stat, optional, very complex to implement but could be helpfull to create chain of memory strategy for aliens, so xcom can pass grenades and aliens could pass positions of xcom soldiers that way)

So IQ =  5 and Group IQ = 1, means that alien will remember spotted soldier for 5 turns + he will make other aliens remember them for additional 1 turn

Using this engine we could implement standard behavior from X-COM but also bring much more for mods.

Tom
« Last Edit: August 07, 2016, 03:53:59 pm by bladum »

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #12 on: August 07, 2016, 05:35:28 pm »
I have such a save file but I have no idea how to look up the value. You're saying something about looking at the executable code?

I just opened it up in a text editor and searched for turnsSinceSpotted.  As I expected, all of your units have a TSS of 0 - which makes since from a programming standpoint.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #13 on: August 08, 2016, 03:57:53 am »
Well that's useful information, but it doesn't tell me how to fix it. I need some way to make the game stop setting that value to 0, and let it climb up as normal regardless of how few aliens there are or how many turns have passed.

Offline Starving Poet

  • Colonel
  • ****
  • Posts: 265
    • View Profile
Re: How do I make psionics require same-turn discovery?
« Reply #14 on: August 08, 2016, 04:18:48 am »
This is just a guess - but try modifying aliendeployments and adding a cheatTurn:255 to, say, an escort mission - based off of this: https://github.com/SupSuper/OpenXcom/blob/361467e4c3cd10ae40ed1b503a1c1e86e328b370/src/Mod/AlienDeployment.cpp#L116

it looks like a settable option.  If that works it might remove the timer, but not the two alien rule.