OpenXcom Forum

Modding => Help => Topic started by: The Martian on December 01, 2022, 01:59:57 pm

Title: An alien unit that is always displayed at maximum light level?
Post by: The Martian 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 (https://openxcom.org/forum/index.php/topic,6303.msg98537.html#msg98537) 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;

Title: Re: An alien unit that is always displayed at maximum light level?
Post by: Yankes 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.
Title: Re: An alien unit that is always displayed at maximum light level?
Post by: The Martian on December 02, 2022, 11:52:22 am
Thank you that works great. (https://openxcom.org/forum/Themes/InsidiousV1-k/images/post/thumbup.gif)

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;
Title: Re: An alien unit that is always displayed at maximum light level?
Post by: Yankes 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.
Title: Re: An alien unit that is always displayed at maximum light level?
Post by: The Martian on December 05, 2022, 01:12:17 pm
Thank you I've removed the unnecessary line of code.