|
posted 09-03-98 8:51 PM CT (US)
Title: MediKits Conversion
Difficulty: Easy to Moderate
By: Philip (aka Maj.Bitch)
Email: peblair@gv.net // please report any bugs(??)
Date: 8-31-98
Note: Please give credit where credit is due.
=============================================================
This is a modification of the 'Exploding Health Boxes' tutorial
originally posted on QDevels by: Mark "Grey" Davies. Many thanks
to him for his originality and inspiration.
GREAT for getting
even with 'health greedy' players.
About:
In this modification, the healh kits are converted to other medic
kits (of higher value) when a player who is already at or above
100 health units attempts to 'pickup' more health by running over
health kits. In this instance, the 10 unit health kits explode
into 10 (2 unit stimpaks) which bounce and scatter about in
random directions. These can then be picked up by other players but
the player who was greedy can't pick these up!! The 25 unit kits
are converted to a 100 unit mega health which bounces around in
a random direction before settling down. Again, other players can
pick up the new health but the initiating player cannot!! That'll
teach those health greedy bastards!!
=============================================================
================= G_ITEMS.C MODIFICATINS ====================
=============================================================
Insert the following
code at the very top of Pickup_Health()
// if health >
max then explode into Mega or Stimpaks
if (!(ent->style & HEALTH_IGNORE_MAX))
if (other->health >= other->max_health) {
spawn_health_paks(ent,other); // spawn stimpaks
if (!(ent->spawnflags & DROPPED_ITEM))
SetRepawn(ent, 20); /* respawn quicker than normal */
return true; }
=================
At a point above the
Pickup_Health() function add the following
new function.
void
spawn_health_paks(edict_t *ent, edict_t *other) {
trace_t tr;
gitem_t *item=NULL;
edict_t *dropped=NULL;
vec3_t offset={0,0,0};
int i,k,speed=10;
vec3_t spray[] = { { 25, 00, 40 },
{ 17, -17, 40 },
{ 00, -25, 40 },
{ -17, -17, 40 },
{ -25, 00, 40 },
{ -17, 17, 40 },
{ 00, 25, 40 },
{ 17, 17, 40 },};
vec3_t forward = { 5.0, 5.0, 5.0 };
vec3_t right = { 5.0, 5.0, 5.0 };
vec3_t up = { 5.0, 5.0, 5.0 };
vec3_t dir = { 0.0, 0.0, 0.0 };
if (ent->count ==
10)
k=10; // explode small health box into 10 stimpaks
else
k=1; // explode large health box into 1 Mega Health
for(i=1; i <= k;
i++) {
VectorSet(offset, spray[i-1][0], spray[i-1][1], spray[i-1][2]);
offset[0] += ((crandom()*16.0) - 8.0);
offset[1] += ((crandom()*16.0) - 8.0);
offset[2] += ((crandom()*16.0) - 8.0);
vectoangles(offset, dir);
AngleVectors(dir, forward, right, up);
speed += (crandom()*10.0);
// Spawn the Item..
dropped = G_Spawn();
dropped->owner = other;
// Set Vector
Positioning Info.
VectorSet(dropped->mins, -15, -15, -15);
VectorSet(dropped->maxs, 15, 15, 15);
G_ProjectSource(ent->s.origin, offset, forward, right,
dropped->s.origin);
tr = gi.trace(ent->s.origin, dropped->mins, dropped->maxs,
dropped->s.origin, ent,
CONTENTS_SOLID);
VectorCopy(tr.endpos, dropped->s.origin);
VectorScale(offset, speed, dropped->velocity);
dropped->velocity[2] = 300; // same as grenade bounce velocity.
if
(ent->count==10) {
dropped->count = 2; // 2 = Stimpak Health Increase
dropped->style = HEALTH_IGNORE_MAX;
dropped->model = "models/items/healing/stimpack/tris.md2";
} // if
else {
dropped->count = 100; // 100 = Mega Health Increase
dropped->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
dropped->model = "models/items/mega_h/tris.md2";
} // else
gi.setmodel(dropped,
dropped->model); // set the model
gi.soundindex("items/s_health.wav"); // make stimpak popping sound
// set Item list
info..
item = FindItem("Health");
dropped->classname = item->classname;
dropped->item = item;
// Special
Characteristic Flags..
dropped->spawnflags = DROPPED_ITEM;
dropped->solid = SOLID_TRIGGER;
dropped->movetype = MOVETYPE_BOUNCE;
dropped->s.renderfx = RF_GLOW;
dropped->s.effects = item->world_model_flags;
dropped->s.effects |= EF_COLOR_SHELL;
// Set think &
touch functions..
dropped->touch = drop_temp_touch;
dropped->think = G_FreeEdict;
dropped->nextthink = level.time + 30.0; // 30 sec timer
gi.linkentity(dropped);
} // for
}
=============================================================
That's all. Very
Simple but GREAT mod! Try it!!
regards,
Philip
aka Maj.Bitch
|