Author Topic: [Solved] spawnUnit VS overkill  (Read 2791 times)

Offline robin

  • Commander
  • *****
  • Posts: 1226
  • ULTIMATE ROOKIE
    • View Profile
[Solved] spawnUnit VS overkill
« on: February 15, 2022, 12:20:04 am »
For my swarm alien I wanted to give the impression that you're thinning it out as you damage it.
So I used the spawnUnit function to create 3 "stages" (actual units) for the alien.
At the same time I want you to be able to obliterate it in one hit with fire/explosive.

I thought that overkill allowed to disintegrate units preventing them to spawn the children units.. but it doesn't seem to work: I set fire/explosive damage to 999 and the children unit is still there.

(I guess I can use just 2 stages but the 3 stages don't seem to be the issue).

So at this point I'm doubting that overkill has that prevention function at all. Does it?
Thanks
« Last Edit: February 12, 2023, 12:19:05 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: spawnUnit VS overkill
« Reply #1 on: February 15, 2022, 12:31:23 am »
Do you enabled overkill in weapon damage type? by default it disabled to be compatible with original game.
Another is "threshold" on what unit consider itself to be obliterated.

As side note now is possible to have arbitrary way to override spawn units in y-script, aka you could skip some stages if you do a lot of damage.

Offline robin

  • Commander
  • *****
  • Posts: 1226
  • ULTIMATE ROOKIE
    • View Profile
Re: spawnUnit VS overkill
« Reply #2 on: February 15, 2022, 12:39:22 am »
On ruleset reference I can only find:

armor
    overkill (default=0.5; which AFAIK is the threshold you speak of).

item
    damageAlter
        IgnoreOverKill (default=false).

What is there to enable? Seems to be enabled by default to me.

Edit: wait, so I should set IgnoreOverKill=true? But to me setting true sounds like I'm DISABLING the overkill function. Kind of confusing the way it is explained.
« Last Edit: February 15, 2022, 12:43:11 am by robin »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: spawnUnit VS overkill
« Reply #3 on: February 15, 2022, 03:30:35 am »
Probably bug in documentation, default is `true` as it do not allow overkill, this is because I initially make couple of damage types do overkill but I reverted it to not changing original game play.
Sorry for confusion.
(I updated wiki to match real default)

Offline Nord

  • Commander
  • *****
  • Posts: 1751
  • The Gate is open.
    • View Profile
Re: spawnUnit VS overkill
« Reply #4 on: February 15, 2022, 08:07:19 am »
Important fact. Thans for explanation.

Offline robin

  • Commander
  • *****
  • Posts: 1226
  • ULTIMATE ROOKIE
    • View Profile
Re: spawnUnit VS overkill
« Reply #5 on: February 15, 2022, 09:38:42 pm »
Now it makes sense, thanks!

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: spawnUnit VS overkill
« Reply #6 on: February 15, 2022, 09:58:12 pm »
Technically speaking, the default for `IgnoreOverkill` is `false`: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Mod/RuleDamageType.cpp#L33

And then it is set to `true`manually for most damage types: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Mod/Mod.cpp#L397
There is a whole table about it in the documentation, at the bottom of this section: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Item_Damage_Types

Offline robin

  • Commander
  • *****
  • Posts: 1226
  • ULTIMATE ROOKIE
    • View Profile
Re: spawnUnit VS overkill
« Reply #7 on: February 15, 2022, 11:11:09 pm »
Thank you, I missed that.