material question

Posted By: molotov

material question - 05/22/10 15:02

I have a code/material that I use to change a models material in any color possible. But this code changes the color for the entire model, is there a way to change it so that it only effects the models first skin(or second/third skin). And that you can change by button press which skin it's applyed on. This is the code I have so far:

define my_red, skill21;
define my_green, skill22;
define my_blue, skill23;

material mat_iets()
{
ambient_red = 0 ;
ambient_green = 0 ;
ambient_blue = 0 ;

diffuse_red = 0 ;
diffuse_green = 0 ;
diffuse_blue = 0 ;

specular_red = 0 ;
specular_green = 0 ;
specular_blue = 0 ;

emissive_red = 0 ;
emissive_green = 0 ;
emissive_blue = 0 ;

power = 50 ;

}

function skin_change()
{
my.light = on;
if ( key_x ) {my.my_red += 1; }
if ( key_c ) {my.my_red -= 1;}
if ( key_v ) {my.my_green += 1;}
if ( key_b ) {my.my_green -= 1;}
if ( key_n ) {my.my_blue += 1;}
if ( key_m ) {my.my_blue -= 1;}

my.my_red=clamp(my.my_red,0,255);
my.my_green=clamp(my.my_green,0,255);
my.my_blue=clamp(my.my_blue,0,255);

mat_iets.ambient_red = my.my_red/2;
mat_iets.ambient_green = my.my_green/2;
mat_iets.ambient_blue = my.my_blue/2;
}

action my_player()
{
my.material = mat_iets;

while(1)
{
skin_change();
wait(1);
}
}
Posted By: MrGuest

Re: material question - 05/24/10 00:54

create the material you want with mtl_create, set the RGB values, set to the requried skin with ent_mtlset
Posted By: molotov

Re: material question - 05/24/10 17:10

Thanks MrGuest, it works great, just as I wanted.
© 2024 lite-C Forums