|
Ugly Bulletholes
#279802
07/19/09 11:52
07/19/09 11:52
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
Hello Guys! I finally got my 3rd erson gun but there are so many problems . Please don´t say that my View is ugly - I know, it is just for testing. Here are the pics: Ugly! Wrong! You can see that there are really ugly and wrong. Code:
c_trace(temp2, temp, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX);
ent_create("bullet_hole.tga",target,bullet_hole);
Calls the bullet hole and creates it at the target position. Bullet Hole Code:
function bullet_hole() //die Funktion die die Einschusslöcher erstellt
{
vec_to_angle(my.pan, normal); //setzt den Winkel auf nciht der Camera anpassen
my.scale_x = 1; //scaliert das Bild
my.scale_y = 1;
my.scale_z = 1;
set(me, OVERLAY | TRANSLUCENT | PASSABLE); //setzt das Bild auf PASSABLE, Durchsichtig und Schwar ausblenden
my.alpha = 100; //setzt die duchsichtig keit auf 0
wait(-5); //warte 5 sekunden
while (my.alpha > 0) //solange das bild weniger als 100 % durchsichtig ist
{
my.alpha -= 0.25*time_step; //erhöhe die durchsichtigkeit
wait(1);
}
ptr_remove(me); //entferne das Bild
}
Hope you understand the code ! Nearly every reply is a good reply!
|
|
|
Re: Ugly Bulletholes
[Re: Rei_Ayanami]
#279826
07/19/09 14:16
07/19/09 14:16
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
It got Worser ! Iamge: why is that so? Weapon Code:
function pistol_shoot() //die Schuss Funktion, solange ich nciht wieß wieviele waffen es gibt bleibt es bei der Pistole
{
VECTOR temp, temp2; //2 lokale Vectoren
var i; //lokale hochzähl-variable
temp.x = mouse_pos.x; //setzt lokalen Vector 1 X auf die mouse x position
temp.y = mouse_pos.y; //setzt lokalen Vector 1 Y auf die mouse y position
temp.z = camera.clip_far; //setzt lokalen Vector 1 Z auf die Fern enfernung der Camera
vec_for_screen(temp, camera); //konvertiert die durch den Vektor angegebenen XY-Bildschirmkoordinaten in eine Welt-Position
you = player; //du bist der Spieler
vec_for_vertex(temp2, pistol, 797); //setzt lokalen Vector 2 (Temp 2) auf die mündung
vec_sub(temp, temp2); //berechnet den Winkel
c_trace(temp2, temp, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX); //traced von vector 1 zu vector 2
gun_flash();
if(you!=NULL) //wenn du Irgenwas bist auser die Level Wand
{
wait(1); //noch nichts
}
else
{
ent_create("bullet_hole.tga",target,bullet_hole); //sonst erstelle das Einschussloch an der stelle des hinschießens
// effect(funkenspezial,10,target,nullvector); // Funkeneffekt am Ziel
}
return; //beendet
}
|
|
|
Re: Ugly Bulletholes
[Re: Rei_Ayanami]
#279831
07/19/09 14:55
07/19/09 14:55
|
Joined: Aug 2008
Posts: 18 Germany
Der_Kekser
Newbie
|
Newbie
Joined: Aug 2008
Posts: 18
Germany
|
warum benutzt du keine Decals? dann kann die function bullet_hole weg und in der function pistol_shoot ersetzt du
ent_create("bullet_hole.tga",target,bullet_hole);
mit:
ent_decal(NULL,"bullet_hole.tga",0,0);
und bei dem c_trace noch SCAN_TEXTURE als mode angeben.
|
|
|
Re: Ugly Bulletholes
[Re: Rei_Ayanami]
#279833
07/19/09 15:12
07/19/09 15:12
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
try to add the normal to the position of the bullet hole or better: use decals for your bulletholes About the wrong position of the bullet holes: you are defining a position FAAR behind that wall and if you draw a line from the gun to that position, it crosses the wall on a different part. instead use a trace from the cursor to a position way behind the cursor to get the position of the shot. for determine if you hit an enemy you need a second trace this code should to the job. -did not tested it- enjoy! edit: habs SCAN_TEXTURE vergessen..danke der kekser =]
void createBullethole(VECTOR* pos, VECTOR* n, int chunk){
vec_set(hit.x, pos);
vec_set(hit.nx, n);
hit.chunk = chunk;
hit.model = NULL;
PARTICLE* p = ent_decal(NULL, "bullet_hole.tga", 8, random(360));
//here you can set up everything for the bullet hole, like a event and a material
p.lifespan = 160; //remove after 10 secs
}
void pistol_shoot(){
VECTOR from, to;
//mouse_spot to get the middle of the crosshair
vec_set(from, vector(mouse_pos.x + mouse_spot.x, mouse_pos.y + mouse_spot.y ,0);
vec_set(to, from);
to.z = camera.clip_far;
vec_for_screen(from, camera);
vec_for_screen(to, camera);
c_trace(from, to, IGNORE_PASSABLE | IGNORE_ME | IGNORE_YOU | USE_POLYGON | SCAN_TEXTURE);
int holeChunk = hit.chunk;
VECTOR holePos;
vec_set(holePos, target);
VECTOR holeN;
vec_set(holeN, normal);
vec_set(to, target);
vec_for_vertex(from, pistol, 797);
c_trace(from, to, IGNORE_PASSABLE | IGNORE_ME | USE_POLYGON | ACTIVATE_SHOOT | GET_HITVERTEX);
if(you==NULL){//hit nothing
createBullethole(holePos, holeN, holeChunk);
}
else{
your.health -= PISTOL_DAMAGE;
}
}
Last edited by Scorpion; 07/19/09 15:16.
|
|
|
Re: Ugly Bulletholes
[Re: Rei_Ayanami]
#279845
07/19/09 15:53
07/19/09 15:53
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
@Der_Kekser: Ähh entschuldige mich wenn ich falsch liege aber ist die ent_decal function nicht eigendlich nur für A7 7.10 (Commercial,Professional) verfügbar? Steht jedenfalls so im Manual !http://www.conitec.net/beta/ent_decal.htm
Dem anschein nach nutzt er allerdings Lite-C FREE! Sorry falls ich falsch liege ^^
3D-Gamestudio A8 - Commercial
|
|
|
|