1 registered members (TipmyPip),
18,631
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
how do i convert this AI script? pls help
#250525
02/08/09 14:07
02/08/09 14:07
|
Joined: Aug 2008
Posts: 10
Rye
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 10
|
its in wdl how do i change it in lite c?...
#include<acknex.h> #include<default.c>
define idle 1; define attacking 2; define dead 3; define status skill1; define health skill10;
string shell_mdl=<shell.mdl>;
function fire_bullets(); function move_bullets(); function remove_bullets();
function main() { fps_max=80; level_load("sample.wmb"); }
function fire_bullets() { proc_kill(4); while(mouse_left==on){ got_shot(); wait(1); }
ent_create(shell_mdl,camera.x,move_bullets); } function got_shot()
{
if (you.skill30 != 1) {return;} my.health -= 35;
if (my.health <= 0) {
my.status = dead; my.event = null; return;
} else { my.status = attacking;
}
} function remove_bullets() { wait(1); ent_remove(my); }
function move_bullets() { var bullet_speed; my.enable_impact=on; my.enable_entity=on; my.enable_block=on; my.event=got_shot; my.pan=camera.pan; my.tilt=camera.tilt; bullet_speed.x = 50 * time; bullet_speed.y=0; bullet_speed.z=0; while(my!=null) { c_move(my,bullet_speed,nullvector,ignore_you); wait(1); } }
function move_enemy_bullets()
{
var bullet_speed; my.skill30 = 1; my.enable_impact = on; my.enable_entity = on; my.enable_block = on; my.event = remove_bullets; my.pan = you.pan; my.tilt = you.tilt; bullet_speed.x = 50 * time_step; bullet_speed.y = 0; bullet_speed.z = 0; while (my != null) { c_move (my, bullet_speed, nullvector, ignore_you); wait (1);
}
}
function hurt_player() { if(you.skill30 !=1){return;} my.health - = 20; }
action my_enemy() { var idle_percentage=0; var run_percentage=0; var death_percentage=0; var content_right; var content_left; my.polygon=on; my.health=100; my.enable_impact = on; my.event=got_shot; my.passable=on; my.status = idle; while(my.status !=dead) { if(my.status == idle) { ent_animate(my,"stand",idle_percentage,anm_cycle); idle_percentage +=5 * time; if(vec_dist(player.x,my.x)<1000) { if((c_scan(my.x,my.pan,vector(120,60,1000), ignore_me) > 0 ) && (you==player)) { my.status=attacking; } } } if(my.status == attacking) { if(c_content(content_right.x,0) + c_content(content_left.x,0)==2) { vec_set(temp, player.x); vec_sub(temp,my.x); vec_to_angle(my.pan,temp); } if(vec_dist(player.x,my.x) > 500) { vec_set(content_right,vector(50,-20,-15)); vec_rotate(content_right,my.pan); vec_add(content_right.x, my.x); if(c_content(content_right.x,0) ! =1 ) { my.pan + = 5 * time; } vec_set(content_left,vector(50,20,-15)); vec_rotate(content_right,my.x); vec_add(content_right.x,my.x); if(c_content(content_left.x,0) ! =1) { my.pan -= 5 * time; } c_move(my,vector(10 * time, 0 , 0), nullvector,glide); ent_animate(my,"run", run_percentage,ANM_CYCLE); run_percentage += 6 * time; } else { ent_animate(my,"attack",100, null); } if((total_frames % 80)==1) { vec_for_vertex(temp, my ,8); ent_create(shell_mdl,temp,move_enemy_bullets); } if(vec_dist(player.x,my.x) > 1500) { my.status=idle; } } wait(1); } //while(death_percentage < 100) // { // ent_animate(my,"death", death_percentage,null); // death_percentage +=3 * time; // wait(1); //} // my.passable=on; } action players_code { player=my; my.invisible=on; my.health=100; my.enable_impact=on; my.enable_entity=on; my.event=hurt_player; while(my.health > 0) { c_move(my,vector(20 * (key_w - key_s) * time, 6 * (key_a - key_d) * time,0 ),nullvector,glide | IGNORE_YOU); if(mouse_left==on) { fire_bullets(); } vec_set(camera.x,player.x); camera.z = 3; camera.pan = 5; camera.tilt =3; player.pan=camera.pan; wait(1); } while(camera.tilt < 90) { camera.tilt +=2 * time; camera.roll +=1.5 * time; wait(1); } }
action my_enemy() { var idle_percentage=0; var run_percentage=0; var death_percentage=0; var attack_percentage=0; my.polygon=on; my.health=100; my.enable_impact = on; my.event=got_shot; my.status = idle; while(my.status !=dead) { if(my.status == idle) { ent_animate(my,"stand",idle_percentage,anm_cycle); idle_percentage +=3 * time_step; if(vec_dist(player.x,my.x)<1000) { my.status = attacking; } } if(my.status == attacking) { vec_set(temp, player.x); vec_sub(temp,my.x); vec_to_angle(my.pan,temp); if(vec_dist(player.x,my.x) > 50) { c_move(my,vector(10 * time, 0 , 0), nullvector,glide); ent_animate(my,"run", run_percentage,anm_cycle); run_percentage += 6 * time_step; } else { c_move(my,vector(0 * time, 0 , 0), nullvector,glide); ent_animate(my,"attack",attack_percentage, anm_cycle); attack_percentage += 6 * time_step; my.health - = 10; } //if((total_frames % 80)==1) //{ // vec_for_vertex(temp, my ,8); // ent_create(shell_mdl,temp,move_enemy_bullets); //} if(vec_dist(player.x,my.x) > 150) { my.status=idle; } } wait(1); } while(death_percentage < 100) { ent_animate(my,"death", death_percentage,null); death_percentage +=3 * time; wait(1); } my.passable=on; }
|
|
|
Re: how do i convert this AI script? pls help
[Re: Kaizen_31]
#250789
02/09/09 19:35
02/09/09 19:35
|
Joined: Aug 2008
Posts: 218 U.S.
GamerX
Member
|
Member
Joined: Aug 2008
Posts: 218
U.S.
|
It isn't all lite-c but you only have to change some of it. I converted it was really simple and runs without compile problems.
#include<acknex.h>
#include<default.c>
#define idle 1
#define attacking 2
#define dead 3
#define status skill1
#define health skill10
STRING* shell_mdl="shell.mdl";
function fire_bullets();
function move_bullets();
function remove_bullets();
function got_shot();
function main()
{
fps_max=80;
level_load("sample.wmb");
}
function fire_bullets()
{
proc_kill(4);
while(mouse_left){ got_shot(); wait(1); }
ent_create(shell_mdl,camera.x,move_bullets);
}
function got_shot()
{
if (you.skill30 != 1) {return;}
my.health -= 35;
if (my.health <= 0)
{
my.status = dead;
my.event = NULL;
return;
}
else
{
my.status = attacking;
}
}
function remove_bullets()
{
wait(1);
ent_remove(my);
}
function move_bullets()
{
my.emask = ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK;
my.event=got_shot;
my.pan=camera.pan;
my.tilt=camera.tilt;
while(my!=NULL)
{
c_move(my,vector(50 * time_step,0,0),nullvector,IGNORE_YOU);
wait(1);
}
}
function move_enemy_bullets()
{
my.skill30 = 1;
my.emask = ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK;
my.event = remove_bullets;
my.pan = you.pan;
my.tilt = you.tilt;
while (my != NULL)
{
c_move(my,vector(50 * time_step,0,0),nullvector,IGNORE_YOU);
wait (1);
}
}
function hurt_player()
{
if(you.skill30 !=1){return;}
my.health -= 20;
}
action my_enemy()
{
var idle_percentage=0;
var run_percentage=0;
var death_percentage=0;
var content_right;
var content_left;
var temp;
my.flags = POLYGON | PASSABLE;
my.health=100;
my.emask = ENABLE_IMPACT;
my.event=got_shot;
my.status = idle;
while(my.status !=dead)
{
if(my.status == idle)
{
ent_animate(my,"stand",idle_percentage,ANM_CYCLE);
idle_percentage +=5 * time_step;
if(vec_dist(player.x,my.x)<1000)
{
if((c_scan(my.x,my.pan,vector(120,60,1000), IGNORE_ME) > 0 ) && (you==player))
{
my.status=attacking;
}
}
}
if(my.status == attacking)
{
if(c_content(content_right,0) + c_content(content_left,0)==2)
{
vec_set(temp, player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);
}
if(vec_dist(player.x,my.x) > 500)
{
vec_set(content_right,vector(50,-20,-15));
vec_rotate(content_right,my.pan);
vec_add(content_right, my.x);
if(c_content(content_right,0) !=1 )
{
my.pan += 5 * time_step;
}
vec_set(content_left,vector(50,20,-15));
vec_rotate(content_right,my.x);
vec_add(content_right,my.x);
if(c_content(content_left,0) !=1)
{
my.pan -= 5 * time_step;
}
c_move(my,vector(10 * time_step, 0 , 0), nullvector,GLIDE);
ent_animate(my,"run", run_percentage,ANM_CYCLE);
run_percentage += 6 * time_step;
}
else
{
ent_animate(my,"attack",100, NULL);
}
if((total_frames % 80)==1)
{
vec_for_vertex(temp, my ,8);
ent_create(shell_mdl,temp,move_enemy_bullets);
}
if(vec_dist(player.x,my.x) > 1500)
{
my.status=idle;
}
}
wait(1);
}
//while(death_percentage < 100)
// {
// ent_animate(my,"death", death_percentage,null);
// death_percentage +=3 * time;
// wait(1);
//}
// my.passable=on;
}
action players_code()
{
player=my;
player.flags = INVISIBLE;
player.emask = ENABLE_IMPACT | ENABLE_ENTITY;
my.health=100;
my.event=hurt_player;
while(my.health > 0)
{
c_move(my,vector(20 * (key_w - key_s) * time_step, 6 * (key_a - key_d) * time_step,0 ),nullvector,GLIDE | IGNORE_YOU);
if(mouse_left)
{
fire_bullets();
}
vec_set(camera.x,player.x);
camera.z = 3;
camera.pan = 5;
camera.tilt =3;
player.pan=camera.pan;
wait(1);
}
while(camera.tilt < 90)
{
camera.tilt +=2 * time_step;
camera.roll +=1.5 * time_step;
wait(1);
}
}
action my_enemy()
{
var temp;
var idle_percentage=0;
var run_percentage=0;
var death_percentage=0;
var attack_percentage=0;
my.flags = POLYGON;
my.emask = ENABLE_IMPACT;
my.health=100;
my.event=got_shot;
my.status = idle;
while(my.status !=dead)
{
if(my.status == idle)
{
ent_animate(my,"stand",idle_percentage,ANM_CYCLE);
idle_percentage +=3 * time_step;
if(vec_dist(player.x,my.x)<1000)
{
my.status = attacking;
}
}
if(my.status == attacking)
{
vec_set(temp, player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);
if(vec_dist(player.x,my.x) > 50)
{
c_move(my,vector(10 * time_step, 0 , 0), nullvector,GLIDE);
ent_animate(my,"run", run_percentage,ANM_CYCLE);
run_percentage += 6 * time_step;
}
else
{
c_move(my,vector(0 * time_step, 0 , 0), nullvector,GLIDE);
ent_animate(my,"attack",attack_percentage, ANM_CYCLE);
attack_percentage += 6 * time_step;
my.health -= 10;
}
//if((total_frames % 80)==1)
//{
// vec_for_vertex(temp, my ,8);
// ent_create(shell_mdl,temp,move_enemy_bullets);
//}
if(vec_dist(player.x,my.x) > 150)
{
my.status=idle;
}
}
wait(1);
}
while(death_percentage < 100)
{
ent_animate(my,"death", death_percentage,NULL);
death_percentage +=3 * time_step;
wait(1);
}
set(my,PASSABLE);
}
"You may never know what results come of your action, but if you do nothing there will be no result." -Mahatma Gandhi
|
|
|
|