Thank you!
It is fixed except for the part with:
battle_game.flashMessage "STR_TEST_MSG_DAMAGE_STRENGTH" DMG WeaponCurrentPower;
For some reason it does display
STR_TEST_MSG_DAMAGE_STRENGTH but not
DMG or
WeaponCurrentPower.
(Corrected Mod Download)TestMod (Guaranteed Damage) V0-4.zip
`currPower` yes, this is effective power affecting given unit (aka after random and resistances), but this value is only informative, you can't change it and even if you would change it it would not affect any thing else.
This is the first time I've tried using "
battle_game.flashMessage" in a script and I've noticed that in the verbose version of the
openxcom.log's '
damageUnit' section there are five uses of it:
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text] [int] [int] [int] [int]
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text] [int] [int]
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text] [int]
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text]
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text] [int] [int] [int]
Each one looks like it will display a different number of variables holding an
int.
I thought that if two variables were passed into
battle_game.flashMessage after the
[text] string it would automatically select the version that allowed for it.
battle_game.flashMessage "STR_TEST_MSG_DAMAGE_STRENGTH" DMG WeaponCurrentPower;
Name: BattleGame.flashMessage Args: [ptre BattleGame] [text] [int] [int]
It currently should be displaying "
Damage: [Health Lost Amount] [Current Power Of attack]" but instead it just shows the "
Damage:" message
First of all, if you have problems with script use `debug_log` to track what happens exactly in your script.
Second do you have any errors in log? It could be simply some syntax error causing whole script to fail to load.
"is not appearing" <- this indicate that it possible that whole script fail to load as message should be always show.
It is as you said. In the
openxcom.log it is detecting an error on one of the lines:
[19-11-2021_20-54-28] [ERROR] Can't match overload for operator 'RuleItem.getTag' for:
[19-11-2021_20-54-28] [ERROR] [var ptr RuleItem] [var int] [RuleArmor.Tag]
[19-11-2021_20-54-28] [ERROR] Expected:
[19-11-2021_20-54-28] [ERROR] [ptr RuleItem] [var int] [RuleItem.Tag]
[19-11-2021_20-54-28] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'item_rule.getTag ItemAllowed Tag.GUARANTEED_DAMAGE_ALLOWED_ARMOR;'
I made the mistake of changing the variables names defined in the
[extended:] [tags:] section to be more readable, but then forgetting to update their names in the rest of the script.
if eq ItemAllowed ArmorAllowed;
This probably do not work as you think, this will pass when both are allowed and when both are NOT allowed (as `eq 0 0` is true)
You would probably want use:
if and eq ItemAllowed 1 eq ArmorAllowed 1;
Well spotted. Using a 0/1(True/False) toggle would normally be the easier solution:
if gt ArmorAllowed 0;
But in this case I'm trying to create matching weapon armor sets that cause extra damage only when both are present.
if eq ItemAllowed ArmorAllowed;
So Armor 0 & Weapon 0 = True
So Armor 1 & Weapon 0 = False
So Armor 0 & Weapon 1 = False
So Armor 1 & Weapon 1 = True
So Armor 2 & Weapon 0 = False
So Armor 0 & Weapon 2 = False
So Armor 2 & Weapon 2 = True
Etc . . .
The current limit is that if I want any overlap so that a Weapon(
3)-Armor(
3) combination also works with Weapon(
0)-Armor(
3) I'll need to code extra catches into the script as an if statement like this:
if eq ArmorAllowed 3;
if eq ItemAllowed 0;
# [=] Code to deal the extra damage [=]
end;
end;
But that seems simple enough that it won't be a problem.
unit.addHealth invert;
This is not needed, you can easy make `add to_health DAG;` and this would have benedicts that other mods could affect this value too (like item that reduce all damage to health by half).
That is much better, I'll change the code to use the more flexible
to_health variable.
I'm assuming that
to_health is the calculated amount of health reduction achieved by the current attack.
Can anything in the game effect the added amount of health reduction this mod is introducing? (Aside from another script or mod)
For example item settings like:
[items:] [damageAlter:] [ToHealth:] or
[RandomHealth:]I am using settings like those on a lot of other items and to achieve my desired effect it needs the value of damage dealt by this script to be consistently 100% of its value every time.