I finally decided to use lite-c so my script i made im rewriting.
So far i converted about 50% of my script, after line 40 there are errors.
But i got a new bug i cant fix on my own(probley something very easy to fix)
i got error
Error in 'MAIN' line 39; 'max' undeclared identifer
<fall_speed.z = max (-20 * time, fall_speed.z); // 35 = falling speed>
.
Cant compile PROJECT.C
Any idea's which could be wrong?.
my script
#include <acknex.h>
#include <default.c>
ENTITY* gplayer;
var walk_percentage; //anmation percent
var can_walk = 1; //the player can move
var distance_to_ground; // the distance between player's origin and the ground not yet used
var distance_check; // use this to check distance
var fall_speed; //set fall speed
VECTOR* temp;
VECTOR* distance_check;
VECTOR* fall_speed;
function main()
{
video_switch(7,0,1); // set full screen and 800/600 with no depth change
fps_max = 200; //set the frame rate this way game will run the same on all pc's
level_load("Project1.wmb"); //load the level
wait(2); // wait until the level is loaded
camera.tilt = -12;//set camera tilt
}
action player_actions() //player action
{
gplayer = me; //ponit the model is gplayer
set(my,SHADOW); //shadow on
while(1) //loop
{
if (can_walk == 1) // if you can walk
{
vec_set(temp,gplayer.x);//set temp to be equal to gplayer
vec_set(camera,vector(temp.x-200,temp.y,gplayer.z+50));//set camera to follow
vec_set(distance_check,gplayer.x); //distance_check = gplayer
distance_check.z -= 5000; //set 5000 quants below player's origin
distance_to_ground = c_trace (my.x, distance_check.x, IGNORE_ME | USE_BOX);
fall_speed.z = - (distance_to_ground - 17); // 17 = experimental value
fall_speed.z = Max (-20 * time, fall_speed.z); // 35 = falling speed
if (key_w) //if keyboard W is pressed move forward
{
c_move(my,vector(9.6* time_step,0,fall_speed.z),nullvector,GLIDE); //move
ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 12 * time_step; // 3 = animation speed for "walk"
}
else
{
c_move(my,vector(0,0,fall_speed.z),nullvector,GLIDE); //dont move but appy gravity
ent_animate(my, NULL, 0, 0); // reset all the animations
}
if (key_a) //if keyboard A is pressed pan + 2
{
my.pan+=8 * time_step; //if keyboard A is pressed pan + 2
}
if (key_d) //if keyboard A is pressed pan - 2
{
my.pan-=8 * time_step; //if keyboard A is pressed pan - 2
}
wait(1); //wait to next frame
}
wait(1);
}
}
FONT arial_font = "Arial",0,20; // Arial, bold, a character has a height of 20 points
STRING worldtext_str = "My First Project"; // string says MY First Project
TEXT world_txt =
{
pos_x = 10;
pos_y = 10;
string (worldtext_str) ;
flags = VISIBLE;
font = arial_font;
} // this above displays the text top left
please help