Gamestudio Links
Zorro Links
Newest Posts
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
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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 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
Suche kampf Spiel Script #44181
04/12/05 21:44
04/12/05 21:44
Joined: Apr 2005
Posts: 653
Germany
D
Det Offline OP
User
Det  Offline OP
User
D

Joined: Apr 2005
Posts: 653
Germany
Hallo Leute !
Ich habe vor ein Kampfspiel zu machen wobei sich die Gegner

im Karate Stil bekämpfen können . Die Template Vorlagen gehen

nicht für mein vorhaben . Habe schon im netz rumgesucht aber nix gefunden .

Ich brauche das Script als Player Action . Kann mir hier einer weiter helfen ?

wäre gut wenn mir einer das Script also den Code Posten könnte .


Wissen ist macht.
Nichts wissen macht auch nichts.

A7.86
Re: Suche kampf Spiel Script [Re: Det] #44182
04/13/05 10:36
04/13/05 10:36
Joined: Mar 2003
Posts: 1,095
Germany
nightshade Offline
Serious User
nightshade  Offline
Serious User

Joined: Mar 2003
Posts: 1,095
Germany
Guck mal bei 3dgs Downloads, da ist ein gutes Tutorial mit Resourcen (also auch Scripts), und ja, zu dem Karate Stil da musste selber modeln und dann per Script ändern, da steht ja alles genaue drinn .

Re: Suche kampf Spiel Script [Re: Det] #44183
03/28/06 13:42
03/28/06 13:42
Joined: Mar 2006
Posts: 27
R
rogerant Offline
Newbie
rogerant  Offline
Newbie
R

Joined: Mar 2006
Posts: 27
es gibt doch das script von
Keith Blount - Aka Ambit
und das Kampfspiel "World of figthing"
http://www.vollversion.de/download/world_of_fighting_2476.html

zum Beginn noch das Kampftutorial:
http://www.coniserver.net/ubbthreads/showthreaded.php/Cat/0/Number/571456/page/0/vc/1

Re: Suche kampf Spiel Script [Re: Det] #44184
03/28/06 13:48
03/28/06 13:48
Joined: Mar 2006
Posts: 27
R
rogerant Offline
Newbie
rogerant  Offline
Newbie
R

Joined: Mar 2006
Posts: 27
Aus einem AUM habe ich das:

Es ist wichtig für körperbezogenen Schaden, der ja bei Deinem Kampfspiel
unbedingt wichtig ist:
Code:
 If you are looking for a simple method to make your models react in different ways depending on the bullet impact area, you came to the right place. It is quite normal to have an enemy soldier dead if we have managed to curl its hair with a head shot, right? On the other hand, it isn't normal to kill an enemy by shooting its leg once. 

I'm going to reveal my method - it is fast and it works flawlessly. I like to call it the (put something here) method.

The idea is simple: we set some key vertices on our enemy model and then we get their height in a while loop. When a bullet hits the model, we get the height of the bullet and then we compare this value with the height of every key vertex. The closest vertex will trigger its specific animation. The code is as simple as it sounds (is this good news or bad news?)

I will use a text to display a string on the screen and two panels: one for the crosshair and one for the key vertices and for bullet's coordinate.

text info_txt
{
layer = 20;
pos_x = 0;
pos_y = 0;
font = _a4font;
string = "head vertex:\nmiddle vertex:\nleg vertex:\nhit coord:";
flags = visible;
}

panel crosshair_pan
{
bmap = crosshair_pcx;
layer = 20;
pos_x = 0;
pos_y = 0;
flags = transparent, refresh, d3d, visible;
}

panel coords_pan
{
layer = 20;
pos_x = 80;
pos_y = 0;
digits = 0, 0, 4, _a4font, 1, vertex_coords.x;
digits = 0, 9, 4, _a4font, 1, vertex_coords.y;
digits = 0, 18, 4, _a4font, 1, vertex_coords.z;
digits = 0, 27, 4, _a4font, 1, bullet_pos.z;
flags = refresh, d3d, visible;
}

Function main disables the "D" (debug panel) key because we will use WSAD to move the player and then it loads the level:

function main()
{
on_d = null;
level_load (damage_wmb);
}

This is a standalone project so we need an action for the player:

action player_moves
{
my.invisible = on; // no need to see the player because we are in 1st person mode
crosshair_pan.pos_x = (screen_size.x - bmap_width(crosshair_pcx)) / 2;
crosshair_pan.pos_y = (screen_size.y - bmap_height(crosshair_pcx)) / 2;
while (1)
{
vec_set (camera.pos, my.pos);
camera.tilt += 20 * mouse_force.y * time;
camera.pan -= 20 * mouse_force.x * time;
my.pan = camera.pan;
my.tilt = camera.tilt;
player_speed.x = 15 * (key_w - key_s) * time; // move forward / backward
player_speed.y = 10 * (key_a - key_d) * time; // strafe left / right
vec_set (temp, my.x);
temp.z -= 1000;
trace_mode = ignore_me + use_box;
player_speed.z = -trace (my.x, temp);
move_mode = ignore_you + ignore_passable;
ent_move(player_speed, nullvector);
if (mouse_left == 1)
{
ent_create (bullet_mdl, player.pos, shoot_bullet);
snd_play (bullet_wav, 50, 0);
while (mouse_left == 1) {wait (1);}
}
wait (1);
}
}

We don't need to see the player because we are in 1st person mode; the crosshair panel is placed in the center of the screen. The camera is placed at player's position and changes its pan and tilt by moving the mouse. The player inherits its pan and tilt from the camera and moves using the keys WSAD. The movement code includes gravity; we trace 1000 quants below player's feet and then we move the player with its feet on the ground. If we press the left mouse button (LMB) we create a bullet, a sound is played and then we wait until the mouse button is released because we want to disable autofire.

Let's see the code associated to the enemy:

action enemy
{
my.enable_impact = on;
my.enable_shoot = on;
my.enable_entity = on;
my.event = compute_shot_pos;
while (my.skill5 == 0)
{
ent_cycle ("idle", 0);
vec_for_vertex(temp, my, 222); // enemy's head vertex
my.head_pos = temp.z;
vertex_coords.x = my.head_pos;
vec_for_vertex(temp, my, 235); // enemy's belly vertex
my.middle_pos = temp.z;
vertex_coords.y = my.middle_pos;
vec_for_vertex(temp, my, 171); // enemy's leg vertex (one of the legs)
my.leg_pos = temp.z;
vertex_coords.z = my.leg_pos;
wait (1);
}
}

The enemy is sensitive to impact, shoot or other entities; if one of these events happens, it will run function compute_shot_pos. As long as the enemy hasn't been shot (skill5 = 0), it will stand still. I have used a single frame for "idle" but you can use a real "idle" animation here. I chose 3 key vertices for head, belly and leg using Med but you can choose as many as you want; their z coords are stored in head_pos (another name for skill1), middle_pos (skill2) and leg_pos (skill3). We need to get these values in a while loop because if the enemy moves (jumps, crawls, etc) these coords will change.

Ok, let's imagine that our bullet has hit the enemy -> function compute_shot_pos() will run:

function compute_shot_pos()
{
my.skill5 = 1;
vec_set(bullet_pos, you.pos);
wait (1);
my.event = null;

Skill5 will be set to 1, stopping the while loop in action enemy. We store bullet's coords before they get lost (before the bullet disappears), we wait for a frame and then we set my.event to null.

if (abs(bullet_pos.z - my.head_pos) < abs(bullet_pos.z - my.middle_pos)) // we've got a head shot, no need to check the legs
{
my.skill5 = 0;
while (my.skill10 < 80) // skip the last frame
{
ent_cycle("head", my.skill10);
my.skill10 += 4 * time;
wait (1);
}
}

If the distance between the bullet and the head vertex is smaller than the distance between the bullet and the middle vertex, we have got a head shot so we play the "head" animation.

else // middle or leg shot
{
if (abs(bullet_pos.z - my.middle_pos) < abs(bullet_pos.z - my.leg_pos)) // middle shot
{
my.skill10 = 0;
while (my.skill10 < 80) // skip the last frame
{
ent_cycle("middle", my.skill10);
my.skill10 += 2 * time;
wait (1);
}
}
else // leg shot
{
my.skill10 = 0;
while (my.skill10 < 80) // skip the last frame
{
ent_cycle("leg", my.skill10);
my.skill10 += 4 * time;
wait (1);
}
}
}
}

If the distance between the bullet and the head vertex is bigger than the distance between the bullet and the middle vertex, it could be a middle (belly) shot or a leg shot so we play the correct animation. I have animated the model so beware... you'll see some scary stuff!

The last two functions create the bullets and remove them - here's the code:

function shoot_bullet()
{
my.enable_entity = on;
my.enable_block = on;
my.event = remove_bullet;
my.passable = on;
my.pan = player.pan;
my.tilt = camera.tilt;

The bullet is sensitive to other entities and level blocks. When it collides with another entity (our enemy) or a level block, it will be removed after a frame, allowing us to get its coords before it disappears. The bullet has the same orientation with the player and the camera.

my.skill20 = 0;
my.skill1 = 300;
my.skill2 = 0;
my.skill3 = 0;
my.skill1 *= time;

while (my.skill20 < 250)
{
if (my.skill20 < 1) // don't collide with the player
{
my.passable = on;
}
else
{
my.passable = off;
}
my.skill20 += 1 * time;
ent_move (my.skill1, nullvector);
wait (1);
}
remove_bullet();
}

function remove_bullet()
{
wait (1);
ent_remove(me);
}

We set skill20 to zero and then we increase this value inside a while loop until it reaches 250. If the bullet hasn't hit anything when skill20 >= 250, it will be removed because we don't want to waste cpu power with it. Skill1..3 are used as a local var to move the bullet. A small trick: the bullet is created inside the player model so it has to be made passable at the beginning because otherwise it would collide with the player. When skill20 >= 1 we can assume that the bullet is far enough and then we will make it impassable.

You can use more key vertices if you like; you could add another key vertex to the other leg, 2 more on the arms, etc.



-ich mache gerade eine script-Datenbank, die 3DGS-scripte verwalten kann, werde wohl die AUM-Version mit aufnehmen.


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