aliens

Author Topic: [y-script] Handcuffs  (Read 2628 times)

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 2401
    • View Profile
Re: [Script] Handcuffs
« Reply #30 on: May 06, 2020, 07:52:11 pm »
ups, I forget one thing, spending resources is unconditional BEFORE script is run.
I incorrectly assume that default behavior still have change of charges but it was removed from it.

Code: [Select]
set medikit_action_type 0;
Is only responsible for:
a) Applying default healing or stim or pankilers
b) Updating item usage statistics (like revivedSoldier or appliedStimulant counts)

Spend of charges and costs are done before script unconditionally.

Sorry for confusion.

Offline Kozinsky

  • Sergeant
  • **
  • Posts: 25
  • Sorry for my bEd English
    • View Profile
Re: [Script] Handcuffs
« Reply #31 on: May 06, 2020, 08:33:32 pm »
Spend of charges and costs are done before script unconditionally.

I came to the same conclusion.
But it's strange that the script can affect an item that has run out of charges - in my case, it means that the item disappears from the game. I thought that first the algorithm of using the item is processed, then it disappears from the game after spending all its charge and only then the script starts.
Anyway, my task solution works pretty well.

Offline krautbernd

  • Commander
  • *****
  • Posts: 668
    • View Profile
Re: [Script] Handcuffs
« Reply #32 on: May 28, 2020, 12:37:27 pm »
Sometimes - not always - unconscious units become overstunned upon applying handcuffs. Checking the save file, health on these units declines every turn. From what I can tell (by manually reducing health in the save), the unit eventually dies from overstun. There is no way to prevent this in-game, as the stun level can't be reduced and handcuffs can not be removed. This makes applying handcuffs a potential liability.

Is this intended? Mod is XCF btw, but according to Solarius the script should be indentical.
« Last Edit: May 28, 2020, 12:47:14 pm by krautbernd »

Offline Kozinsky

  • Sergeant
  • **
  • Posts: 25
  • Sorry for my bEd English
    • View Profile
Re: [Script] Handcuffs
« Reply #33 on: May 28, 2020, 06:57:28 pm »
Sometimes - not always - unconscious units become overstunned upon applying handcuffs. Checking the save file, health on these units declines every turn. From what I can tell (by manually reducing health in the save), the unit eventually dies from overstun. There is no way to prevent this in-game, as the stun level can't be reduced and handcuffs can not be removed. This makes applying handcuffs a potential liability.

In examining this case, I concluded that the maximum safety stun level of the wounded creatures (before they begin to suffer damage from overstun) is lower than maxStunLevel. I therefore reduce maxStunLevel by the percentage reduction of the creature's health.
For example, there is a healthy creature with 100 HP and maxStunLevel 200, i.e. when it receives 201 stun level, it will receive damage from overstun.
We will deal 40 damage to this creature and its current health will be 60 HP. In this state the creature will take damage from overstun at (very approximately) 120 stun level.
I have implemented this algorithm in the current version of XCF at GitHub. But I need to run many different tests to make sure that this solution will always work fine.

Offline krautbernd

  • Commander
  • *****
  • Posts: 668
    • View Profile
Re: [Script] Handcuffs
« Reply #34 on: May 28, 2020, 07:53:07 pm »
Thanks for the update on this, will wait for next XCF version.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5239
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [Script] Handcuffs
« Reply #35 on: September 18, 2020, 07:11:15 pm »
1) Is there a standalone version of this script? There's downloads, but not sure how up to date are they. (I'm interested in the version as described in the first posts, with % chances of targets breaking out dependant on their Strength.)
2) Would it be possible to add a text message when the target is getting handcuffed, and when handcuffing failed due to it being immune to that level of handcuffs?
3) Would it be possible to add some indicator that target broke out of handcuffs, ideally by playing a sound?

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1888
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Script] Handcuffs
« Reply #36 on: September 18, 2020, 09:04:47 pm »
Scripts can't play sounds, but text warnings are possible. Probably could do an indicator like colored flashing of the the corpse while handcuffed.