Bulletholes


 

Posted by X-Arch (207.214.7.*) on February 26, 1999 at 16:01:24:

TUTORIAL SUBJECT: BulletHoles
AUTHOR: X-Arch
NOTES: this is used for the fire_lead function...i.e. chaingun,machingun,shotgun's...it can be implemented into other fire functions the same as below...

okies...now...this isnt hard./...BUT you will have too make a model and a skin for the acctual bullethole...that isnt too hard just get MDL viewer or seomthing and create one...once you have that model..simply follow these steps...

STEP 1:
Put the model you just made in this directory under your mod's directory...e.g.
quake2/mymod/models/misc/bhole/tris.md2
that is the complete dir that i will be using for this tutorial..of corse you will see you can change that easily..

STEP 2:
Now we get into the coding....open up g_weapon.c and find the static void fire_lead();
now at the top were all the declarations are...add this:

edict_t *bhole;

Now travel down a little inside fire_lead(); and find something that looks like this:
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_BUBBLETRAIL);
gi.WritePosition (water_start);
gi.WritePosition (tr.endpos);
gi.multicast (pos, MULTICAST_PVS);
}
NOW after that is CLOSED OFF with the '}' simply add this code:

if (!((tr.surface) && (tr.surface->flags & SURF_SKY)))
{

if (!((tr.ent != self) && (tr.ent->takedamage)))


{
bhole = G_Spawn();
VectorCopy (tr.endpos, bhole->s.origin);
vectoangles (tr.plane.normal, bhole->s.angles);
bhole->movetype = MOVETYPE_NONE;
bhole->clipmask = MASK_SHOT;
bhole->solid = SOLID_BBOX;
VectorClear (bhole->mins);
VectorClear (bhole->maxs);
bhole->s.modelindex = gi.modelindex ("models/misc/bhole/tris.md2"); //change this //if you wnt another model too be used for your bullethole
bhole->s.renderfx = RF_TRANSLUCENT;
bhole->owner = self;
bhole->think = G_FreeEdict;
bhole->nextthink = level.time + 10;
bhole->classname = "bholes";

gi.linkentity (bhole);
}
}

and thats it...we have a fully functional bullethole..unless ive left something out
well if you have any questions then just ask...and also with the skin of your bullethole u can make it transperent as well....i.e. u can make kool looken rigid edges so the hole looks real and not some squar or circle...well any questions just ask...l8tr