Page 1 of 1

[SOLVED] Change block and npc forecolor?

Posted: 2 Aug 2021, 21:15
by 1gnacio25
So i found that you can change the forecolor of NPCs and blokcs via scripts, and i typed this to make a red koopa have a shade of blue

Code: Select all

With npc(sysval(Param1))
.forecolor = rgba(53, 53, 126, 1)
end with

But anything in the rgba just seems to make the NPC invisible, same with blocks. I am doing something wrong?

Posted: 3 Aug 2021, 6:19
by NESTED ERNEST
The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.

Posted: 3 Aug 2021, 21:07
by 1gnacio25
NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color

Posted: 4 Aug 2021, 7:02
by coolXD
1gnacio25 wrote:
NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color

Here just all blocks to sysval(BCount) code, enjoy!

Code: Select all

Dim shader as integer
With block(sysval(Param1))
For shader = 1 To sysval(BCount)
block(shader).forecolor = rgba(53, 53, 126, 255)
Next
End with

Posted: 4 Aug 2021, 23:08
by 1gnacio25
coolXD wrote:
1gnacio25 wrote:
NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color

Here just all blocks to sysval(BCount) code, enjoy!

Code: Select all

Dim shader as integer
With block(sysval(Param1))
For shader = 1 To sysval(BCount)
block(shader).forecolor = rgba(53, 53, 126, 255)
Next
End with
Now it works, thanks :)