in the templates there is a small code to do it...if you included the template give your model the action fx_uvspeed...if not also include this code to your script:
Code:
function mtl_copy(mtl_source)
{
mtl_temp = mtl_source;
vec_set(mtl.ambient_blue,mtl_temp.ambient_blue);
vec_set(mtl.specular_blue,mtl_temp.specular_blue);
vec_set(mtl.diffuse_blue,mtl_temp.diffuse_blue);
vec_set(mtl.emissive_blue,mtl_temp.emissive_blue);
mtl.power = mtl_temp.power;
mtl.albedo = mtl_temp.albedo;
}
function mtl_uvspeed_render()
{
// using the material matrix:
// u' = u * mtl.matrix11 + v * mtl.matrix21 + mtl.matrix31;
// v' = u * mtl.matrix12 + v * mtl.matrix22 + mtl.matrix32;
mtl.matrix31 = floatd(my.skill1*total_ticks,256);
mtl.matrix32 = floatd(my.skill2*total_ticks,256);
}
function mtl_uvspeed_init()
{
// copy standard model material properties
mtl_copy(mat_model);
mat_identity(mtl.matrix);
mtl.event = mtl_uvspeed_render;
mtl.ENABLE_RENDER = on;
}
MATERIAL mtl_uvspeed =
{
event = mtl_uvspeed_init;
effect = "
matrix matMtl;
technique uvspeed
{
pass one
{
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;
}
}
technique fallback { pass one { } }
";
}
//action: fx_uvspeed
//title: Texture shifting in u and v direction
//
//skill1: Speed_U 0
//help: Texture Speed in U direction, default 0
//skill2: Speed_V -2
//help: Texture Speed in V direction, default -2
//desc:
//desc: Shifts a texture in u and v direction.
//desc: To be assigned to a model.
//
action fx_uvspeed()
{
my.material = mtl_uvspeed;
if (0 == my.skill1 && 0 == my.skill2) { my.skill2 = -2; }
}