Author Topic: An alien unit that is always displayed at maximum light level?  (Read 1961 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
An alien unit that is always displayed at maximum light level?
« on: December 01, 2022, 01:59:57 pm »
I have an alien unit using "alwaysVisible: true" on its armor and it works, the alien unit can be seen by all friendly X-Com units and is displayed on the map.

However the alien unit's image is pitch black due to there being no light at its current location.

I'm hoping that it can be setup so that the unit renders as if it is in full daylight at all times.

For example Yankes's script to animate armor adjusted the colour on a darkened unit to make it glow briefly.
Code: [Select]
      recolorUnitSprite: |
        var int reg0;
        var int reg1;
        var int color;
       
        get_color color new_pixel;
        get_shade reg0 new_pixel;
       
        if or eq color COLOR_X1_PURPLE0 eq color COLOR_X1_PURPLE1;
          set reg1 anim_frame;
          wavegen_tri reg1 8 4 4;
          add reg0 reg1;
          limit_upper reg0 15;
          set_shade new_pixel reg0;
        end;
       
        add_shade new_pixel shade; #add environment shade
        return new_pixel;


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: An alien unit that is always displayed at maximum light level?
« Reply #1 on: December 01, 2022, 08:26:38 pm »
Code: [Select]
unit.getRecolor new_pixel;
add_burn_shade new_pixel burn shade;
return new_pixel;
This is default script lined to each unit, if you replace script in given unit by this, then on its own will not change behavior of shading at all.
But when you replace it, you can alter it any way you want and archive your desired result.
In this case if you replace parameter `shade` usage by `0` then game will display given unit as it was in bright light.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: An alien unit that is always displayed at maximum light level?
« Reply #2 on: December 02, 2022, 11:52:22 am »
Thank you that works great.

I attached your script to the armors: entry and now the alien visually appears even when on darkened or unexplored tiles.
Code: [Select]
    scripts:
      selectUnitSprite: |
      recolorUnitSprite: |
        unit.getRecolor new_pixel;
        add_burn_shade new_pixel burn 0;
        return new_pixel;

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: An alien unit that is always displayed at maximum light level?
« Reply #3 on: December 02, 2022, 09:26:42 pm »
Code: [Select]
selectUnitSprite: |
this line is bugged and should be removed. As you start new script but do not add any body for its body.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: An alien unit that is always displayed at maximum light level?
« Reply #4 on: December 05, 2022, 01:12:17 pm »
Thank you I've removed the unnecessary line of code.