Now I just thought of an interesting way to do what you want.
Like I said before, colormaps are created at compile time, and you can't create a new one at runtime. However, there is nothing to prevent you from defining it at compile time by creating your own class:
Code: Select all
class MyColormap : PowerupGiver
{
Default
{
Powerup.Colormap 0.0, 0.0, 0.0, 1.0, 1.0, 1.0;
}
}
We won't actually be using instances of this class in-game. What we need is the index into the colormap table, which was created during compilation. It is stored in our class as a specially masked value of the BlendColor field, the same one we've been using before. We don't need to know its exact value (it may also change with each run depending on the WAD files used and other things). What we need to do is to retrieve it from MyColormap and put it into the invulnerability powerup:
Code: Select all
class SomeEventHandler : EventHandler
{
override void WorldThingSpawned(WorldEvent e)
{
let a = e.Thing;
if (a is 'InvulnerabilitySphere')
{
InvulnerabilitySphere(a).BlendColor = GetDefaultByType('MyColormap').BlendColor;
}
}
}
I have just tested this myself, and it actually works! Don't know why I didn't think of it before. But now you know how to change both the blend color and the colormap. You are still limited to colormaps that you can create at compile time, however - you cannot dynamically alter it during gameplay.