I fixed it.
Reasons why it made an error:
1.LiteC isn't so friendly with predefined vectors to use
temp2.
Temp vector isn't the best solution anyway.
3.Nothing were wrong with
result.
So, the mighty script:
Code:
#include <acknex.h>
#include <default.c>
VECTOR t_v;
function puddle_a()
{
// ent_playsound(my,smallsplash,120);
set(my,PASSABLE);
vec_set(my.scale_x,vector(1.3,1.3,1.3));
my.skill28 = 0;
vec_set(t_v,my.x);
t_v.z -= 4000;
result = c_trace(my.x,t_v,IGNORE_ME|IGNORE_MODELS|IGNORE_SPRITES|IGNORE_PASSENTS);// subtract vertical distance to ground
if (result < 10) {
my.z -= (result - 1);
vec_to_angle(t_v,normal.x);my.tilt = t_v.y;my.pan = t_v.x;
}
vec_set(t_v,my.x);
t_v.x += 70 * cos(camera.pan);t_v.y += 70 * sin(camera.pan);
result = c_trace(my.x,t_v,IGNORE_ME|IGNORE_MODELS|IGNORE_SPRITES|IGNORE_PASSENTS);
if (result < 10 && result > 0)
{
my.z -= (result - 1);
vec_to_angle(t_v,normal.x);
my.tilt = t_v.y;my.pan = t_v.x;my.z += 30;
if (my.tilt < 30) { my.skill28 = 1; }
}
set(my,TRANSLUCENT);
my.alpha = 18;
while (my.alpha > 0)
{
my.alpha -= 0.4 * time_step;
my.scale_x += 0.06 * time_step;my.scale_y += 0.06 * time_step;my.scale_z += 0.06 * time_step;
if (my.skill28 == 1)
{
my.z -= 4.5 * time_step;
my.scale_x -= 0.02 * time_step;my.scale_y += 0.06 * time_step;
}
wait(1);
}
ent_remove(my);
}
function main()
{video_window(nullvector,nullvector,1,"c_rotate test");video_switch(8,0,1);
fps_max = 64;detail_size = 64;vec_set(sky_color,vector(192,160,128));
level_load("map_water.hmp");
wait(3);
ent_create("test.mdl",vector(-256,0,128),puddle_a);
}