Gamestudio Links
Zorro Links
Newest Posts
Bug in train mode, or it seem to me
by mistery. 09/22/26 09:40
Capital slider is not saving in Z12
by Petra. 09/22/26 06:49
Parent/child object
by VoroneTZ. 09/22/26 05:52
Zorro tutorial ideas?
by AndrewAMD. 09/21/26 14:50
Trades during a running bar
by Martin_HH. 09/21/26 12:03
Avoiding pop-up training parameter results
by Martin_HH. 09/16/26 21:31
What are you working on?
by rayp. 09/16/26 20:20
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (LoT, Quad, Martin_HH, mistery), 1,510 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lopezsergio07, mistery, lokkalyansamiti, rahulbuilds, speedx
19237 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
material question #324666
05/22/10 15:02
05/22/10 15:02
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
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);
}
}

Re: material question [Re: molotov] #324946
05/24/10 00:54
05/24/10 00:54
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
create the material you want with mtl_create, set the RGB values, set to the requried skin with ent_mtlset

Re: material question [Re: MrGuest] #325035
05/24/10 17:10
05/24/10 17:10
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
Thanks MrGuest, it works great, just as I wanted.


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1