OpenXcom Forum

Modding => Work In Progress => Topic started by: The Reaver of Darkness on July 15, 2017, 05:47:57 am

Title: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 15, 2017, 05:47:57 am
Currently, if a Chryssalid makes an attack against one of your soldiers, it deals damage based on the Chryssalid's strength. If the soldier is killed, a zombie spawns in its place. The Chryssalid may then cease the attack and go for a different soldier. But if the Chryssalid runs out of time units and still has not depleted the soldier's hit points, it will stop attacking and the soldier is killed anyway.

This can be tested with a soldier that has 250 armor, as the Chryssalid will be unable to cause any damage to the soldier. If you set the Chryssalid's attack to 1 TU cost, it will make a very large number of attacks, completely draining its remaining TUs to attack because it consistently fails. However at the end of its turn, the soldier is turned into a zombie anyway.


How do I turn off this function, so that the Chryssalid is required to actually kill the soldier in order to turn them into a zombie?
Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 15, 2017, 09:54:59 am
reduce their melee accuracy, they impregnate if they hit, damage is merely a side effect.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 15, 2017, 12:31:32 pm
reduce their melee accuracy, they impregnate if they hit, damage is merely a side effect.

I thought it only works if the Chryssalid does damage? (Meaning no zombification it the armour has stopped the attack completely.) Or am I just plain wrong?
Title: Re: How do I make Chryssalids not always succeed?
Post by: 7Saturn on July 15, 2017, 01:02:14 pm
My impression as well. I know this attack over attack behavior. But at the end, if the armor was thick enough, nothing happens. So AFAIK, it's not guaranteed for Chryssalids to succeed.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 15, 2017, 01:34:09 pm
see for yourself, in this function:
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/MeleeAttackBState.cpp#L215-L275

line 220: determine if the attack hits
line 239: impregnation
line 244: begin calculating damage
line 271: inflict damage
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 15, 2017, 01:47:28 pm
They definitely always succeed, regardless of whether or not they deal any damage. They are just willing to use up extra time units if they haven't killed the soldier yet.

reduce their melee accuracy, they impregnate if they hit, damage is merely a side effect.

That doesn't work for me. I want armor to make a difference against chryssalids. Currently, all it does is possibly cost them more time units before they inevitably succeed in the attack. If I lower their melee accuracy, they'll be less potent against unarmored soldiers as well.


Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 15, 2017, 02:34:31 pm
this is why they have their reputation
Title: Re: How do I make Chryssalids not always succeed?
Post by: Yankes on July 15, 2017, 03:01:27 pm
OXCE can reduce chance to success of special attack.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 15, 2017, 09:30:54 pm
Thanks for the explanation, Warboy.

...but isn't it kinda stupid? How do they insert the larva (or whatever) through the armour? :P
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 15, 2017, 11:53:49 pm
this is why they have their reputation
I don't think that's true. If their attack could be stopped by armor, they would still very easily take your troops down until at least the time when you get power suits, and even then they could still rip through your armor. Sometimes they would fail but their damage is high enough to succeed in one hit using UFO damage model, no matter how tough your soldier is. Their time units are so high they would still catch players unaware if they didn't take precautions to prevent chryssalids from ambushing them. Failure wouldn't be the norm, rather it would just be a thing that happened sometimes. One wouldn't find themselves truly dominating chryssalids until they really learned to prevent them having a chance to attack soldiers in the first place.


...but isn't it kinda stupid? How do they insert the larva (or whatever) through the armour? :P
They probably have an ovipositor that is capable of ripping through your strongest armor. But when the hit glances off or fails to break the armor, the eggs should fail to get in.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 16, 2017, 01:27:56 am
no, it's true, they got a reputation for being incredibly deadly by... being incredibly deadly.

i'd just like to point out this is a video game, it doesn't have to make sense. it doesn't impregnate your soldiers using real world biology or physics, it impregnates your soldiers by means of "the GM says so"
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 16, 2017, 02:25:59 am
My point is that the change I'm asking for wouldn't significantly affect how deadly they are, especially in the early game when you first meet up with them.


I'm not trying to get realism. I'm trying to get gameplay. Researching armor and paying time, money, and resources to make it in order to have it better protect your soldiers is gameplay. Having an enemy ignore that armor with no explanation other than "this is a scary enemy" is not gameplay, it's fake difficulty. I can balance the attributes of the armor and chryssalid however I want after I get the feature to make it as easy or hard as I like, but not having that option takes away my power as a designer to deliver the game experience I want to give people.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 16, 2017, 03:48:25 am
fair enough, i was simply explaining why it is the way it is.

currently it's not possible to do what you're describing. if you're using OXCE+ i'd say your best bet would be to pester Meridian to add an armour resistance value specifically for impregnation and work off that.

(as an aside: xcom is full of fake difficulty, it's kinda notorious for it, even)
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 16, 2017, 04:03:22 am
(as an aside: xcom is full of fake difficulty, it's kinda notorious for it, even)
Very true, one of my biggest reasons for wanting to mod it.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 16, 2017, 12:03:53 pm
Yeah, I guess I will pester someone to modify this code of the zombification to only work if some damage was dealt...

The present "touch and you're dead" mechanics would be fine in a more abstract system, say in Space Hulk or Templar Batttleforce. But X-Com is more complex and more simulationist than that; such an abstract rule just looks like bad (or should I say lazy) design, not matching the rest.
Title: Re: How do I make Chryssalids not always succeed?
Post by: hellrazor on July 16, 2017, 12:17:59 pm
Actually this is only true for melee attacks.
If you use a ranged zombification attack, it actually only converts if you actually hit.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 16, 2017, 12:35:42 pm
Actually this is only true for melee attacks.
If you use a ranged zombification attack, it actually only converts if you actually hit.

So what's different...? In melee, the Chryssalid also has to hit.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Yankes on July 16, 2017, 12:39:28 pm
Yeah, I guess I will pester someone to modify this code of the zombification to only work if some damage was dealt...

The present "touch and you're dead" mechanics would be fine in a more abstract system, say in Space Hulk or Templar Batttleforce. But X-Com is more complex and more simulationist than that; such an abstract rule just looks like bad (or should I say lazy) design, not matching the rest.
doable, even more, I will probably do it today.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 16, 2017, 12:51:42 pm
doable, even more, I will probably do it today.

Great! Another improvement! :)
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 16, 2017, 03:58:07 pm
I foresee a possible problem if you try to implement zombification on death only: if the soldier falls unconscious they would fail to become a zombie even if the Chryssalid had time units remaining to continue attacking.

Possible solutions:
1.) zombification on neutralization
2.) prevent unconscious state from attack
3.) zombification if any damage has been dealt
4.) chance-based zombification based on what percentage of the soldier's health was lost to the combined attacks
5.) chance-based zombification based on what percentage of the soldier's health remains at the end of the attacks
Title: Re: How do I make Chryssalids not always succeed?
Post by: Solarius Scorch on July 16, 2017, 04:11:46 pm
I foresee a possible problem if you try to implement zombification on death only

Nobody ever has suggested this.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Yankes on July 16, 2017, 04:40:44 pm
This is be done (in OXCE 4.0) by scripts, you get percentage chance to transform and you can reduce or increase it.
This mean that if you want it only work on killing hit then you check for current damage to health is greater than current health and you leave it unchanged otherwise you set to 0 disabling it. You can made this proportional to damage done (scratch is safe :)).
Title: Re: How do I make Chryssalids not always succeed?
Post by: Warboy1982 on July 16, 2017, 10:16:22 pm
Actually this is only true for melee attacks.
If you use a ranged zombification attack, it actually only converts if you actually hit.

meaning it's identical for both.
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 16, 2017, 10:52:26 pm
This is be done (in OXCE 4.0) by scripts, you get percentage chance to transform and you can reduce or increase it.
This mean that if you want it only work on killing hit then you check for current damage to health is greater than current health and you leave it unchanged otherwise you set to 0 disabling it. You can made this proportional to damage done (scratch is safe :)).
Thanks!

I've never used OXCE before but I'm going to try it for the first time. Maybe I am ready now!


Nobody ever has suggested this.
I suggested it in the first post.
Title: Re: How do I make Chryssalids not always succeed?
Post by: SteamXCOM on July 17, 2017, 01:45:36 am
Let them be totally evel and succeed in their hits.
Once you get flight suits you will become THEIR horror as
you hover out of range and blast them with pistols
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 17, 2017, 02:45:46 am
In my mod, power suits have more armor than flying suits, and power suits give more strength while flying suits give more firing accuracy. I like giving the player choices, and letting armor defend against chryssalids is part of that choice. Of course, flying suits can make you immune to chryssalids, but there are other considerations, such as killing the chryssalids before they get to civilians, or dealing with all of the snakemen. Because of that, I like power suits to offer protection from chryssalids as well, so that there's still a choice in armor rather than one obvious best option for all cases.
Title: Re: How do I make Chryssalids not always succeed?
Post by: SteamXCOM on July 17, 2017, 05:09:20 am
I like power suits to offer protection from chryssalids as well, so that there's still a choice in armor rather than one obvious best option for all cases.

In some other forums or threads some did complain about the flying suits giving that advantage over the chryssis: 
 Its always nice to have choices, maybe I myself would not mod the chryssis, no, but to have another creature to do a similar effect but be limited by armor could be nice to have.
 
  In some ways it's like my experiment spawning civilians from dead civilians that automatically turned hostile, which is undesirable for what I had in mind.  Maybe the  civilian spawn as described is a bad idea, however, the effect to have an allied tank crew spawn from a blown up vehicle would  be useful, that is if the game could spawn units that way  that did not spawn hostile.
 
  The demo that was released around the time the game came out, I must have played it about 18 times, could not beat it once, came close , but always a CHRYSSALID inconveniently appeared, zombified someone and the game went south from there.
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 27, 2018, 03:07:07 pm
This is be done (in OXCE 4.0) by scripts, you get percentage chance to transform and you can reduce or increase it.
This mean that if you want it only work on killing hit then you check for current damage to health is greater than current health and you leave it unchanged otherwise you set to 0 disabling it. You can made this proportional to damage done (scratch is safe :)).

Can someone explain how to use this feature? I'm lost here.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Meridian on July 27, 2018, 03:13:35 pm
Can someone explain how to use this feature? I'm lost here.

Yankes or Ohartenstein can write a script for you if you tell them how exactly should it work.
For the rest of us, it's black magic.
Title: Re: How do I make Chryssalids not always succeed?
Post by: ohartenstein23 on July 27, 2018, 03:18:59 pm
OXCE 4.0 isn't out yet, so I can't do any black magic for you.
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 27, 2018, 03:22:11 pm
Yankes or Ohartenstein can write a script for you

Oh, I thought it was already done.


Simple: the chance of success is checked per attack, and is identical to the soldier's %remaining health. So it's possible for the attack to do no damage and turn them into a zombie, if they had already taken damage before. Probably they have a hole in their armor now...


I guess I'll hop back on the hype train then.
Title: Re: How do I make Chryssalids not always succeed?
Post by: The Reaver of Darkness on July 27, 2018, 07:51:14 pm
I also noticed in stats for nerds, armor has an attribute: Can be Zombified: true. How do I set this false for an armor?
Title: Re: How do I make Chryssalids not always succeed?
Post by: ohartenstein23 on July 27, 2018, 07:56:58 pm
Code: [Select]
    zombiImmune: true
Title: Re: How do I make Chryssalids not always succeed?
Post by: Meridian on July 27, 2018, 07:57:28 pm
I also noticed in stats for nerds, armor has an attribute: Can be Zombified: true. How do I set this false for an armor?

If you click on DEBUG button, you get the ruleset names of the attributes, in this case:

Code: [Select]
  zombiImmune: true
Title: Re: How do I make Chryssalids not always succeed?
Post by: Yankes on July 27, 2018, 09:05:05 pm
Oh, I thought it was already done.


Simple: the chance of success is checked per attack, and is identical to the soldier's %remaining health. So it's possible for the attack to do no damage and turn them into a zombie, if they had already taken damage before. Probably they have a hole in their armor now...


I guess I'll hop back on the hype train then.
Is done in my code but not released. For functionality itself. You get number in range `1` to `100` then you can get value of attack (another number) and some stats of attacker and victim. With all this values you can do any basic arithmetic operations (like `+`, `-`, `/`, `*`, `%`) to get result in range of `0` to `100` and this number will be used by game engine to determine if this victim will change to zombi or not (`0` -> no zombi, `100` -> always zombi).
Title: Re: How do I make Chryssalids not always succeed?
Post by: kharille on July 30, 2018, 10:44:38 am
Oh?  I just shoot rookies and civilians when I know chryssalids are near.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Ethereal on July 30, 2018, 11:00:56 am
I don't really understand what these calculations are for, but I can confirm in armor with "zombiImmune: true" soldiers never become zombies. In the armor without this parameter, from turning into a zombie saves a "melee Dodge:" when Chryssalid stupidly misses the target. However if he not misses, the trouble can not be avoided, but it's as lucky. In General, the instruments to combat Chryssalid and Tentaculat full.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Meridian on October 12, 2020, 02:12:17 pm
Pasting a sample script here, just in case people are still interested.

Code: [Select]
extended:
  scripts:
    damageUnit:
    # Global fix to Transformation attacks like Chryssalid zombification
    # Requires at least 1 hit point of damage before zombification triggers
    # This applies to *every* weapon that zombifies.  It *has* to get through armor to work.
      - offset: 4
        code: |
          if gt to_transform 0;
            if eq to_health 0;
              set to_transform 0;
            end;
          end;
          return;
Title: Re: How do I make Chryssalids not always succeed?
Post by: Ethereal on October 12, 2020, 05:33:50 pm
Pasting a sample script here, just in case people are still interested.

I'm weak in scripts ... If set "if eq to_health 10" in this script, then the damage for transformation will have to be more than 10 points?
Title: Re: How do I make Chryssalids not always succeed?
Post by: Meridian on October 12, 2020, 06:28:44 pm
I'm weak in scripts ... If set "if eq to_health 10" in this script, then the damage for transformation will have to be more than 10 points?

eq stands for "equal"
you can use gt which stands for "greater than" and lt which stands for "less than"

so "if lt to_health 11" is what you're looking for... meaning "if to_health is less than 11, don't transform"
Title: Re: How do I make Chryssalids not always succeed?
Post by: Ethereal on October 12, 2020, 08:38:31 pm
Meridian, does it work at you? Maybe not compatible with the vampirism script?
Title: Re: How do I make Chryssalids not always succeed?
Post by: robin on October 12, 2020, 09:16:05 pm
Pasting a sample script here, just in case people are still interested.

Code: [Select]
extended:
  scripts:
    damageUnit:
    # Global fix to Transformation attacks like Chryssalid zombification
    # Requires at least 1 hit point of damage before zombification triggers
    # This applies to *every* weapon that zombifies.  It *has* to get through armor to work.
      - offset: 4
        code: |
          if gt to_transform 0;
            if eq to_health 0;
              set to_transform 0;
            end;
          end;
          return;
I wanted this, thanks!
Title: Re: How do I make Chryssalids not always succeed?
Post by: Meridian on October 12, 2020, 09:43:47 pm
Meridian, does it work at you? Maybe not compatible with the vampirism script?

I just copied it from piratez, I didn't test it... I'll test it later.
Title: Re: How do I make Chryssalids not always succeed?
Post by: Ethereal on October 12, 2020, 09:51:19 pm
I just copied it from piratez, I didn't test it... I'll test it later.

Oh, exactly! Found! I have a file with scripts from there. Thanks, figured it out.