1
OXCE Support Y-scripts / Reshading BattleUnits
« on: September 12, 2023, 07:24:45 pm »
So I am trying to write a script to adjust the shading of battleunits based on the background lighting, so as to highlight the difference between illuminated and not. However, using the Hit flash script and API
I have to say I am uncertain how to do it.
I can set color or set shade and white color, but I can't figure out what the original shade was, or what changing the shade does exactly. It also seems to strip the color (or set to white) when I set_shade but not set_color. Also, old_pixel doesn't appear to be the previous frame's "pixel" but rather full transparency status.
I probably have a significant misunderstanding of either how shades work, as well as what new_pixel does(I thought it was essentially a shift from the original sprite image moving right on a pallet for each pixel)
I've tried several different things, and this one works, but isn't ideal.
I have to say I am uncertain how to do it.
I can set color or set shade and white color, but I can't figure out what the original shade was, or what changing the shade does exactly. It also seems to strip the color (or set to white) when I set_shade but not set_color. Also, old_pixel doesn't appear to be the previous frame's "pixel" but rather full transparency status.
I probably have a significant misunderstanding of either how shades work, as well as what new_pixel does(I thought it was essentially a shift from the original sprite image moving right on a pallet for each pixel)
I've tried several different things, and this one works, but isn't ideal.
Code: [Select]
extended:
scripts:
recolorUnitSprite:
- offset: 2
code: |
var int tileShade;
var int newShade;
unit.getTileShade tileShade;
if gt tileShade 9;
set_color new_pixel 4;
set_shade new_pixel 12;
else;
end;
return new_pixel;