Hello,
Been a while since I last posted and worked on my mod, I'm back one year later and working on a script I worked on before. The idea of this script would be to skip the player's first turn only for certain mission, as such I'd like to be able to control this boolean (true/false) per mission.
I had a previously working prototype of the script which "Filip H" (discord) helped me make, however this version didn't allow me to control when I wanted this feature to be active, it was basically always active.
The old version:
# Script allowing Xcom: Rising from the deep to always skip first turn in battlescape and let the unit regain TU for the second turn.
extended:
scripts:
newTurnUnit:
- offset: 21
code: |
var int isPlayerUnit;
var int maxUnitTu;
var int isEnemyTurn;
unit.getFaction isPlayerUnit;
unit.getTimeUnitsMax maxUnitTu;
battle_game.getTurnSide isEnemyTurn;
if eq turn 1;
if eq isPlayerUnit 0;
unit.setTimeUnits 0 ;
if eq isEnemyTurn 1;
unit.setTimeUnits maxUnitTu;
end;
end;
end;
return;
In the new version, I'm trying to add an item through the alienDeployments.rul with [ExtraRandomItems], however that wouldn't work on the long run, there surely is a better way to make a boolean to control the skip first turn per mission.
The new (WIP) version, which currently doesn't work:
#------DUMMY ITEM FOR BATTLETURN SKIP
items:
- type: STR_TURN_SKIP
categories: [STR_LOGIC]
tags:
SKIP_TAG: 1
# Script allowing Xcom: Rising from the deep to always skip first turn in battlescape and let the unit regain TU for the second turn.
extended:
tags:
BattleGame:
SKIP_TAG: int
scripts:
#---Check if SKIP_TAG is present to skip first turn or not
createItem:
- offset: 21
code: |
var int isSkipTurn;
item.getTag isSkipTurn Tag.SKIP_TAG;
return;
#---Skip First Turn
newTurnUnit:
- offset: 22
code: |
var int isPlayerUnit;
var int maxUnitTu;
var int isEnemyTurn;
var int isSkipTurnPointer;
unit.getFaction isPlayerUnit;
unit.getTimeUnitsMax maxUnitTu;
battle_game.getTurnSide isEnemyTurn;
battle_game.getTag isSkipTurnPointer Tag.isSkipTurn;
if eq isSkipTurnPointer 1;
if eq turn 1;
if eq isPlayerUnit 0;
unit.setTimeUnits 0 ;
if eq isEnemyTurn 1;
unit.setTimeUnits maxUnitTu;
end;
end;
end;
end;
return;
So all in all, a way to enable/disable skip first turn per mission.
EDIT:
Solution Down Below.