Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Simple enemy... #181171
01/31/08 14:38
01/31/08 14:38
Joined: Oct 2007
Posts: 34
Morph Offline OP
Newbie
Morph  Offline OP
Newbie

Joined: Oct 2007
Posts: 34
A simple enemy code?? put the code only. Thanks


Begginer in 3D Game Studio
Re: Simple enemy... [Re: Morph] #181172
01/31/08 15:05
01/31/08 15:05
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Enemy = AI
Doesn't exist something like simple code.
Check templates about enemy and AI, search forum.


Never say never.
Re: Simple enemy... [Re: tompo] #181173
01/31/08 19:56
01/31/08 19:56
Joined: Oct 2007
Posts: 34
Morph Offline OP
Newbie
Morph  Offline OP
Newbie

Joined: Oct 2007
Posts: 34
Hi, good hehe. I found a code of AUM, is a enemy code but of a sword combat game...look, i copy and paste the part of the enemy action in a new script and save the script call "Enemy.wdl", and i put "include <enemy.wdl>;" in my main script, compile and run and error: "Empty pointer in enemy_fight: if (vec_dist (my.x, player.x) < 200 && player.healthpoints > 0)", look, this is the code:

***************************************************************************

var player_distance; // moves the player
var enemy_distance; // moves the enemy

define sword_base = skill12; // using skill12, 13, 14 to store the sword_base coords
define sword_tip = skill15; // using skill15, 16, 17 to store the sword_tip coords
define healthpoints = skill18; // just another name for skill18

entity* enemy;

action enemy_fight // attached to the enemy
{
enemy = me; // I'm the enemy
enemy.healthpoints = 100; // and I have 100 healthpoints
while (my.healthpoints > 0) // as long as I'm alive
{
if (vec_dist (my.x, player.x) < 200 && player.healthpoints > 0) // the player approaches the enemy
{
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0; // I'm a maniac
enemy_distance.x = 5 * time;
enemy_distance.y = 0;
enemy_distance.z = 0;
ent_move(enemy_distance, nullvector);
ent_cycle("walk", my.skill19); // play walk frames animation
my.skill19 += 5 * time; // "walk" animation speed
if (my.skill19 > 100) {my.skill19 = 0;} // loop animation
if (vec_dist (my.x, player.x) < 50) // if the player comes closer than 50 quants attack him
{
my.skill20 = 0; // reset "attack" frames
while (my.skill20 < 100)
{
ent_vertex(my.sword_tip, 291); // sword tip vertex coords - get the value in Med
ent_vertex(my.sword_base, 306); // sword base vertex coords - get the value in Med
trace_mode = ignore_me + ignore_passable;
trace (my.sword_base, my.sword_tip); // trace between these sword positions
if (result != 0) // hit something, could be the player or another enemy
{

if (you != null) {you.healthpoints -= 4 * time;}

}
ent_cycle("attack", my.skill20); // play attack frames animation
my.skill20 += 5 * time; // "attack" animation speed
wait (1);
}
waitt (6); // slows down the enemy and reduces the number of traces per second
}
}
else // the player is farther than 200 quants away
{
ent_cycle("stand", my.skill21); // play stand frames animation
my.skill21 += 2 * time; // "stand" animation speed
if (my.skill21 > 100) {my.skill21 = 0;} // loop animation
}
wait (1);
}
while (my.skill22 < 80) // the enemy is dead
{
ent_cycle("death", my.skill22); // play death frames animation
my.skill22 += 1 * time; // "death" animation speed
wait (1);
}
my.passable = on; // the corpse can't be hit by the sword from now on
}

**********************************************************************

help me in this.


Begginer in 3D Game Studio
Re: Simple enemy... [Re: Morph] #181174
01/31/08 20:20
01/31/08 20:20
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
action enemy_fight // attached to the enemy
{
enemy = me; // I'm the enemy
enemy.healthpoints = 100; // and I have 100 healthpoints
while(!player) { wait(1); } // wait until the player exists
// rest of the code ...

Re: Simple enemy... [Re: Xarthor] #181175
01/31/08 21:28
01/31/08 21:28
Joined: Oct 2007
Posts: 34
Morph Offline OP
Newbie
Morph  Offline OP
Newbie

Joined: Oct 2007
Posts: 34
Hello Xarthor, thanks for you answer...the problem is solved but i have other problem, ultimate problem, compile and run the project and put me an error:

*******************************************************************

< while(my.skill22<80) {>
enemy.wdl 63:0 (): Parameter unknown while bad keyword in {}

< ent_cycle("death",my.skill22);>
enemy.wdl 64:0 (): Parameter unknown ent_cycle bad keyword in {}

< my.skill22 +=1*time;>
enemy.wdl 65:0 (): Parameter unknown my.skill22 bad keyword in {}

< wait(1);>
enemy.wdl 66:0 (): Parameter unknown wait bad keyword in {}

< my.passable = on;>
enemy.wdl 68:0 (): Parameter unknown my.passable

Script error
Engine shutdown
Startup failure - any key to abort

*************************************************************************

Good, what is the problem????????


Begginer in 3D Game Studio
Re: Simple enemy... [Re: Morph] #181176
01/31/08 22:04
01/31/08 22:04
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
you forgot to place an " } " or an " ; " above the mentioned "while" statement

Re: Simple enemy... [Re: Damocles] #181177
01/31/08 22:19
01/31/08 22:19
Joined: Oct 2007
Posts: 34
Morph Offline OP
Newbie
Morph  Offline OP
Newbie

Joined: Oct 2007
Posts: 34
Where?????


Begginer in 3D Game Studio
Re: Simple enemy... [Re: Morph] #181178
02/01/08 15:17
02/01/08 15:17
Joined: Oct 2007
Posts: 34
Morph Offline OP
Newbie
Morph  Offline OP
Newbie

Joined: Oct 2007
Posts: 34
Pleaseeeeeeeeeeeeee, where??


Begginer in 3D Game Studio
Re: Simple enemy... [Re: Morph] #181179
02/01/08 16:28
02/01/08 16:28
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
You need to post the full code for that to help you.

Re: Simple enemy... [Re: Damocles] #181180
02/01/08 16:56
02/01/08 16:56
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
I think you forgot this "}"

Code:

ent_cycle("stand", my.skill21); // play stand frames animation
my.skill21 += 2 * time; // "stand" animation speed
if (my.skill21 > 100) {my.skill21 = 0;} // loop animation
}
wait (1);
} <------------------------------------------------------------------------------------------
while (my.skill22 < 80) // the enemy is dead
{
ent_cycle("death", my.skill22); // play death frames animation
my.skill22 += 1 * time; // "death" animation speed
wait (1);
}



Page 1 of 3 1 2 3

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