Hello. I have a feature request - implementation of ptre BattleUnit for target_unit & observer_unit, which allow modder to change unit's stats depending of whether it sees enemy or spotted by it.
Background: I'm working under SCP Foundation theme mod and I think it's possible to implement the most iconic and in fact very first SCP ever written
https://scp-wiki.wikidot.com/scp-173. The script for it could look like this:
armors:
- type: SECTOID_ARMOR0
tags:
IS_SCP173: 1
extended:
tags:
RuleArmor:
IS_SCP173: int
scripts:
visibilityUnit:
- offset: 4
code: |
var ptr RuleArmor armorRuleset;
var int scp173;
var int observerFaction;
var int targetTU;
var int targetTUmax;
var int observerMorale;
var int observerBravery;
var int cowardness 110;
target_unit.getRuleArmor armorRuleset;
armorRuleset.getTag scp173 Tag.IS_SCP173;
if eq scp173 1;
target_unit.Stats.getTimeUnits targetTUmax;
target_unit.setTimeUnits targetTUmax;
observer_unit.getFaction observerFaction;
debug_log "SCP is" target_unit "Observer is" observer_unit;
if neq observerFaction 1;
target_unit.setTimeUnits 0;
observer_unit.Stats.getBravery observerBravery;
observer_unit.getMorale observerMorale;
sub cowardness observerBravery;
sub observerMorale cowardness;
observer_unit.setMorale observerMorale;
end;
end;
return current_visibility visibility_mode;
This could be useful in general when modder needs to, e.g., disrupt enemy's accuracy by wearing a chameleon armor of some sort.