Ok, I'm at the point of trying to test the Alt-Corpse script.
I've created a script for both floorobs, and bigobs. For this test, I've trimmed it down to just floorobs by commenting out the bigobs portion.
The script is included in the code section below.
extended:
tags:
RuleArmor:
CORPSE_SWITCH_ENABLED: int
CORPSE_SWITCH_RESOURCES_MOD: RuleList
CORPSE_SWITCH_SPRITE_FLOOR_STUN: int
CORPSE_SWITCH_SPRITE_FLOOR_WOUND: int
CORPSE_SWITCH_SPRITE_FLOOR_DEAD: int
CORPSE_SWITCH_SPRITE_BIG_STUN: int
CORPSE_SWITCH_SPRITE_BIG_WOUND: int
CORPSE_SWITCH_SPRITE_BIG_DEAD: int
scripts:
selectItemSprite:
- offset: 1
code: |
var int curr_hp;
var int curr_wounds;
var int temp;
var ptr BattleUnit unit;
var ptr RuleArmor armor;
item.getBattleUnit unit;
unit.getRuleArmor armor;
if neq armor null;
# begin testing status of for floor ob graphics
if eq blit_part blit_item_floor;
unit.getHealth curr_hp;
unit.getFatalwoundsTotal curr_wounds;w
armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
if eq temp 1;
if le curr_hp 0;
armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_DEAD;
else gt curr_wounds 0;
armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_WOUND;
else;
armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_FLOOR_STUN;
end;
armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
rules.getSpriteOffsetFloorob sprite_index temp;
return sprite_index;
end;
# begin testing status of for big ob graphics
#if eq blit_part blit_item_floor;
# unit.getHealth curr_hp;
# unit.getFatalwoundsTotal curr_wounds;w
# armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;
# if eq temp 1;
# if le curr_hp 0;
# armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_DEAD;
# else gt curr_wounds 0;
# armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_WOUND;
# else;
# armor.getTag sprite_index Tag.CORPSE_SWITCH_SPRITE_BIG_STUN;
# end;
# armor.getTag temp Tag.CORPSE_SWITCH_RESOURCES_MOD;
# rules.getSpriteOffsetBigobs sprite_index temp;
# return sprite_index;
# end;
#end;
end;
add sprite_index sprite_offset;
return sprite_index;
#usage
#armors:
# - type: STR_NONE_UC
# tags:
# CORPSE_SWITCH_ENABLED: 1 #1 enable this functionality for this unit, 0 disable
# CORPSE_SWITCH_RESOURCES_MOD: current #to what mod sprites belongs to, `current` mean this mod.
## CORPSE_SWITCH_RESOURCES_MOD: master #to what mod sprites belongs to, `current` mean this mod.
# CORPSE_SWITCH_SPRITE_FLOOR_STUN: 1001
# CORPSE_SWITCH_SPRITE_FLOOR_WOUND: 1002
# CORPSE_SWITCH_SPRITE_FLOOR_DEAD: 1003
# CORPSE_SWITCH_SPRITE_BIG_STUN: 2001
# CORPSE_SWITCH_SPRITE_BIG_WOUND: 2002
# CORPSE_SWITCH_SPRITE_BIG_DEAD: 2003
Beyond this, I've got two rulesets, one to define all the sprites, and one to set the tag on the armors, as well as pass the sprite numbers for each state.
For my test, I've trimmed down the corpses to only the "Bandit" faction in my rulesets by commenting out all the others.
I fire up the game. Ensure the mod is on. The game reloads. So far, so good. I decide to use "New Battle" to generate a battle with the Bandit faction, equipping the troops. When I go to start the battle I get a CTD.
Checking the openxcom.log I spot the following error:
[16-07-2016 20:11:24] [ERROR] Error in parsing script 'selectItemSprite' for 'Global Event Script': invalid operation in line: 'w
armor.getTag temp Tag.CORPSE_SWITCH_ENABLED;'
Should the "temp" be in that line? Or have I messed up something broader?
I'll attach the mod itself here for trouble shooting too.