Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, LorraineJones, VoroneTZ, Akow), 1,446 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
can anyone help me in this code??? #246897
01/17/09 20:06
01/17/09 20:06
Joined: Jan 2009
Posts: 36
Philippines
U
unknown_master Offline OP
Newbie
unknown_master  Offline OP
Newbie
U

Joined: Jan 2009
Posts: 36
Philippines
this code was a .wdl script and if i include this on a .c it showed many errors that .c cannot compile. can anyone help me to convert this code on lite-c(.c) instructions correctly? i will wait for your reply as soon as possible. tnx.

this is my code:



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: can anyone help me in this code??? [Re: unknown_master] #246960
01/18/09 03:54
01/18/09 03:54
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
for one thing your first three defines arent useing a skill

Re: can anyone help me in this code??? [Re: badapple] #246961
01/18/09 05:11
01/18/09 05:11
Joined: Oct 2008
Posts: 218
Nashua NH
heinekenbottle Offline
Member
heinekenbottle  Offline
Member

Joined: Oct 2008
Posts: 218
Nashua NH
Originally Posted By: badapple
for one thing your first three defines arent useing a skill


defines do not have to use skills. That is perfectly legal.


I was once Anonymous_Alcoholic.

Code Breakpoint;
Re: can anyone help me in this code??? [Re: unknown_master] #246962
01/18/09 05:25
01/18/09 05:25
Joined: Oct 2008
Posts: 218
Nashua NH
heinekenbottle Offline
Member
heinekenbottle  Offline
Member

Joined: Oct 2008
Posts: 218
Nashua NH
In the string definitions:

Code:
string shell_mdl=<shell.mdl>;


should be
Code:
string shell_mdl="shell.mdl";


In function move_bullets()

Code:
my.enable_impact=on;
my.enable_entity=on;
my.enable_block=on;


should be
Code:
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);


In action my_enemy()


Code:
my.polygon=on;
my.health=100;
my.enable_impact = on;
my.event=got_shot;
my.passable=on;
my.status = idle;


Needs to change. Flags are set with the set() macro defined in acknex.h and event flags are set with emask:

Code:
my.health = 100;
my.status = idle;
my.emask |= (ENABLE_IMPACT);
my.event = got_shot;
set(my,PASSABLE | POLYGON);

Code:

vec_set(temp, player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);


Temp needs to be declared, it is not a predefined variable anymore.

Code:
death_percentage +=3 * time;


time was replaced with time_step, each time you see time in the code.


I was once Anonymous_Alcoholic.

Code Breakpoint;
Re: can anyone help me in this code??? [Re: heinekenbottle] #246969
01/18/09 09:15
01/18/09 09:15
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
string shell_mdl="shell.mdl";

STRING* should be instead of string if i'm not wrong



Ubi bene, ibi Patria.
Re: can anyone help me in this code??? [Re: croman] #246971
01/18/09 09:19
01/18/09 09:19
Joined: Apr 2008
Posts: 437
dracula Offline
Senior Member
dracula  Offline
Senior Member

Joined: Apr 2008
Posts: 437
Why is shell.mdl a STRING and not an ENTITY ???


Drac

Re: can anyone help me in this code??? [Re: dracula] #246972
01/18/09 09:22
01/18/09 09:22
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
because you put in
ent_create(shell_mdl, vec_pos, ent_action);
instead of "shell.mdl"



Ubi bene, ibi Patria.
Re: can anyone help me in this code??? [Re: croman] #247008
01/18/09 14:29
01/18/09 14:29
Joined: Jan 2009
Posts: 36
Philippines
U
unknown_master Offline OP
Newbie
unknown_master  Offline OP
Newbie
U

Joined: Jan 2009
Posts: 36
Philippines
the first 3 defines i made is for defining an idle, attacking and running of my A.I. in my game. what is wrong in that code? why is the "define" in .wdl replace with "#define" in .c? and skill do not work? because after that, i save it to .c code, i debug it so many times and i found a result, it works! the player_code() action but the my_enemy() action did not work anymore, the vec_dist cannot calculate the vertex of my player and monster. what will i supposed to do?? To all of the game developers who replied in my question thank you very much...i will try the code of mr. 'heinekenbottle' did. i pray that it will works...tnx!!!

Re: can anyone help me in this code??? [Re: dracula] #247013
01/18/09 14:55
01/18/09 14:55
Joined: Apr 2008
Posts: 437
dracula Offline
Senior Member
dracula  Offline
Senior Member

Joined: Apr 2008
Posts: 437
Originally Posted By: cerberi
because you put in
ent_create(shell_mdl, vec_pos, ent_action);
instead of "shell.mdl"


Thanks cerberi.

Drac

Re: can anyone help me in this code??? [Re: croman] #247025
01/18/09 16:42
01/18/09 16:42
Joined: Oct 2008
Posts: 218
Nashua NH
heinekenbottle Offline
Member
heinekenbottle  Offline
Member

Joined: Oct 2008
Posts: 218
Nashua NH
Originally Posted By: cerberi_croman
string shell_mdl="shell.mdl";

STRING* should be instead of string if i'm not wrong


That is correct, my bad.


I was once Anonymous_Alcoholic.

Code Breakpoint;
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1