I would like to keep the default 3 for the standard death while being able to extend the more messy ones to 8.
Although it will work a little different I think you can currently script the end goal you want.
Use an altered version of this script Yankes uploaded that changes which frames on a sprite sheet are loaded for the death animation:
https://openxcom.org/forum/index.php/topic,10392.msg144792.html#msg144792extended:
scripts:
selectUnitSprite:
- offset: -2
code: |
var int drawingRoutine;
var int deathFrames;
if or
eq blit_part blit_torso
eq blit_part blit_legs
;
var ptr RuleArmor armor;
unit.getRuleArmor armor;
armor.getDrawingRoutine drawingRoutine;
armor.getDeathFrames deathFrames;
if and
eq drawingRoutine 0
gt sprite_index 264 #bigger than first death frame
gt deathFrames 3
;
sub deathFrames 3;
add sprite_index deathFrames;
end;
end;
return sprite_index;
Global script, check for `drawingRoutine: 0` and for e.g. `deathFrames: 5`.
Script shift all frames after death frame by additional death frames.
I think the trick would be to place a check for the type of situation/damage you want right before the frame offset so that a different frame set is used depending on what the unit was hit with.
Pseudocode Example:
if situation 1 # (Unit was hit for over 50 of its current health and died)
sprite_index 264
end
if situation 2 # (Unit was hit be a fire attack and died)
sprite_index 274
end
if situation 3 # (Unit was hit be a stunning attack and collapsed)
sprite_index 284
end
You would need several sets of the death animation frames each offset by X amount ahead of the last for the script to work. Although it won't let you increase or decrease the number of death frames you can just insert your expected FloorOb for any addtional frames on the sprite sheet for deaths with a lower frame count. (The delay should be very brief)
Here is an example unit sprite sheet of what I mean, the death frames are not currently aligned to the correct index I'm just trying to show what I mean visually: