Author Topic: I need help with a Chemlasers problem... [Solved]  (Read 369 times)

Offline Barghum

  • Sergeant
  • **
  • Posts: 48
  • Doing my best to help (:
    • View Profile
I need help with a Chemlasers problem... [Solved]
« on: August 19, 2024, 10:50:10 pm »
the script for blinding foes in my ChemLasers mod seems to be bugged even though I changed nothing

there are 2 bugs listed here:

1. the text does not appear on damage

2. no affect happens

I don't know what the cause is and even after checking everything i cant figure anything out... ???
as such i am once again asking for "you're supports"

here is the code

Code: [Select]
    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;
          var int temp;

          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.getTag anti_laser_goggles Tag.ANTI_LASER_GOGGLES; 
          unit.getTag anti_laser_goggles Tag.UNIT_RESIST_ITEM_SLOT_300;         
          debug_log "check 1 LASER_BLIND_POWER: " laser_blind_power;

          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;
          #debug_log "check 2 LASER_BLIND_POWER: " laser_blind_power;

          if and ge laser_blind_power 1 eq anti_laser_goggles 0;
            unit.Stats.setFiring curr_acc_minus;
            unit.Stats.setThrowing curr_thw_minus;
            unit.Stats.setReactions curr_rea_minus;
            battle_game.flashMessage "STR_LASER_BLINDED_DMG" laser_blind_power to_health to_armor;
            #debug_log "blind is working";
          else;
            debug_log "blind is NOT working";         
          end;
          return; 
  thank you for reading for reading this  :)
« Last Edit: August 26, 2024, 04:00:00 am by Barghum »

Offline Yankes

  • Commander
  • *****
  • Posts: 3289
    • View Profile
Re: I need help with a Chemlasers problem...
« Reply #1 on: August 19, 2024, 11:15:59 pm »
What logs say? if script fail to load it should explicitly say why its fails.

Offline Barghum

  • Sergeant
  • **
  • Posts: 48
  • Doing my best to help (:
    • View Profile
Re: I need help with a Chemlasers problem...
« Reply #2 on: August 20, 2024, 03:21:16 am »
turns out its the goggles script (my rage is infinite)