Sorry, but I tried your script and the logs clearly indicate what's wrong.
[23-11-2023_07-09-43] [ERROR] Invalid variable name 'transform'
[23-11-2023_07-09-43] [ERROR] Error in matching arguments for operator 'var'
[23-11-2023_07-09-43] [ERROR] Error in parsing script 'damageSpecialUnit' for 'Global Event Script': invalid operation in line: 'var int transform 0;'
It says exactly, which line is wrong ('var int transform 0;').
And it says exactly what's wrong (invalid variable name).
And Nord's answer is also correct.
Once you fix the issue with the variable name, the logs will complain about the missing return too.
Here's a fixed script:
extended:
tags:
BattleUnit:
LRF_IS_DEAD: int
scripts:
damageSpecialUnit:
- offset: 99
code: |
var int temp 0;
var int transformx 0;
set temp transform_chance;
#...magic...
set transform_chance temp;
debug_log "transform " temp;
battle_game.flashLongMessage "STR_TRANSFORM_STRING";
return;