OpenXcom Forum
Modding => OXCE Support => OpenXcom Extended => OXCE Support Y-scripts => Topic started by: Barghum on February 27, 2024, 05:09:09 am
-
I'm making an XCF Submod that features some new shield piercers, a stealth mission, and lasers blinding on hit.
but the Y-scripts are a bit...
broken.
extended:
tags:
RuleItem:
IS_KEY: int
ITEM_HAS_BIPOD: int
ITEM_RECOIL: int
ANTI_LASER_GOGGLES: int
SETS_CONCEALED: int
SHIELD_SKIPPER: int
WEAPON_IS_CHEMLASER: int
GOGGLES_STRENGTH: int
LASER_BLIND_POWER: int
RuleArmor:
IS_LOCK: int
ARMOR_IS_STEALTHY: int
scripts:
visibilityUnit:
- new: STEALTH_EFFECT
offset: 2
code: |
var int is_concealed;
if eq is_concealed 1;
set current_visibility 5;
debug_log "CONCEALED";
else if eq is_concealed 0;
set current_visibility 100;
debug_log "DeCONCEALED";
end;
return;
newTurnItem:
- new: GOGGLES_STRENGTH
offset: 9
code: |
var ptre BattleUnit itemOwner;
var ptr RuleItem itemRuleset;
var int anti_laser_goggles;
var int las_goggles_worn;
var int goggles_are_broken;
item.getOwner itemOwner;
# If no owner, skip script
if eq itemOwner null;
debug_log "ItemOwnerIsNullValue";
return;
end;
item.getRuleItem itemRuleset;
itemRuleset.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
if eq goggles_are_broken 1;
debug_log "Goggles_blown_to_heaven't";
return;
end;
if eq anti_laser_goggles 1;
set las_goggles_worn 1;
debug_log "Anti_laser_goggles_working";
end;
return;
hitUnit:
- offset: 20.06
code: |
var ptr RuleItem weaponRuleset;
var ptr RuleArmor;
var ptr BattleUnit;
var int is_lock;
var int is_key;
item_rule.getTag is_key Tag.IS_KEY;
BattleUnit.getRuleArmor is_lock Tag.IS_LOCK;
if and eq is_lock 1 eq is_key 1;
BattleUnit.Stats.addHealth -999;
battle_game.flashMessage "STR_PADLOCK_UNLOCKED";
debug_log "Padlock_Unlocked";
BattleItem.setAmmoQuantity 0;
else or if is_lock 0 if eq is_key 0;
return;
end;
end;
end;
end;
return;
- new: GOGGLES_STRENGTH_lowerer_and_breaker
offset: 9
code: |
var int goggles_curr_strength;
var int goggles_are_broken;
sub goggles_curr_strength 1;
if eq goggles_curr_strength 0;
set goggles_are_broken 1;
end;
end;
return;
- new: GOGGLES_STRENGTH_lowerer_and_breaker2
offset: 10
code: |
var ptr RuleItem weaponRuleset;
var int shield_skipper;
var int shieldResistCoeff;
var int shieldType;
item_rule.getTag shield_skipper Tag.SHIELD_SKIPPER;
if and eq shield_skipper 1 shieldType 0;
set shieldResistCoeff 150; #was 50
end;
if and eq shield_skipper 2 shieldType 0;
set shieldResistCoeff 135; #was 65
end;
if and eq shield_skipper 3 shieldType 0;
set shieldResistCoeff 140; #was 60
end;
if and eq shield_skipper 4 shieldType 0;
set shieldResistCoeff 125; #was 75
end;
if and eq shield_skipper 5 shieldType 0;
set shieldResistCoeff 150; #Was 50
end;
if and eq shield_skipper 6 shieldType 0;
set shieldResistCoeff 135; #WAS 65
end;
if and eq shield_skipper 7 shieldType 0;
set shieldResistCoeff 175; #was 25
end;
if and eq shield_skipper 8 shieldType 0;
set shieldResistCoeff 160; #Was 40
end;
if and eq shield_skipper 9 shieldType 0;
set shieldResistCoeff 130; #was 70
end;
if and eq shield_skipper 1 shieldType 1;
set shieldResistCoeff 83; #def 33
end;
if and eq shield_skipper 2 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 3 shieldType 1;
set shieldResistCoeff 73;
end;
if and eq shield_skipper 4 shieldType 1;
set shieldResistCoeff 58;
end;
if and eq shield_skipper 5 shieldType 1;
set shieldResistCoeff 83;
end;
if and eq shield_skipper 6 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 7 shieldType 1;
set shieldResistCoeff 108;
end;
if and eq shield_skipper 8 shieldType 1;
set shieldResistCoeff 93;
end;
if and eq shield_skipper 9 shieldType 1;
set shieldResistCoeff 63;
end;
if and eq shield_skipper 1 shieldType 2;
set shieldResistCoeff 225; #def 175
end;
if and eq shield_skipper 2 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 3 shieldType 2;
set shieldResistCoeff 215;
end;
if and eq shield_skipper 4 shieldType 2;
set shieldResistCoeff 200;
end;
if and eq shield_skipper 5 shieldType 2;
set shieldResistCoeff 225;
end;
if and eq shield_skipper 6 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 7 shieldType 2;
set shieldResistCoeff 250;
end;
if and eq shield_skipper 8 shieldType 2;
set shieldResistCoeff 235;
end;
if and eq shield_skipper 9 shieldType 2;
set shieldResistCoeff 205;
end;
if and eq shield_skipper 1 shieldType 3;
set shieldResistCoeff 100; #def 50
end;
if and eq shield_skipper 2 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 3 shieldType 3;
set shieldResistCoeff 90;
end;
if and eq shield_skipper 4 shieldType 3;
set shieldResistCoeff 75;
end;
if and eq shield_skipper 5 shieldType 3;
set shieldResistCoeff 100;
end;
if and eq shield_skipper 6 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 7 shieldType 3;
set shieldResistCoeff 175;
end;
if and eq shield_skipper 8 shieldType 3;
set shieldResistCoeff 160;
end;
if and eq shield_skipper 9 shieldType 3;
set shieldResistCoeff 130;
end;
end;
return;
- new: Stealth_remover
offset: 11
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int weapon_is_quiet;
itemRuleset.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;
if eq weapon_is_quiet 1;
return;
end;
else set attacker is_concealed 0;
end;
return;
- new: Stealth_SETTER
offset: 12
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int sets_concealed;
var ptr RuleArmor
var int armor_is_stealthy;
itemRuleset.getTag sets_concealed Tag.SETS_CONCEALED;
RuleArmor.getTag armor_is_stealthy Tag.ARMOR_IS_STEALTHY;
if and eq sets_concealed 1 eq armor_is_stealthy 1;
BattleUnit.setTag is_concealed 1;
return;
end;
return;
returnFromMissionUnit:
- new: normalizer_laser
offset: 99.99
code: |
var ptre soldier_rule RuleSoldier;
var int inital_acc;
var int inital_rea;
var int inital_thw;
var int is_blinded;
if eq is_blinded 1;
GeoscapeSoldier.Stats.setReactions inital_rea;
GeoscapeSoldier.Stats.setThrowing inital_thw;
GeoscapeSoldier.Stats.setFiring inital_acc;
end;
return;
createUnit:
- new: INITAL_STATS
offset: 99.99
code: |
var ptre soldier_rule RuleSoldier;
var int inital_acc;
var int inital_rea;
var int inital_thw;
GeoscapeSoldier.Stats.getFiring inital_acc;
GeoscapeSoldier.Stats.getThrowing inital_thw;
GeoscapeSoldier.Stats.getReactions inital_rea;
end;
return;
createItem:
- new: Chemlaser_plus;
offset: 79
code: |
var ptr RuleItem weaponRuleset;
var ptr GeoscapeGame geoScape;
var ptr RuleResearch researchTopic;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int temp;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_1";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_2";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_3";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_4";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_5";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_6";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MAJOR_UPGRADE";
geoScape.isResearched temp researchTopic;
if neq temp 0;
set chemlaser_is_based 1;
return;
end;
return;
- new: goggles_inital_strength;
offset: 80
code: |
var int goggles_strength;
var int goggles_curr_strength;
itemRuleset.getTag goggles_strength Tag.GOGGLES_STRENGTH
set goggles_curr_strength goggles_strength;
return;
damageUnit:
- offset: 99.99
code: |
var ptr RuleItem weaponRuleset;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int weapon_is_chemlaser;
itemRuleset.getTag weapon_is_chemlaser Tag.WEAPON_IS_CHEMLASER;
if eq weapon_is_chemlaser 1;
add power researchLevel_chemlaser;
if eq chemlaser_is_based 1;
add power 10;
return;
end;
end;
end;
return;
- offset: 99.98
code: |
var ptr RuleItem weaponRuleset;
var int weapon_power_downgrade_level;
var int can_weapon_power_downgrade;
var int temp;
RuleItem.getTag can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;
RuleItem.getTag weapon_power_downgrade_level Tag.WEAPON_POWER_DOWNGRADE_LEVEL;
RuleItem.getPower temp;
if le 5 temp;
return;
end;
if eq can_weapon_power_downgrade 1;
add toHealth weapon_power_downgrade_level;
end;
end;
return;
- offset: 80
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int laser_blind_power;
var int anti_laser_goggles;
var int is_blinded;
var int blindness_level;
var int curr_acc;
var int curr_rea;
var int curr_thw;
var int curr_acc_minus;
var int curr_rea_minus;
var int curr_thw_minus;
RuleItem.getTag laser_blind_power Tag.LASER_BLIND_POWER;
RuleItem.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
GeoscapeSoldier.Stats.getFiring curr_acc;
GeoscapeSoldier.Stats.getReactions curr_rea;
GeoscapeSoldier.Stats.getThrowing curr_thw;
set curr_acc_minus curr_acc;
sub curr_acc_minus laser_blind_power;
set curr_rea_minus curr_rea;
sub curr_rea_minus laser_blind_power;
set curr_thw_minus curr_thw;
sub curr_thw_minus laser_blind_power;
if and ge laser_blind_power 1 eq anti_laser_goggles 0;
if eq goggles_are_broken 0;
BattleUnit.Stats.setFiring curr_acc_minus;
BattleUnit.Stats.setThrowing curr_thw_minus;
BattleUnit.Stats.setReactions curr_rea_minus;
battle_game.flashMessage "STR_LASER_BLINDED_DMG" laser_blind_power to_health to_armor;
return;
end;
return;
end;
end;
return;
thank you for reading :)
-
how exactly broken? what happens exactly? and what you expected to happens? do script compile at all?
-
[2024-02-27_17-32-01] [ERROR] Unknown variable name 'itemRuleset'
[2024-02-27_17-32-01] [ERROR] Error in parsing script 'createItem' for 'Global Event Script': invalid operation 'itemRuleset.getTag'
[2024-02-27_17-32-01] [ERROR] Error in parsing script 'createItem' for 'Global Event Script': invalid operation in line: 'itemRuleset.getTag goggles_strength Tag.GOGGLES_STRENGTH
set goggles_curr_strength goggles_strength;'
[2024-02-27_17-32-01] [ERROR] Invalid type 'soldier_rule'
[2024-02-27_17-32-02] [ERROR] Error in matching arguments for operator 'var'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation in line: 'var ptre soldier_rule RuleSoldier;'
[2024-02-27_17-32-02] [ERROR] Unknown variable name 'itemRuleset'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation 'itemRuleset.getTag'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'itemRuleset.getTag weapon_is_chemlaser Tag.WEAPON_IS_CHEMLASER;'
[2024-02-27_17-32-02] [ERROR] Can't match overload for operator 'RuleItem.getTag' for:
[2024-02-27_17-32-02] [ERROR] [var int]
[2024-02-27_17-32-02] [ERROR] Expected:
[2024-02-27_17-32-02] [ERROR] [ptr RuleItem] [var int] [RuleItem.Tag]
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'RuleItem.getTag can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
[2024-02-27_17-32-02] [ERROR] Invalid length of 'var' definition
[2024-02-27_17-32-02] [ERROR] Error in matching arguments for operator 'var'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'var ptr RuleArmor;'
[2024-02-27_17-32-02] [ERROR] Unexpected 'end'
[2024-02-27_17-32-02] [ERROR] Error in matching arguments for operator 'end'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'end;'
[2024-02-27_17-32-02] [ERROR] Unknown variable name 'item_rule'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'item_rule.getTag'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'item_rule.getTag shield_skipper Tag.SHIELD_SKIPPER;'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
[2024-02-27_17-32-02] [ERROR] Invalid type 'soldier_rule'
[2024-02-27_17-32-02] [ERROR] Error in matching arguments for operator 'var'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation in line: 'var ptre soldier_rule RuleSoldier;'
[2024-02-27_17-32-02] [ERROR] Invalid length of condition arguments
[2024-02-27_17-32-02] [ERROR] Error in processing 'else'
[2024-02-27_17-32-02] [ERROR] Error in matching arguments for operator 'else'
[2024-02-27_17-32-02] [ERROR] Error in parsing script 'visibilityUnit' for 'Global Event Script': invalid operation in line: 'else if eq is_concealed 0;'
[2024-02-27_17-32-02] [ERROR] Error in tags: 'WEAPON_POWER_DOWNGRADE_LEVEL' unknown tag name not defined in current file
[2024-02-27_17-32-02] [ERROR] Error in tags: 'CAN_WEAPON_POWER_DOWNGRADE' unknown tag name not defined in current file
I have provided the errors i got from booting up openXcom brutal ai hope this helps.
thank you for the time. :)
-
moved to BAI subforum
-
Does this happen with other mods too or only with your sub-mod?
-
I do not see this is related to BAI as most of this errors look like simply missing variables in script and typos.
e.g. script try use local variable `itemRuleset` that was not declared.
Another is missing `;` after `Tag.GOGGLES_STRENGTH`
`var ptre soldier_rule RuleSoldier;` mix order of names of variable to declare with name of type.
overall when you read errors, engine output at first most inner one, and on following lines that add more context.
-
I do not see this is related to BAI
Me neither. :o
There were some merge-conflicts in the past and having to manually resolve them always bears a risk of breaking something accidentally. But I don't think there were any in the y-script-parts.
-
moved to oxce support subforum
-
reworked it slightly
extended:
tags:
RuleItem:
IS_KEY: int
ITEM_HAS_BIPOD: int
ITEM_RECOIL: int
ANTI_LASER_GOGGLES: int
SETS_CONCEALED: int
SHIELD_SKIPPER: int
WEAPON_IS_CHEMLASER: int
GOGGLES_STRENGTH: int
LASER_BLIND_POWER: int
CAN_WEAPON_POWER_DOWNGRADE: int
WEAPON_POWER_DOWNGRADE_LEVEL: int
RuleArmor:
IS_LOCK: int
ARMOR_IS_STEALTHY: int
scripts:
visibilityUnit:
- new: STEALTH_EFFECT
offset: 2
code: |
var int is_concealed;
if eq is_concealed 1;
set current_visibility 5;
debug_log "CONCEALED";
else eq is_concealed 0;
set current_visibility 100;
debug_log "DeCONCEALED";
end;
return current_visibility visibility_mode;
hitUnit:
- offset: 20.06
code: |
var ptr RuleItem weaponRuleset;
var ptr RuleArmor;
var ptr BattleUnit;
var int is_lock;
var int is_key;
item_rule.getTag is_key Tag.IS_KEY;
BattleUnit.getRuleArmor is_lock Tag.IS_LOCK;
if and eq is_lock 1 eq is_key 1;
BattleUnit.Stats.addHealth -999;
battle_game.flashMessage "STR_PADLOCK_UNLOCKED";
debug_log "Padlock_Unlocked";
BattleItem.setAmmoQuantity 0;
else or if is_lock 0 if eq is_key 0;
return;
end;
end;
end;
end;
return;
- new: GOGGLES_STRENGTH_lowerer_and_breaker
offset: 9
code: |
var int goggles_curr_strength;
var int goggles_are_broken;
sub goggles_curr_strength 1;
if eq goggles_curr_strength 0;
set goggles_are_broken 1;
end;
end;
return;
- new: GOGGLES_STRENGTH_lowerer_and_breaker2
offset: 10
code: |
var ptr RuleItem weaponRuleset;
var int shield_skipper;
var int shieldResistCoeff;
var int shieldType;
item_rule.getTag shield_skipper Tag.SHIELD_SKIPPER;
if and eq shield_skipper 1 shieldType 0;
set shieldResistCoeff 150; #was 50
end;
if and eq shield_skipper 2 shieldType 0;
set shieldResistCoeff 135; #was 65
end;
if and eq shield_skipper 3 shieldType 0;
set shieldResistCoeff 140; #was 60
end;
if and eq shield_skipper 4 shieldType 0;
set shieldResistCoeff 125; #was 75
end;
if and eq shield_skipper 5 shieldType 0;
set shieldResistCoeff 150; #Was 50
end;
if and eq shield_skipper 6 shieldType 0;
set shieldResistCoeff 135; #WAS 65
end;
if and eq shield_skipper 7 shieldType 0;
set shieldResistCoeff 175; #was 25
end;
if and eq shield_skipper 8 shieldType 0;
set shieldResistCoeff 160; #Was 40
end;
if and eq shield_skipper 9 shieldType 0;
set shieldResistCoeff 130; #was 70
end;
if and eq shield_skipper 1 shieldType 1;
set shieldResistCoeff 83; #def 33
end;
if and eq shield_skipper 2 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 3 shieldType 1;
set shieldResistCoeff 73;
end;
if and eq shield_skipper 4 shieldType 1;
set shieldResistCoeff 58;
end;
if and eq shield_skipper 5 shieldType 1;
set shieldResistCoeff 83;
end;
if and eq shield_skipper 6 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 7 shieldType 1;
set shieldResistCoeff 108;
end;
if and eq shield_skipper 8 shieldType 1;
set shieldResistCoeff 93;
end;
if and eq shield_skipper 9 shieldType 1;
set shieldResistCoeff 63;
end;
if and eq shield_skipper 1 shieldType 2;
set shieldResistCoeff 225; #def 175
end;
if and eq shield_skipper 2 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 3 shieldType 2;
set shieldResistCoeff 215;
end;
if and eq shield_skipper 4 shieldType 2;
set shieldResistCoeff 200;
end;
if and eq shield_skipper 5 shieldType 2;
set shieldResistCoeff 225;
end;
if and eq shield_skipper 6 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 7 shieldType 2;
set shieldResistCoeff 250;
end;
if and eq shield_skipper 8 shieldType 2;
set shieldResistCoeff 235;
end;
if and eq shield_skipper 9 shieldType 2;
set shieldResistCoeff 205;
end;
if and eq shield_skipper 1 shieldType 3;
set shieldResistCoeff 100; #def 50
end;
if and eq shield_skipper 2 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 3 shieldType 3;
set shieldResistCoeff 90;
end;
if and eq shield_skipper 4 shieldType 3;
set shieldResistCoeff 75;
end;
if and eq shield_skipper 5 shieldType 3;
set shieldResistCoeff 100;
end;
if and eq shield_skipper 6 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 7 shieldType 3;
set shieldResistCoeff 175;
end;
if and eq shield_skipper 8 shieldType 3;
set shieldResistCoeff 160;
end;
if and eq shield_skipper 9 shieldType 3;
set shieldResistCoeff 130;
end;
end;
return;
- new: Stealth_remover
offset: 11
code: | # ptre BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int weapon_is_quiet;
itemRuleset.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;
if eq weapon_is_quiet 1;
debug_log "Weapon_is_quiet";
return;
end;
else set attacker is_concealed 0;
end;
return;
- new: Stealth_SETTER
offset: 12
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int sets_concealed;
var ptr RuleArmor
var int armor_is_stealthy;
itemRuleset.getTag sets_concealed Tag.SETS_CONCEALED;
RuleArmor.getTag armor_is_stealthy Tag.ARMOR_IS_STEALTHY;
if and eq sets_concealed 1 eq armor_is_stealthy 1;
BattleUnit.setTag is_concealed 1;
debug_log "ARMOR IS CONCEALED";
return;
end;
return;
returnFromMissionUnit:
- new: normalizer_laser
offset: 99.99
code: | # var ptre soldier_rule RuleSoldier; # var int inital_acc; var int inital_rea; var int inital_thw;
ptr GeoscapeSoldier inital_acc;
ptr GeoscapeSoldier inital_rea;
ptr GeoscapeSoldier inital_thw;
var int is_blinded;
if eq is_blinded 1;
GeoscapeSoldier.Stats.setReactions inital_rea;
GeoscapeSoldier.Stats.setThrowing inital_thw;
GeoscapeSoldier.Stats.setFiring inital_acc;
end;
return;
createUnit:
- new: INITAL_STATS
offset: 99.99
code: | # var ptre soldier_rule RuleSoldier;
ptr GeoscapeSoldier
var int inital_acc;
var int inital_rea;
var int inital_thw;
GeoscapeSoldier.Stats.getFiring inital_acc;
GeoscapeSoldier.Stats.getThrowing inital_thw;
GeoscapeSoldier.Stats.getReactions inital_rea;
end;
return;
createItem:
- new: Chemlaser_plus;
offset: 79
code: |
var ptr RuleItem weaponRuleset;
var ptr GeoscapeGame geoScape;
var ptr RuleResearch researchTopic;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int temp;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_1";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_2";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_3";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_4";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_5";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_6";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser 1;
return;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MAJOR_UPGRADE";
geoScape.isResearched temp researchTopic;
if neq temp 0;
set chemlaser_is_based 1;
return;
end;
return;
- new: goggles_inital_strength;
offset: 80
code: |
ptr RuleItem;
var int goggles_strength;
var int goggles_curr_strength;
itemRuleset.getTag goggles_strength Tag.GOGGLES_STRENGTH;
set goggles_curr_strength goggles_strength;
return;
damageUnit:
- offset: 99.99
code: | #var ptr RuleItem weaponRuleset;
ptr RuleItem;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int weapon_is_chemlaser;
itemRuleset.getTag weapon_is_chemlaser Tag.WEAPON_IS_CHEMLASER;
if eq weapon_is_chemlaser 1;
add power researchLevel_chemlaser;
if eq chemlaser_is_based 1;
add power 10;
return;
end;
end;
end;
return;
- offset: 99.98
code: |
var ptr RuleItem weaponRuleset;
var int weapon_power_downgrade_level;
var int can_weapon_power_downgrade;
var int temp;
RuleItem.getTag can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;
RuleItem.getTag weapon_power_downgrade_level Tag.WEAPON_POWER_DOWNGRADE_LEVEL;
RuleItem.getPower temp;
if le 5 temp;
return;
end;
if eq can_weapon_power_downgrade 1;
add toHealth weapon_power_downgrade_level;
end;
end;
return;
- offset: 80
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int laser_blind_power;
var int anti_laser_goggles;
var int is_blinded;
var int blindness_level;
var int curr_acc;
var int curr_rea;
var int curr_thw;
var int curr_acc_minus;
var int curr_rea_minus;
var int curr_thw_minus;
RuleItem.getTag laser_blind_power Tag.LASER_BLIND_POWER;
RuleItem.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
GeoscapeSoldier.Stats.getFiring curr_acc;
GeoscapeSoldier.Stats.getReactions curr_rea;
GeoscapeSoldier.Stats.getThrowing curr_thw;
set curr_acc_minus curr_acc;
sub curr_acc_minus laser_blind_power;
set curr_rea_minus curr_rea;
sub curr_rea_minus laser_blind_power;
set curr_thw_minus curr_thw;
sub curr_thw_minus laser_blind_power;
if and ge laser_blind_power 1 eq anti_laser_goggles 0;
if eq goggles_are_broken 0;
BattleUnit.Stats.setFiring curr_acc_minus;
BattleUnit.Stats.setThrowing curr_thw_minus;
BattleUnit.Stats.setReactions curr_rea_minus;
battle_game.flashMessage "STR_LASER_BLINDED_DMG" laser_blind_power to_health to_armor;
return;
end;
return;
end;
end;
return;
new error log
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'createItem' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'createItem' for 'Global Event Script': invalid operation in line: 'ptr RuleItem;'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation in line: 'ptr GeoscapeSoldier
var int inital_acc;'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'ptr RuleItem;'
[2024-02-28_10-02-44] [ERROR] Can't match overload for operator 'RuleItem.getTag' for:
[2024-02-28_10-02-44] [ERROR] [var int] [RuleItem.Tag]
[2024-02-28_10-02-44] [ERROR] Expected:
[2024-02-28_10-02-44] [ERROR] [ptr RuleItem] [var int] [RuleItem.Tag]
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'RuleItem.getTag can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
[2024-02-28_10-02-44] [ERROR] Invalid length of 'var' definition
[2024-02-28_10-02-44] [ERROR] Error in matching arguments for operator 'var'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'var ptr RuleArmor;'
[2024-02-28_10-02-44] [ERROR] Unexpected 'end'
[2024-02-28_10-02-44] [ERROR] Error in matching arguments for operator 'end'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'end;'
[2024-02-28_10-02-44] [ERROR] Unknown variable name 'item_rule'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'item_rule.getTag'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'item_rule.getTag shield_skipper Tag.SHIELD_SKIPPER;'
[2024-02-28_10-02-44] [ERROR] Unknown variable name 'itemRuleset'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'itemRuleset.getTag'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'itemRuleset.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;'
[2024-02-28_10-02-44] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-45] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
[2024-02-28_10-02-45] [ERROR] Unknown argument 'itemRuleset'
[2024-02-28_10-02-45] [ERROR] Error in matching arguments for operator 'BattleItem.getRuleItem'
[2024-02-28_10-02-45] [ERROR] Error in parsing script 'newTurnItem' for 'Global Event Script': invalid operation in line: 'item.getRuleItem itemRuleset;'
[2024-02-28_10-02-45] [ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-02-28_10-02-45] [ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation in line: 'ptr GeoscapeSoldier inital_acc;'
thanks for reading and helping.
-
Does this happen with other mods too or only with your sub-mod?
only mine all others work,
it has nothing to to with Brutal ai.
-
No line can start with `ptre` as this is part of type specifier. Variable need start from keyword `var` and after that you put type and finally variable name.
e.g.
instead of
ptr GeoscapeSoldier inital_acc;
you need use
var ptr GeoscapeSoldier inital_acc;
but looking on rest of your code it looks like you do not want "solder" here but accuracy stat value.
And most of this values are `int` not "soldiers", this mean
var int inital_acc;
should be correct definition of used variable.
Another problem I see is that you copy paste part of other scripts, and you cut it in that place you have more `end;` lines that should be there looking on number of `if`.
side note, I recall plugin for Visual Studio Code that have basic validation for my script syntax (and rest of rule files), probably this would be helpful for you as error messages would be more precise.
-
i fixed a few bugs, but am still having problems,
thanks for all the help.
code:
extended:
tags:
RuleItem:
IS_KEY: int
ITEM_HAS_BIPOD: int
ITEM_RECOIL: int
ANTI_LASER_GOGGLES: int
SETS_CONCEALED: int
SHIELD_SKIPPER: int
WEAPON_IS_CHEMLASER: int
GOGGLES_STRENGTH: int
LASER_BLIND_POWER: int
CAN_WEAPON_POWER_DOWNGRADE: int
WEAPON_POWER_DOWNGRADE_LEVEL: int
RuleArmor:
IS_LOCK: int
ARMOR_IS_STEALTHY: int
scripts:
visibilityUnit:
- new: STEALTH_EFFECT
offset: 2
code: |
var int is_concealed; # Initialize the variable
if eq is_concealed 1;
set current_visibility 5;
debug_log "CONCEALED";
else;
set current_visibility 100;
debug_log "DeCONCEALED";
end;
return current_visibility visibility_mode;
newTurnItem:
- new: GOGGLES_STRENGTH
offset: 9
code: |
var ptre BattleUnit itemOwner;
var ptr RuleItem itemRuleset;
var int anti_laser_goggles;
var int las_goggles_worn;
var int goggles_are_broken;
item.getOwner itemOwner;
# If no owner, skip script
if eq itemOwner null;
debug_log "ItemOwnerIsNullValue";
return;
end;
item.getRuleItem itemRuleset;
itemRuleset.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
if eq goggles_are_broken 1;
debug_log "Goggles_blown_to_heaven't";
return;
end;
if eq anti_laser_goggles 1;
set las_goggles_worn 1;
debug_log "Anti_laser_goggles_working";
end;
return;
hitUnit:
- offset: 20.06 # weapon_item.getRuleItem item_rule;
code: |
var ptr RuleItem item_rule;
var ptr BattleItem;
var ptr RuleArmor armor_rule;
var ptr BattleUnit;
var int is_lock;
var int is_key;
damaging_item.getRuleItem item_rule;
item_rule.getTag is_key Tag.IS_KEY;
unit.getRuleArmor armor_rule;
BattleUnit.getRuleArmor is_lock Tag.IS_LOCK;
if and eq is_lock 1 eq is_key 1;
unit.setHealth 0;
battle_game.flashMessage "STR_PADLOCK_UNLOCKED";
debug_log "Padlock_Unlocked";
BattleItem.setAmmoQuantity 0;
else;
if or neq is_lock 1 neq is_key 1;
debug_log "Failed";
end;
end;
return power part side;
- new: GOGGLES_STRENGTH_lowerer_and_breaker
offset: 9
code: |
var int goggles_curr_strength;
var int goggles_are_broken;
sub goggles_curr_strength 1;
if eq goggles_curr_strength 0;
set goggles_are_broken 1;
end;
return power part side;
- new: GOGGLES_STRENGTH_lowerer_and_breaker2
offset: 10
code: |
var ptr BattleItem attackingItem;
var ptr RuleItem weaponRuleset;
var int shield_skipper;
var int shieldResistCoeff;
var int shieldType;
damaging_item.getRuleItem itemRuleset;
itemRuleset.getTag shield_skipper Tag.SHIELD_SKIPPER;
if and eq shield_skipper 1 shieldType 0;
set shieldResistCoeff 150; #was 50
end;
if and eq shield_skipper 2 shieldType 0;
set shieldResistCoeff 135; #was 65
end;
if and eq shield_skipper 3 shieldType 0;
set shieldResistCoeff 140; #was 60
end;
if and eq shield_skipper 4 shieldType 0;
set shieldResistCoeff 125; #was 75
end;
if and eq shield_skipper 5 shieldType 0;
set shieldResistCoeff 150; #Was 50
end;
if and eq shield_skipper 6 shieldType 0;
set shieldResistCoeff 135; #WAS 65
end;
if and eq shield_skipper 7 shieldType 0;
set shieldResistCoeff 175; #was 25
end;
if and eq shield_skipper 8 shieldType 0;
set shieldResistCoeff 160; #Was 40
end;
if and eq shield_skipper 9 shieldType 0;
set shieldResistCoeff 130; #was 70
end;
if and eq shield_skipper 1 shieldType 1;
set shieldResistCoeff 83; #def 33
end;
if and eq shield_skipper 2 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 3 shieldType 1;
set shieldResistCoeff 73;
end;
if and eq shield_skipper 4 shieldType 1;
set shieldResistCoeff 58;
end;
if and eq shield_skipper 5 shieldType 1;
set shieldResistCoeff 83;
end;
if and eq shield_skipper 6 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 7 shieldType 1;
set shieldResistCoeff 108;
end;
if and eq shield_skipper 8 shieldType 1;
set shieldResistCoeff 93;
end;
if and eq shield_skipper 9 shieldType 1;
set shieldResistCoeff 63;
end;
if and eq shield_skipper 1 shieldType 2;
set shieldResistCoeff 225; #def 175
end;
if and eq shield_skipper 2 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 3 shieldType 2;
set shieldResistCoeff 215;
end;
if and eq shield_skipper 4 shieldType 2;
set shieldResistCoeff 200;
end;
if and eq shield_skipper 5 shieldType 2;
set shieldResistCoeff 225;
end;
if and eq shield_skipper 6 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 7 shieldType 2;
set shieldResistCoeff 250;
end;
if and eq shield_skipper 8 shieldType 2;
set shieldResistCoeff 235;
end;
if and eq shield_skipper 9 shieldType 2;
set shieldResistCoeff 205;
end;
if and eq shield_skipper 1 shieldType 3;
set shieldResistCoeff 100; #def 50
end;
if and eq shield_skipper 2 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 3 shieldType 3;
set shieldResistCoeff 90;
end;
if and eq shield_skipper 4 shieldType 3;
set shieldResistCoeff 75;
end;
if and eq shield_skipper 5 shieldType 3;
set shieldResistCoeff 100;
end;
if and eq shield_skipper 6 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 7 shieldType 3;
set shieldResistCoeff 175;
end;
if and eq shield_skipper 8 shieldType 3;
set shieldResistCoeff 160;
end;
if and eq shield_skipper 9 shieldType 3;
set shieldResistCoeff 130;
end;
return power part side;
- new: Stealth_remover
offset: 11
code: | # ptre BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int weapon_is_quiet;
itemRuleset.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;
if eq weapon_is_quiet 1;
debug_log "Weapon_is_quiet";
return;
else;
if eq weapon_is_quiet 0;
set attacker is_concealed 0;
debug_log "Weapon_is_not_quiet";
end;
end;
return power part side;
- new: Stealth_SETTER
offset: 12
code: |
ptr BattleUnit;
var ptr RuleItem weaponRuleset;
var int is_concealed;
var int sets_concealed;
var ptr RuleArmor
var int armor_is_stealthy;
itemRuleset.getTag sets_concealed Tag.SETS_CONCEALED;
RuleArmor.getTag armor_is_stealthy Tag.ARMOR_IS_STEALTHY;
if and eq sets_concealed 1 eq armor_is_stealthy 1;
BattleUnit.setTag is_concealed 1;
debug_log "ARMOR IS CONCEALED";
return;
end;
return power part side;
- offset: 99.99
code: |
var ptr RuleItem rule;
var ptr BattleItem otherWeapon;
var ptr RuleItem item_rule;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int weapon_is_chemlaser;
item_rule.getTag weapon_is_chemlaser Tag.WEAPON_IS_CHEMLASER;
if eq weapon_is_chemlaser 1;
add power researchLevel_chemlaser;
if eq chemlaser_is_based 1;
add power 10;
end;
end;
return power part side;
createUnit:
- new: INITAL_STATS # var ptr GeoscapeSoldier soldier;
offset: 99.99
code: |
var int inital_acc;
var int inital_rea;
var int inital_thw;
var ptr BattleUnit stats; #wip unit
Unit.Stats.getFiring inital_acc;
Unit.Stats.getThrowing inital_thw;
Unit.Stats.getReactions inital_rea;
return;
createItem:
- new: Chemlaser_plus;
offset: 79
code: |
var ptr RuleItem weaponRuleset;
var ptr GeoscapeGame geoScape;
var ptr RuleResearch researchTopic;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int add_one 1;
var int temp;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_1";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_2";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_3";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_4";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_5";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_6";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MAJOR_UPGRADE";
geoScape.isResearched temp researchTopic;
if neq temp 0;
set chemlaser_is_based 1;
set temp 0;
end;
return;
- new: goggles_inital_strength;
offset: 80
code: |
var ptr RuleItem item_rule;
var int goggles_strength;
var int goggles_curr_strength;
item_rule.getTag goggles_strength Tag.GOGGLES_STRENGTH;
set goggles_curr_strength goggles_strength;
return;
damageUnit:
- offset: 99.98
code: |
var ptr RuleItem item_rule;
var ptr RuleItem rule;
var int weapon_power_downgrade_level;
var int can_weapon_power_downgrade;
var int temp;
damaging_item.getRuleItem can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;
damaging_item.getRuleItem weapon_power_downgrade_level Tag.WEAPON_POWER_DOWNGRADE_LEVEL;
RuleItem.getPower temp;
if le 5 temp;
return;
end;
if eq can_weapon_power_downgrade 1;
add toHealth weapon_power_downgrade_level;
end;
return;
- offset: 80
code: |
var ptr BattleUnit;
var ptr RuleItem itemRuleset;
var int laser_blind_power;
var int anti_laser_goggles;
var int is_blinded;
var int blindness_level;
var int curr_acc;
var int curr_rea;
var int curr_thw;
var int curr_acc_minus;
var int curr_rea_minus;
var int curr_thw_minus;
RuleItem.getTag laser_blind_power Tag.LASER_BLIND_POWER;
RuleItem.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
GeoscapeSoldier.Stats.getFiring curr_acc;
GeoscapeSoldier.Stats.getReactions curr_rea;
GeoscapeSoldier.Stats.getThrowing curr_thw;
set curr_acc_minus curr_acc;
sub curr_acc_minus laser_blind_power;
set curr_rea_minus curr_rea;
sub curr_rea_minus laser_blind_power;
set curr_thw_minus curr_thw;
sub curr_thw_minus laser_blind_power;
if and ge laser_blind_power 1 eq anti_laser_goggles 0;
if eq goggles_are_broken 0;
BattleUnit.Stats.setFiring curr_acc_minus;
BattleUnit.Stats.setThrowing curr_thw_minus;
BattleUnit.Stats.setReactions curr_rea_minus;
battle_game.flashMessage "STR_LASER_BLINDED_DMG" laser_blind_power to_health to_armor;
end;
end;
return;
error log:
[2024-03-04_16-44-02] [ERROR] Unknown variable name 'Unit'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation 'Unit.Stats.getFiring'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation in line: 'Unit.Stats.getFiring inital_acc;'
[2024-03-04_16-44-02] [ERROR] Can't match overload for operator 'BattleItem.getRuleItem' for:
[2024-03-04_16-44-02] [ERROR] [ptre BattleItem] [var int] [RuleItem.Tag]
[2024-03-04_16-44-02] [ERROR] Expected:
[2024-03-04_16-44-02] [ERROR] [ptr BattleItem] [var ptr RuleItem]
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'damaging_item.getRuleItem can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;'
[2024-03-04_16-44-02] [ERROR] Invalid length of 'var' definition
[2024-03-04_16-44-02] [ERROR] Error in matching arguments for operator 'var'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'var ptr BattleUnit;'
[2024-03-04_16-44-02] [ERROR] Invalid length of 'var' definition
[2024-03-04_16-44-02] [ERROR] Error in matching arguments for operator 'var'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'var ptr BattleItem;'
[2024-03-04_16-44-02] [ERROR] Unknown argument 'itemRuleset'
[2024-03-04_16-44-02] [ERROR] Error in matching arguments for operator 'BattleItem.getRuleItem'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'damaging_item.getRuleItem itemRuleset;'
[2024-03-04_16-44-02] [ERROR] Unknown variable name 'itemRuleset'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'itemRuleset.getTag'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'itemRuleset.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'ptr'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'ptr BattleUnit;'
have a nice day :)
-
I was hoping that my error messages are precise enough that every one can fix bug himself.
Like
[2024-03-04_16-44-02] [ERROR] Unknown variable name 'Unit'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation 'Unit.Stats.getFiring'
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'createUnit' for 'Global Event Script': invalid operation in line: 'Unit.Stats.getFiring inital_acc;'
You read this from bottom. some thing in line `Unit.Stats.getFiring inital_acc;` is wrong. Then engine explain that it do not understand "operation", `Unit.Stats.getFiring` and because text `Unit` is not variable. Did you mean `unit` or some thing else here?
Same with:
[2024-03-04_16-44-02] [ERROR] Can't match overload for operator 'BattleItem.getRuleItem' for:
[2024-03-04_16-44-02] [ERROR] [ptre BattleItem] [var int] [RuleItem.Tag]
[2024-03-04_16-44-02] [ERROR] Expected:
[2024-03-04_16-44-02] [ERROR] [ptr BattleItem] [var ptr RuleItem]
[2024-03-04_16-44-02] [ERROR] Error in parsing script 'damageUnit' for 'Global Event Script': invalid operation in line: 'damaging_item.getRuleItem can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;'
operation `damaging_item.getRuleItem` expect variable defined like `var ptr RuleItem rule;` but you give it two `can_weapon_power_downgrade` and tag.
Did you want operation that get tags from weapon?
-
I did some work and also learned a bit about PTR but... I may have hit the single most asinine error ever.
(the size is so long that i have to split this in two.)
code:
scripts:
visibilityUnit:
- new: STEALTH_EFFECT
offset: 2
code: |
var int is_concealed; # Initialize the variable
if eq is_concealed 1;
set current_visibility 5;
debug_log "CONCEALED";
else;
set current_visibility 100;
debug_log "DeCONCEALED";
end;
return current_visibility visibility_mode;
newTurnItem:
- new: GOGGLES_STRENGTH
offset: 9
code: |
var ptre BattleUnit itemOwner;
var ptr RuleItem itemRuleset;
var int anti_laser_goggles;
var int las_goggles_worn;
var int goggles_are_broken;
item.getOwner itemOwner;
# If no owner, skip script
if eq itemOwner null;
debug_log "ItemOwnerIsNullValue";
return;
end;
item.getRuleItem item_rule;
item_rule.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
if eq goggles_are_broken 1;
debug_log "Goggles_blown_to_heaven't";
return;
end;
if eq anti_laser_goggles 1;
set las_goggles_worn 1;
debug_log "Anti_laser_goggles_working";
end;
return;
hitUnit:
- offset: 97.38
code: |
var ptr RuleItem itemRuleset;
var ptr RuleItem item_rule;
var ptr RuleItem rule;
var int weapon_power_downgrade_level;
var int can_weapon_power_downgrade;
var int temp;
damaging_item.getRuleItem item_rule; #itemRuleset; #can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE;
item_rule.getTag can_weapon_power_downgrade Tag.CAN_WEAPON_POWER_DOWNGRADE; #itemRuleset
item_rule.getTag weapon_power_downgrade_level Tag.WEAPON_POWER_DOWNGRADE_LEVEL;
#RuleItem.getPower temp;
#if le 5 temp;
# return;
#end;
if eq can_weapon_power_downgrade 1;
mul weapon_power_downgrade_level 1;
add power weapon_power_downgrade_level;
end;
return power part side;
- offset: 20.06 # weapon_item.getRuleItem item_rule;
code: |
var ptr RuleItem itemRuleset;
#var ptr BattleItem weapon_item;
var ptr RuleItem item_rule;
var ptr RuleArmor armor_rule;
#var ptre BattleUnit unit;
var int is_lock;
var int is_key;
damaging_item.getRuleItem item_rule; #itemRuleset; #itemRuleset
item_rule.getTag is_key Tag.IS_KEY; #item_rule itemRuleset
unit.getRuleArmor armor_rule;
armor_rule.getTag is_lock Tag.IS_LOCK; #BattleUnit.getRuleArmor
if and eq is_lock 1 eq is_key 1;
unit.setHealth 0;
battle_game.flashMessage "STR_PADLOCK_UNLOCKED";
debug_log "Padlock_Unlocked";
#item.setAmmoQuantity 0; #THIS LINE IS SCREWED
else;
if or neq is_lock 1 neq is_key 1;
debug_log "Failed";
end;
end;
return power part side;
- new: GOGGLES_STRENGTH_lowerer_and_breaker
offset: 9
code: |
var int goggles_curr_strength;
var int goggles_are_broken;
sub goggles_curr_strength 1;
if eq goggles_curr_strength 0;
set goggles_are_broken 1;
end;
return power part side;
- new: GOGGLES_STRENGTH_lowerer_and_breaker2
offset: 10
code: |
#var ptre BattleItem shieldItem;
#var ptr BattleItem attackingItem;
var ptr RuleArmor armorRuleset;
var ptr RuleItem weaponRuleset;
var ptr RuleItem item_rule;
var int shield_skipper;
var int shieldResistCoeff;
var int shieldType;
damaging_item.getRuleItem item_rule; #itemRuleset;
item_rule.getTag shield_skipper Tag.SHIELD_SKIPPER; #itemRuleset
if and eq shield_skipper 1 shieldType 0;
set shieldResistCoeff 150; #was 50
end;
if and eq shield_skipper 2 shieldType 0;
set shieldResistCoeff 135; #was 65
end;
if and eq shield_skipper 3 shieldType 0;
set shieldResistCoeff 140; #was 60
end;
if and eq shield_skipper 4 shieldType 0;
set shieldResistCoeff 125; #was 75
end;
if and eq shield_skipper 5 shieldType 0;
set shieldResistCoeff 150; #Was 50
end;
if and eq shield_skipper 6 shieldType 0;
set shieldResistCoeff 135; #WAS 65
end;
if and eq shield_skipper 7 shieldType 0;
set shieldResistCoeff 175; #was 25
end;
if and eq shield_skipper 8 shieldType 0;
set shieldResistCoeff 160; #Was 40
end;
if and eq shield_skipper 9 shieldType 0;
set shieldResistCoeff 130; #was 70
end;
if and eq shield_skipper 1 shieldType 1;
set shieldResistCoeff 83; #def 33
end;
if and eq shield_skipper 2 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 3 shieldType 1;
set shieldResistCoeff 73;
end;
if and eq shield_skipper 4 shieldType 1;
set shieldResistCoeff 58;
end;
if and eq shield_skipper 5 shieldType 1;
set shieldResistCoeff 83;
end;
if and eq shield_skipper 6 shieldType 1;
set shieldResistCoeff 68;
end;
if and eq shield_skipper 7 shieldType 1;
set shieldResistCoeff 108;
end;
if and eq shield_skipper 8 shieldType 1;
set shieldResistCoeff 93;
end;
if and eq shield_skipper 9 shieldType 1;
set shieldResistCoeff 63;
end;
if and eq shield_skipper 1 shieldType 2;
set shieldResistCoeff 225; #def 175
end;
if and eq shield_skipper 2 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 3 shieldType 2;
set shieldResistCoeff 215;
end;
if and eq shield_skipper 4 shieldType 2;
set shieldResistCoeff 200;
end;
if and eq shield_skipper 5 shieldType 2;
set shieldResistCoeff 225;
end;
if and eq shield_skipper 6 shieldType 2;
set shieldResistCoeff 210;
end;
if and eq shield_skipper 7 shieldType 2;
set shieldResistCoeff 250;
end;
if and eq shield_skipper 8 shieldType 2;
set shieldResistCoeff 235;
end;
if and eq shield_skipper 9 shieldType 2;
set shieldResistCoeff 205;
end;
if and eq shield_skipper 1 shieldType 3;
set shieldResistCoeff 100; #def 50
end;
if and eq shield_skipper 2 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 3 shieldType 3;
set shieldResistCoeff 90;
end;
if and eq shield_skipper 4 shieldType 3;
set shieldResistCoeff 75;
end;
if and eq shield_skipper 5 shieldType 3;
set shieldResistCoeff 100;
end;
if and eq shield_skipper 6 shieldType 3;
set shieldResistCoeff 85;
end;
if and eq shield_skipper 7 shieldType 3;
set shieldResistCoeff 175;
end;
if and eq shield_skipper 8 shieldType 3;
set shieldResistCoeff 160;
end;
if and eq shield_skipper 9 shieldType 3;
set shieldResistCoeff 130;
end;
return power part side;
- new: Stealth_remover
offset: 11
code: | # ptre BattleUnit;
var ptr RuleItem item_rule;
var int is_concealed;
var int weapon_is_quiet;
damaging_item.getRuleItem item_rule;
item_rule.getTag weapon_is_quiet Tag.WEAPON_IS_QUIET;
if eq weapon_is_quiet 1;
debug_log "Weapon_is_quiet";
return power part side;
else;
if eq weapon_is_quiet 0;
set attacker is_concealed 0;
debug_log "Weapon_is_not_quiet";
end;
end;
return power part side;
- new: Stealth_SETTER
offset: 12
code: |
#ptr BattleUnit;
var ptr RuleItem item_rule;
var int is_concealed;
var int sets_concealed;
var ptr RuleArmor armor_rule;
var int armor_is_stealthy;
damaging_item.getRuleItem item_rule;
unit.getRuleArmor armor_rule;
item_rule.getTag sets_concealed Tag.SETS_CONCEALED;
armor_rule.getTag armor_is_stealthy Tag.ARMOR_IS_STEALTHY;
if and eq sets_concealed 1 eq armor_is_stealthy 1;
BattleUnit.setTag is_concealed 1;
debug_log "ARMOR IS CONCEALED";
return;
end;
return power part side;
- offset: 99.99
code: |
var ptr RuleItem rule;
var ptr BattleItem otherWeapon;
var ptr RuleItem item_rule;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int weapon_is_chemlaser;
item_rule.getTag weapon_is_chemlaser Tag.WEAPON_IS_CHEMLASER;
if eq weapon_is_chemlaser 1;
add power researchLevel_chemlaser;
if eq chemlaser_is_based 1;
add power 10;
end;
end;
return power part side;
createItem:
- new: Chemlaser_plus;
offset: 79
code: |
var ptr RuleItem weaponRuleset;
var ptr GeoscapeGame geoScape;
var ptr RuleResearch researchTopic;
var int researchLevel_chemlaser;
var int chemlaser_is_based;
var int add_one 1;
var int temp;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_1";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_2";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_3";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_4";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_5";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MINOR_UPGRADE_6";
geoScape.isResearched temp researchTopic;
if neq temp 0;
add researchLevel_chemlaser add_one;
set temp 0;
end;
rules.getRuleResearch researchTopic "STR_CHEMLASER_MAJOR_UPGRADE";
geoScape.isResearched temp researchTopic;
if neq temp 0;
set chemlaser_is_based 1;
set temp 0;
end;
return;
- new: goggles_inital_strength;
offset: 80
code: |
var ptr RuleItem item_rule;
var int goggles_strength;
var int goggles_curr_strength;
item_rule.getTag goggles_strength Tag.GOGGLES_STRENGTH;
set goggles_curr_strength goggles_strength;
return;
damageUnit:
- offset: 99.2
code: |
#var ptre BattleUnit unit;
var ptr RuleItem itemRuleset;
var ptr RuleItem item_rule;
var ptr RuleItem RuleItem; #item_rule;
var ptr BattleUnit unit_battle;
var int laser_blind_power;
var int anti_laser_goggles;
var int goggles_are_broken;
var int is_blinded;
var int blindness_level;
var int curr_acc;
var int curr_rea;
var int curr_thw;
var int curr_acc_minus;
var int curr_rea_minus;
var int curr_thw_minus;
damaging_item.getRuleItem item_rule; #item_rule; damaging_item.getRuleItem RuleItem;
item_rule.getTag laser_blind_power Tag.LASER_BLIND_POWER;
item_rule.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
unit.Stats.getFiring curr_acc; #GeoscapeSoldier
unit.Stats.getReactions curr_rea; #GeoscapeSoldier
unit.Stats.getThrowing curr_thw; #GeoscapeSoldier
set curr_acc_minus curr_acc;
sub curr_acc_minus laser_blind_power;
set curr_rea_minus curr_rea;
sub curr_rea_minus laser_blind_power;
set curr_thw_minus curr_thw;
sub curr_thw_minus laser_blind_power;
if and ge laser_blind_power 1 eq anti_laser_goggles 0;
if eq goggles_are_broken 0;
unit.Stats.addFiring curr_acc_minus;
unit.Stats.addThrowing curr_thw_minus;
unit.Stats.addReactions curr_rea_minus;
battle_game.flashMessage "STR_LASER_BLINDED_DMG" laser_blind_power to_health to_armor;
end;
end;
return;
-
error log:
[2024-03-07_15-12-15] [ERROR] Invalid length of condition arguments
[2024-03-07_15-12-15] [ERROR] Error in matching arguments for operator 'if'
[2024-03-07_15-12-15] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'if and eq shield_skipper 1 shieldType 0;'
[2024-03-07_15-12-15] [ERROR] Can't match overload for operator 'set' for:
[2024-03-07_15-12-15] [ERROR] [ptre BattleUnit] [var int] [int]
[2024-03-07_15-12-15] [ERROR] Expected:
[2024-03-07_15-12-15] [ERROR] [var ptr RuleUnit] [ptr RuleUnit]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleDamageType] [ptre RuleDamageType]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleDamageType] [ptr RuleDamageType]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleItem] [ptre RuleItem]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleItem] [ptr RuleItem]
[2024-03-07_15-12-15] [ERROR] [var RuleItem.Tag] [RuleItem.Tag]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleArmor] [ptre RuleArmor]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleArmor] [ptr RuleArmor]
[2024-03-07_15-12-15] [ERROR] [var RuleArmor.Tag] [RuleArmor.Tag]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleSkill] [ptre RuleSkill]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleSkill] [ptr RuleSkill]
[2024-03-07_15-12-15] [ERROR] [var RuleSkill.Tag] [RuleSkill.Tag]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleResearch] [ptre RuleResearch]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleResearch] [ptr RuleResearch]
[2024-03-07_15-12-15] [ERROR] [var RuleResearch.Tag] [RuleResearch.Tag]
[2024-03-07_15-12-15] [ERROR] [var ptre RuleSoldier] [ptre RuleSoldier]
[2024-03-07_15-12-15] [ERROR] [var ptr RuleSoldier] [ptr RuleSoldier]
[2024-03-07_15-12-15] [ERROR] [var RuleSoldier.Tag] [RuleSoldier.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptre RuleInventory] [ptre RuleInventory]
[2024-03-07_15-12-16] [ERROR] [var ptr RuleInventory] [ptr RuleInventory]
[2024-03-07_15-12-16] [ERROR] [var ptre RuleMod] [ptre RuleMod]
[2024-03-07_15-12-16] [ERROR] [var ptr RuleMod] [ptr RuleMod]
[2024-03-07_15-12-16] [ERROR] [var RuleMod.Tag] [RuleMod.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptre RuleUnit] [ptre RuleUnit]
[2024-03-07_15-12-16] [ERROR] [var ptre Time] [ptre Time]
[2024-03-07_15-12-16] [ERROR] [var ptr Time] [ptr Time]
[2024-03-07_15-12-16] [ERROR] [var ptre GeoscapeGame] [ptre GeoscapeGame]
[2024-03-07_15-12-16] [ERROR] [var ptre RandomState] [ptre RandomState]
[2024-03-07_15-12-16] [ERROR] [var text] [text]
[2024-03-07_15-12-16] [ERROR] [var Position] [Position]
[2024-03-07_15-12-16] [ERROR] [var Position] [int] [int] [int]
[2024-03-07_15-12-16] [ERROR] [var ptr GeoscapeGame] [ptr GeoscapeGame]
[2024-03-07_15-12-16] [ERROR] [var GeoscapeGame.Tag] [GeoscapeGame.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptr RandomState] [ptr RandomState]
[2024-03-07_15-12-16] [ERROR] [var ptre Tile] [ptre Tile]
[2024-03-07_15-12-16] [ERROR] [var ptr Tile] [ptr Tile]
[2024-03-07_15-12-16] [ERROR] [var ptre BattleGame] [ptre BattleGame]
[2024-03-07_15-12-16] [ERROR] [var ptr BattleGame] [ptr BattleGame]
[2024-03-07_15-12-16] [ERROR] [var BattleGame.Tag] [BattleGame.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptre BattleItem] [ptre BattleItem]
[2024-03-07_15-12-16] [ERROR] [var ptr BattleItem] [ptr BattleItem]
[2024-03-07_15-12-16] [ERROR] [var BattleItem.Tag] [BattleItem.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptre GeoscapeSoldier] [ptre GeoscapeSoldier]
[2024-03-07_15-12-16] [ERROR] [var ptr GeoscapeSoldier] [ptr GeoscapeSoldier]
[2024-03-07_15-12-16] [ERROR] [var GeoscapeSoldier.Tag] [GeoscapeSoldier.Tag]
[2024-03-07_15-12-16] [ERROR] [var ptre BattleUnit] [ptre BattleUnit]
[2024-03-07_15-12-16] [ERROR] [var ptr BattleUnit] [ptr BattleUnit]
[2024-03-07_15-12-16] [ERROR] [var BattleUnit.Tag] [BattleUnit.Tag]
[2024-03-07_15-12-16] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'set attacker is_concealed 0;'
[2024-03-07_15-12-16] [ERROR] Can't match overload for operator 'BattleUnit.setTag' for:
[2024-03-07_15-12-16] [ERROR] [var int] [int]
[2024-03-07_15-12-16] [ERROR] Expected:
[2024-03-07_15-12-16] [ERROR] [ptre BattleUnit] [BattleUnit.Tag] [int]
[2024-03-07_15-12-16] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'BattleUnit.setTag is_concealed 1;'
[2024-03-07_15-12-16] [ERROR] Unknown argument 'item_rule'
[2024-03-07_15-12-16] [ERROR] Error in matching arguments for operator 'BattleItem.getRuleItem'
[2024-03-07_15-12-16] [ERROR] Error in parsing script 'newTurnItem' for 'Global Event Script': invalid operation in line: 'item.getRuleItem item_rule;'
thanks for all the help. :)
-
Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'if and eq shield_skipper 1 shieldType 0;'
This error is because you have only one `eq`, basic `if` look like `if eq x y;` but you can have multiple conditions by appending `and`
like:
if and
eq x y #first `eq`
eq z w; #second `eq`
Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'set attacker is_concealed 0;'
set have only two arguments not three.
Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'BattleUnit.setTag is_concealed 1;'
I have no idea what your intention was with this code, what tag and what object you want update?
-
I want to make a script that on hit (from an enviroEffect) sets units wearing armor marked with "armor_is_stealthy 1" to "is_concealed 1"
until they attack with any weapon not marked with "weapon_is_quiet 1"
(the visibility script sets it so that concealed units are 95% harder to see)
i hope this helped.
also thank you for the help. :)
-
But there is nothing like `is_concealed` in unit, you have `Tag`-s that can you set specific values.
Like:
unit.setTag Tag.SOME_NAME value.
And it always start with `Tag.`, you need have define it some where otherwise game refules to use this tag if do not know it.
-
so i now have a problem with the game crashing due to laser goggles
here is the code:
newTurnUnit: #ALL GOGGLES
- offset: 1.6
code: |
var int las_goggles_worn;
#var ptre BattleUnit itemOwner;
#item.getOwner itemOwner;
# Clear all unit resist types and minimums so resistance items can set again
#itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_300 0; #unit
set las_goggles_worn 0;
return;
newTurnItem: #ITS GOGGLES THAT CRASH THE GAME!!!!!!!!!!!!!!
- new: GOGGLES_STRENGTH
offset: 9.1
code: |
var ptre BattleUnit itemOwner;
var ptr RuleItem itemRuleset;
var int anti_laser_goggles;
var int las_goggles_worn;
var int goggles_are_broken; #something is wrong
var int temp;
item.getOwner itemOwner;
# If no owner, skip script
if eq itemOwner null;
debug_log "ItemOwnerIsNullValue";
return;
end;
item.getRuleItem itemRuleset;
itemRuleset.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
if eq anti_laser_goggles 1;
set las_goggles_worn 1;
itemOwner.getTag temp Tag.UNIT_RESIST_ITEM_SLOT_300;
debug_log "Anti_laser_goggles_working";
else;
itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_1 1;
#if eq temp 1;
#debug_log "TEMP = 1";
#itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_300 1;
#end;
end;
debug_log "laser_goggles_var: " anti_laser_goggles;
debug_log "anti laser goggles worn: " las_goggles_worn;
if eq temp 1;
set las_goggles_worn 1;
end;
if eq goggles_are_broken 1;
debug_log "Goggles_blown_to_heaven't";
set las_goggles_worn 0;
end;
return;
game log:
[2024-03-09_15-52-32] [FATAL] A fatal error has occurred: code 0xc0000094
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] ??
[2024-03-09_15-52-32] [FATAL] 0x7ffd8a5b2560 BaseThreadInitThunk
[2024-03-09_15-52-32] [FATAL] 0x7ffd8c54aa30 RtlUserThreadStart
[2024-03-09_15-52-32] [FATAL] Crash dump generated at C:/Users/IDKin/OneDrive/Documents/OpenXcom/2024-03-09_15-52-32.dmp
[2024-03-09_15-52-54] [FATAL] OpenXcom has crashed: code 0xc0000094
Log file: C:/Users/IDKin/OneDrive/Documents/OpenXcom/openxcom.log
If this error was unexpected, please report it on the OpenXcom forum (OXCE board).
The following can help us solve the problem:
1. a saved game from just before the crash (helps 98%)
2. a detailed description how to reproduce the crash (helps 80%)
3. a log file (helps 10%)
4. a screenshot of this error message (helps 5%)
was listed in the crash log:
The thread tried to divide an integer value by an integer divisor of zero.
thank you for all the help.
dump included below :)
-
I do not see how script itself could cause this crash, you not even have `div` in it.
Remove this script completely and see if crash is still there.
-
I do not see how script itself could cause this crash, you not even have `div` in it.
you are right.
turns out it was the lock and generators lacking T.Us and energy.
-
Could you show exact thing that cause this error? Game should not crash and this need be fixed anyway.
-
"Could you show exact thing that cause this error? Game should not crash and this need be fixed anyway." ~ Yankes
here is the broken ruleset:
stats:
tu: 0
stamina: 0
and the nonbroken version:
stats:
tu: 4
stamina: 1
-
so i fixed most of the code but still i have a few errors.
mainly in the code here:
hitUnit:
- new: GOGGLES_STRENGTH_lowerer_and_breaker
offset: 9
code: |
var ptr RuleItem itemRuleset;
var ptr RuleArmor armor_rule;
#var ptr BattleItem ItemBattle;
var ptre BattleUnit itemOwner;
var ptre BattleUnit Unit;
var int goggles_curr_strength;
var int goggles_are_broken;
var int las_goggles_worn;
var int temp;
var int dumb;
item.getOwner itemOwner;
itemOwner.getTag temp Tag.UNIT_RESIST_ITEM_SLOT_300;
itemOwner.getTag dumb Tag.GOGGLES_BROKEN_FR;
if eq temp 1; #las_goggles_worn 1;
sub goggles_curr_strength 1;
debug_log "goggles current strength is: " goggles_curr_strength;
end;
if eq goggles_curr_strength 0;
set goggles_are_broken 1;
itemOwner.setTag Tag.GOGGLES_BROKEN_FR 1;
end;
return power part side;
newTurnItem: #ITS not GOGGLES THAT CRASH THE GAME!!!!!!!!!!!!!!
- new: GOGGLES_STRENGTH
offset: 9.1
code: |
var ptre BattleUnit itemOwner;
var ptr RuleItem itemRuleset;
var int anti_laser_goggles;
var int las_goggles_worn;
var int goggles_are_broken; #something is wrong
var int temp;
item.getOwner itemOwner;
# If no owner, skip script
if eq itemOwner null;
debug_log "ItemOwnerIsNullValue";
return;
end;
item.getRuleItem itemRuleset;
itemRuleset.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES;
unit.getTag goggles_are_broken Tag.GOGGLES_BROKEN_FR;
if eq anti_laser_goggles 1;
set las_goggles_worn 1;
itemOwner.getTag temp Tag.UNIT_RESIST_ITEM_SLOT_300;
debug_log "Anti_laser_goggles_working";
else;
itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_300 1;
#if eq temp 1;
#debug_log "TEMP = 1";
#itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_300 1;
#end;
end;
#debug_log "laser_goggles_var: " anti_laser_goggles;
#debug_log "anti laser goggles worn: " las_goggles_worn;
if eq temp 1;
set las_goggles_worn 1;
end;
if eq goggles_are_broken 1;
debug_log "Goggles_blown_to_heaven't";
set las_goggles_worn 0;
itemOwner.setTag Tag.UNIT_RESIST_ITEM_SLOT_300_BROKEN 1;
end;
return;
ERROR LOG:
[2024-03-12_15-25-06] [ERROR] Unknown variable name 'item'
[2024-03-12_15-25-06] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation 'item.getOwner'
[2024-03-12_15-25-06] [ERROR] Error in parsing script 'hitUnit' for 'Global Event Script': invalid operation in line: 'item.getOwner itemOwner;'
[2024-03-12_15-25-06] [ERROR] Unknown variable name 'unit'
[2024-03-12_15-25-06] [ERROR] Error in parsing script 'newTurnItem' for 'Global Event Script': invalid operation 'unit.getTag'
[2024-03-12_15-25-06] [ERROR] Error in parsing script 'newTurnItem' for 'Global Event Script': invalid operation in line: 'unit.getTag goggles_are_broken Tag.GOGGLES_BROKEN_FR;'
Thank you for all the help :)
-
You had already similar errors, `item` and `unit` do not exist in given script, if you do not know what is available in given script, you can set config `verboseLogging: true` and `debug: true` that make game dump all script meta data into logs.