Changing Object Colours
by
Wayne Scales
Instead of using flipmaps to change the colour
of objects we now can change the colour by scripting a
Parameter= command
and using a flipeffect to activate it. We can also vary colours between
bright and dark, like a pulsing effect. In this tutorial we will see how
to do that. The ColorRGB=
command will be used to create your desired colour.
Here is the
syntax we'll use to edit the objects colour attributes.
Parameters=PARAM_COLOR_ITEM, IdParamList,
ColorType (COLTYPE_...), ItemIndex, Index1ColorRGB, Index2ColorRGB,
SpeedChange
Description of fields
IdParamList field=
This is the number we type to specify the "Parameters=PARAM_COLOR_ITEM"
in the trigger window of NGLE.
ColorType (COLTYPE_...) field= We have a
choice between flags here to specify what action you want the object to
take. Here are the possible flags:
COLTYPE_SET_COLOR= This is a command
simply to change the colour of the object.
COLTYPE_SET_PULSE=
This flag only can be used with the Index1ColorRGB field.
The engine will light the object up and down continuously. A lot of experimenting is required here. The max lighting the engine goes to is 255, 255, 255 so you would not have that value for the Index1ColorRGB field.
COLTYPE_SHADE_COLORS= This shades colours from first colour (Index1ColorRGB) to second colour (Index2ColorRGB) and vice versa.
You can set the speed of shading by typing a value in SpeedChange field.
ItemIndex field= The objects ID goes in this field, telling the engine which object you wish to edit. It can be found simply be clicking on the oject in NGLE in the yellow frame. Look here if you are unsure.
Index1ColorRGB field= Here you have to type the ID of the ColorRGB= command that you will use with this parameter. The ColorRGB= has to be in same [Level] section where you place the Parameters=PARAM_COLOR_ITEM command.
Index2ColorRGB field= If your COLTYPE_ requires two colors, you have to type the IdColor of the ColorRGB= command.
SpeedChange field= If you use a COLTYPE_ requiring some dynamic effect (like PULSE or SHADE) you can type this in the SpeedChange field the number of frame for each cycle.
Rememeber that 30 frame = 1 second. So if you want to pulse from dark colour to light colour every two seconds you could type 60.
Remark: the valid range for speed is min: 1 max=255 (about 8 seconds)
Now i will show you the ColorRGB=command used
with the Parameters=PARAM_COLOR_ITEM command.
It can
also be used for many other things too.
Here's the syntax:
ColorRGB=IdColor, Red, Green, Blue
Descriptions of
fields
IdColor field= This is the ID number to identify this command from another ColorRGB= command.
Red field
Intensity of Red. You can type value between 0 and 255
Green field
Intensity of green. You can type value between 0 and 255
Blue field
Intensity of blue. You can type value between 0 and 255
Now we
are ready to start scripting these commands.
We will create our colour first.
ColorRGB=1, 0,190,255. Here we have a nice
light blue affect. You can also have a look in paint to get a very
specific colour you wish to create.
That's it for the colour, just a lot of
experimenting to get a nice effect.
Now we will script the
Parameters=PARAM_COLOR_ITEM. Here is one i made which simply changes the
colour of the object to the ColorRGB= command above.
Parameters=PARAM_COLOR_ITEM,1,COLTYPE_SET_COLOR,24,1,IGNORE,IGNORE
Notice the ItemIndex field. It has 24, which is the ID of the object
I use in my case. You will change this to your desired one. The 1 next
to 24 corresponds to the ColorRGB= command that we scripted above.
Notice how there is also a 1 in the IDColor field of the ColorRGB=
command.
In the Index2ColorRGB field i typed IGNORE because you
cannot have two ColorRGB= commands for this field as it's just changing
the colour once! And we also don't need anything in the speed field.
That's the scripting done so now we will have to set a flipeffect triggering the Parameters=PARAM_COLOR_ITEM= command. Notice how that command has a 1 for its ID so we will trigger Parameters=PARAM_COLOR_ITEM,1
Now trigger this and test it out! Here is the result you will get on your specified object. Experiment with some of you own commands.
Pulse effect
Here is my own command
which you should study:
Parameters=PARAM_COLOR_ITEM,2,COLTYPE_SET_PULSE,24,1,IGNORE,60
This time we have a 2 in the IdParamList field and when triggering
this we will use Parameters=PARAM_COLOR_ITEM ,2. Getting the idea now?
I have set the last field to sixty so it will pulse up and down for 2 seconds. And the result:
This is a really cool effect as you could use this to simulate the shadow of a swinging object, like a large pendulum swinging by, or you could create a wacky colour for some fictional world. I will let your imagination take over from here.
Shading
I have added anothe ColorRGB command= to this as it will shade from one to the other and vice-versa. Here it is:
ColorRGB=2, 45,255,158
(again notice the 2 for the IDColor field)
Here is the
Parameters=Param_COLOR_ITEM= command.
Parameters=PARAM_COLOR_ITEM,3,COLTYPE_SHADE_COLORS,24,1,2,60
So you will
trigger this parameter by selecting a 3 in the
Parameters=PARAM_COLOR_ITEM window.
Also the 2 has been added to
this command to the Index2ColorRGB field to use with the IDColor field
in the ColorRGB=command. I can't emphasis this enough because if wrong
values have been entered here it will not work.
This is a really
cool effect also! For example you could make a pipe and once you press a
button steam is emitted because the pipe has become red hot.
Here
are the effects of this command.