code straight out my project, i'm sure you'll figure the rest out
function enable_material_1(){
if(render_view == view_player[0]){
return(0);
}else{
return(1);
}
}
function enable_material_2(){
if(render_view == view_player[1]){
return(0);
}else{
return(1);
}
}
function enable_material_3(){
if(render_view == view_player[2]){
return(0);
}else{
return(1);
}
}
create material events for each possible view combo
mtl_local[0].event = enable_material_1;
mtl_local[1].event = enable_material_2;
mtl_local[2].event = enable_material_3;
mtl_local[0].flags = ENABLE_VIEW | ENABLE_TREE;
mtl_local[1].flags = ENABLE_VIEW | ENABLE_TREE;
mtl_local[2].flags = ENABLE_VIEW | ENABLE_TREE;
set the event per material
ent_sky[i].material = mtl_local[i];
apply each material per entities as required
Hope this helps