Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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 | chip programmers | 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