Posted By: Blackchuck
Re: can`t run main.wdl, But it is main.c!!!!! - 09/04/09 15:15
No I have no it has exsist as "main.wdl", and I didn`t add an wdl or somthing like that.
Maby rhere is somthing with the script;
--------------------------------------------------------------------------------
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
var entity_speed = 3;
var movement_enabled = 0;
var dist_to_node;
var current_node = 1;
var angle_difference = 0;
var weapon_height;
var current_ammo = 20;
var players_ammo;
var currentGun = 1;
///////////////////////////////////////////////////////////////
VECTOR temp_angle;
VECTOR pos_node[3];
VECTOR trace_coords;
///////////////////////////////////////////////////////////////
STRING* hithole_tga = "hithole.tga";
STRING* target_mdl = "target.mdl";
///////////////////////////////////////////////////////////////
SOUND* bullet_wav = "bullet.wav";
SOUND* gotweapon2_wav = "gotweapon2.wav";
SOUND* nobullets_wav = "nobullets.wav";
SOUND* gotammo_wav = "gotammo.wav";
///////////////////////////////////////////////////////////////
function fire_bullets1();
function fire_bullets2();
function show_target();
function display_hithole();
///////////////////////////////////////////////////////////////
ENTITY* weapon1_ent =
{
type = "weapon1.mdl";
pan = 0;
x = 55;
y = -20;
z = -20;
pan = 2;
use_weapon_startup();
}
ENTITY* weapon2_ent =
{
type = "weapon2.mdl";
pan = 0;
x = 60;
y = 15;
z = -18;
pan = -3;
use_weapon_startup2();
}
void main()
{
shadow_stencil = 1;
level_load("level.wmb");
wait (1);
}
function move_target()
{
while(1)
{
if(movement_enabled)
{
entity_speed = minv(5, entity_speed + 0.5 * time_step);
c_move(my, vector(entity_speed * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);
vec_to_angle (my.pan, vec_diff (temp_angle, pos_node, my.x));
}
while (!player) {wait (1);}
while (1)
{
if ((c_scan(my.x, my.pan, vector(180, 90, 1000), IGNORE_ME) > 0) && (you == player))
{
wait (-2);// Make script later
}
if (vec_dist (player.x, my.x) < 150)
{
wait (-5);// Make script later
}
wait (1);
}
}
}
action enemy1()
{
move_target();
result = path_scan(me, my.x, my.pan, vector(360, 180, 1000));
if (result) {movement_enabled = 1;}
path_getnode (my, 1, pos_node, NULL);
vec_to_angle (my.pan, vec_diff (temp_angle, pos_node, my.x));
while(1)
{
dist_to_node = vec_dist(my.x, pos_node);
if(dist_to_node < 50)
{
current_node = path_nextnode(my, current_node, 1);
if (!current_node) {current_node = 1;}
path_getnode (my, current_node, pos_node, NULL);
}
wait(1);
}
}
action players_code()
{
var movement_speed = 10;
VECTOR temp;
player = my;
set (my, INVISIBLE);
while (1)
{
player.pan -= 7 * mouse_force.x * time_step;
camera.x = player.x;
camera.y = player.y;
camera.z = player.z + 50 + 1.1 * sin(my.skill44);
camera.pan = player.pan;
camera.tilt += 5 * mouse_force.y * time_step;
vec_set (temp.x, my.x);
temp.z -= 10000;
temp.z = -c_trace (my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
temp.x = movement_speed * (key_w - key_s) * time_step;
temp.y = movement_speed * (key_a - key_d) * 0.6 * time_step;
c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);
wait (1);
}
}
action gun()
{
ph_setgravity (vector(0, 0, -386));
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 5, PH_BOX);
phent_setfriction (my, 99);
phent_setdamping (my, 20, 35);
phent_setelasticity (my, 45, 50);
while (!player) {wait (1);}
while (vec_dist (player.x, my.x) > 50)
{
wait (1);
}
players_ammo = 12;
snd_play (gotweapon2_wav, 80, 0);
set (my, PASSABLE);
set (my, INVISIBLE);
set (weapon1_ent, VISIBLE);
set (weapon2_ent, INVISIBLE);
wait (-1);
ent_remove (my);
}
action uzi()
{
ph_setgravity (vector(0, 0, -386));
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 5, PH_BOX);
phent_setfriction (my, 99);
phent_setdamping (my, 20, 35);
phent_setelasticity (my, 45, 50);
while (!player) {wait (1);}
while (vec_dist (player.x, my.x) > 50)
{
wait (1);
}
players_ammo = 12;
snd_play (gotweapon2_wav, 80, 0);
set (my, PASSABLE);
set (my, INVISIBLE);
set (weapon2_ent, VISIBLE);
set (weapon1_ent, INVISIBLE);
wait (-1);
ent_remove (my);
}
function use_weapon_startup()
{
on_mouse_left = fire_bullets1;
proc_mode = PROC_LATE;
VECTOR player1_pos;
VECTOR player2_pos;
while (!player) {wait (1);}
while (1)
{
vec_set (player1_pos.x, player.x);
if (is (weapon2_ent, VISIBLE))
{
vec_set(trace_coords.x, vector(10000, 0, 0));
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, camera.x);
if (c_trace(camera.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE) > 0)
{
ent_create (target_mdl, target.x, show_target);
}
}
wait (1);
vec_set (player2_pos.x, player.x);
if (vec_dist (player1_pos.x, player2_pos.x) != 0)
{
weapon_height += 30 * time_step;
weapon2_ent.z += 0.03 * sin(weapon_height);
}
}
}
function use_weapon_startup2()
{
on_mouse_left = fire_bullets2;
proc_mode = PROC_LATE;
VECTOR player1_pos;
VECTOR player2_pos;
while (!player) {wait (1);}
while (1)
{
vec_set (player1_pos.x, player.x);
if (is (weapon2_ent, VISIBLE))
{
vec_set(trace_coords.x, vector(10000, 0, 0));
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, camera.x);
if (c_trace(camera.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE) > 0)
{
ent_create (target_mdl, target.x, show_target);
}
}
wait (1);
vec_set (player2_pos.x, player.x);
if (vec_dist (player1_pos.x, player2_pos.x) != 0)
{
weapon_height += 30 * time_step;
weapon2_ent.z += 0.03 * sin(weapon_height);
}
}
}
function show_target()
{
set (my, PASSABLE);
my.ambient = 100;
my.scale_x = minv (6, vec_dist (my.x, camera.x) / 500);
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
wait (1);
ent_remove (my);
}
function fire_bullets1()
{
if (is (weapon2_ent, INVISIBLE)) {return;}
if (current_ammo > 0)
{
c_trace(camera.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE | ACTIVATE_SHOOT);
if (you == NULL)
{
ent_create (hithole_tga, target.x, display_hithole);
}
snd_play (bullet_wav, 100, 0);
current_ammo -= 1;
wait (-2);
}
else
{
snd_play (nobullets_wav, 100, 0);
}
}
function fire_bullets2()
{
if (is (weapon2_ent, INVISIBLE)) {return;}
if (current_ammo > 0)
{
c_trace(camera.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE | ACTIVATE_SHOOT);
if (you == NULL)
{
ent_create (hithole_tga, target.x, display_hithole);
}
snd_play (bullet_wav, 100, 0);
current_ammo -= 1;
}
else
{
snd_play (nobullets_wav, 100, 0);
}
}
function display_hithole()
{
vec_to_angle (my.pan, normal);
vec_add(my.x, normal.x);
set (my, PASSABLE);
set (my, TRANSLUCENT);
my.ambient = 50;
my.roll = random(360);
my.scale_x = 0.5;
my.scale_y = my.scale_x;
wait (-20);
ent_remove (my);
}
action ammo_pack()
{
ph_setgravity (vector(0, 0, -386));
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 7, PH_BOX);
phent_setfriction (my, 99);
phent_setdamping (my, 20, 35);
phent_setelasticity (my, 45, 50);
while (!player) {wait (1);}
while (vec_dist (player.x, my.x) > 50)
{
wait (1);
}
snd_play (gotammo_wav, 80, 0);
set (my, PASSABLE);
set (my, INVISIBLE);
current_ammo += 12;
wait (-1);
ent_remove (my);
}
action wheel()
{
ph_setgravity (vector(0, 0, -386));
phent_settype (my, PH_RIGID, PH_CYLINDER);
phent_setmass (my, 15, PH_BOX);
phent_setfriction (my, 99);
phent_setdamping (my, 20, 35);
phent_setelasticity (my, 45, 50);
}
function toggle_guns_startup()
{
while (1)
{
if (key_1)
{
weapon1_ent.flags2 = VISIBLE;
weapon2_ent.flags2 = INVISIBLE;
currentGun = 1;
}
if (key_2)
{
weapon1_ent.flags2 = INVISIBLE;
weapon2_ent.flags2 = VISIBLE;
currentGun = 2;
}
if (currentGun == 1)
{
weapon1_ent.flags2 = VISIBLE;
weapon2_ent.flags2 = INVISIBLE;
}
if (currentGun == 2)
{
weapon1_ent.flags2 = INVISIBLE;
weapon2_ent.flags2 = VISIBLE;
}
wait (1);
}
}
Posted By: Nowherebrain
Re: can`t run main.wdl, But it is main.c!!!!! - 09/05/09 03:18
It's not a big issue but next time try to post code as a code object...not so messy.
you should make sure it is saved as a "c" file first, don't assume it is "c"....you must type main.c, then save or try "main.c" with the quotations. You should check the folder later a view the details, if you see a main.wdl delete it. Go into med under file > map properties, load the main.c as the file to control your game.