Author Topic: Broken Y-scripts  (Read 2784 times)

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Broken Y-scripts
« 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.   

Code: [Select]
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  :)

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3345
    • View Profile
Re: Broken Y-scripts
« Reply #1 on: February 28, 2024, 12:33:44 am »
how exactly broken? what happens exactly? and what you expected to happens? do script compile at all?

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #2 on: February 28, 2024, 01:40:30 am »
Code: [Select]
[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. :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9075
    • View Profile
Re: Broken Y-scripts
« Reply #3 on: February 28, 2024, 09:32:46 am »
moved to BAI subforum

Offline Xilmi

  • Commander
  • *****
  • Posts: 642
    • View Profile
Re: Broken Y-scripts
« Reply #4 on: February 28, 2024, 10:35:29 am »
Does this happen with other mods too or only with your sub-mod?

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3345
    • View Profile
Re: Broken Y-scripts
« Reply #5 on: February 28, 2024, 11:06:48 am »
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.

Offline Xilmi

  • Commander
  • *****
  • Posts: 642
    • View Profile
Re: Broken Y-scripts
« Reply #6 on: February 28, 2024, 11:42:19 am »
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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9075
    • View Profile
Re: Broken Y-scripts
« Reply #7 on: February 28, 2024, 11:43:47 am »
moved to oxce support subforum

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #8 on: February 28, 2024, 06:18:36 pm »
reworked it slightly
Code: [Select]
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



Code: [Select]
[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.

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #9 on: February 28, 2024, 08:16:57 pm »
Quote
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.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3345
    • View Profile
Re: Broken Y-scripts
« Reply #10 on: February 28, 2024, 08:52:28 pm »
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
Code: [Select]
ptr GeoscapeSoldier inital_acc;you need use
Code: [Select]
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
Code: [Select]
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.

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #11 on: March 05, 2024, 01:08:24 am »
i fixed a few bugs, but am still having problems,
thanks for all the help.

code:
Code: [Select]
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:

Code: [Select]
[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  :)

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3345
    • View Profile
Re: Broken Y-scripts
« Reply #12 on: March 05, 2024, 11:08:59 am »
I was hoping that my error messages are precise enough that every one can fix bug himself.
Like
Code: [Select]
[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:
Code: [Select]

[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?

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #13 on: March 07, 2024, 11:23:00 pm »
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:
Code: [Select]
       
  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;

Offline Barghum

  • Captain
  • ***
  • Posts: 60
  • Doing my best to help (:
    • View Profile
Re: Broken Y-scripts
« Reply #14 on: March 07, 2024, 11:23:29 pm »
error log:
Code: [Select]
[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.  :)