Dropping ammo / medkits


(H.Potter) #1

Hi,

for everyone, who want medkits and ammo packs dropped, when going into limbo:

Add:


		if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
				Weapon_MagicAmmo( self );
				Weapon_MagicAmmo( self );
		}
		else if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC) {
				Weapon_medic( self );
				Weapon_medic( self );
		}

into g_combat.c, into function TossClientItems, below “G_DropWeapon( self, primaryWeapon );”

Have fun :).

Greets
H. Potter

PS: The direction isn’t very nice, but maybe i (or someone else changes that).


(bacon) #2

I’ve slightly altered it so it drops an amount based on the current skill level of the field ops/medic


int i, drop;
	if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
		drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9;
		for( i = 0 ; i < drop ; i++ ) {
			Weapon_MagicAmmo( self );
		}
	} else if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC) {
		drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;
		for( i = 0 ; i < drop ; i++ ) {
			Weapon_Medic( self );
		}
	}

Maybe it shouldn’t have the field ops dropping more but the medic should, since you need more of an effort to kill a level4 medic than a level1 medic.


(Lanz) #3

drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;

Wow! You wanna drown the corpse in packets? :slight_smile:


(Seph64) #4

This is nice, I am going to implement it in the next version of my mod. :slight_smile: Or why not I just make a CVar to toggle it on and off?


(sniser) #5

Take note that this still drains the charge bar, possibly even into the negative… maybe clone the two weapon_* functions and remove the charge bar drain from the copies?


(Seph64) #6

Few things seem to be wrong with H.Potter’s code.

the m in Weapon_Medic needs to be in caps,

second: You’ll have to input this in g_local.h:


void Weapon_Medic( gentity_t *ent );
void Weapon_MagicAmmo( gentity_t *ent );

under the g_combat.c section, I got nothing but errors otherwise.

Hmm, H.Potter’s code does not work too well though. I’ll try to see if I can get Bacon’s to compile though


(H.Potter) #7

Hi, i never said that i worked well. The Packs are dropped in the same direction, as the weapon. What im doing, right now, is copying the Weapon_MagicAmmo and modifing it the direction, the packs pop and to remove the draining.

Should work much better than.

Oh, just realizes, that you are right with the M, was a copy and paste error of a draft, sorry.

Greets
H. Potter


(bacon) #8

Try this for no draining.

int i, drop, chargetime;
if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) { 
		chargetime = self->client->ps.classWeaponTime;
		self->client->ps.classWeaponTime = 0;
		drop = 1 + (self->client->sess.skill[SK_SIGNALS] * 2);
		for( i = 0 ; i < drop ; i++ ) { 
			Weapon_MagicAmmo( self ); 
		} 
		self->client->ps.classWeaponTime = chargetime;
	} else if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC) { 
		chargetime = self->client->ps.classWeaponTime;
		self->client->ps.classWeaponTime = 0;
		drop = 1 + (self->client->sess.skill[SK_SIGNALS] * 2);
		for( i = 0 ; i < drop ; i++ ) { 
			Weapon_Medic( self ); 
		} 
		self->client->ps.classWeaponTime = chargetime;
	}

(*Shadow* Commando) #9

How can i prevent it from shooting to the other side of the map. Because it shoots to the point his crosshair is pointing to.
So sometimes it shoots really far away.
Can you make it fall next to the weapon, or at the side of the head? And how?


(LogSplitter) #10

I particlary looking for a setting on a server I played on were the medics couldn’t

heal them selfs just others. I would like not to deal with these so call "rambo

medics" They are very disruptive to have an unfair opponent if you are not

one.


(Lanz) #11

It would be better to tone down the upgrades instead, that’s what make things bad. I mean did anyone experience rambo medics in RTCW? First I would get rid of the extra ammo pack and then perhaps lower the max health a bit. The problem with XP is that it breaks the dependace of other classes in some ways.


(carnage) #12

lanz has a point, in every game i have played the medic is given week weapons and no ammo because of the great adavatage of healing

there were rambo medics in rtcw (i was one of them) but in ET as the medics become even less dependant on the filed ops they can just go on a killing spree.

i supose the theory is that if a medic can win 3/5 fights with full health then
he will score 3 kills to 2 deaths as he will go into every fight with full health, so if someone could get to 5/6 chance of wining at full health then medics start getting 5 kills to 1 death

if the same player used a different class then he should die mutch sooner as he would run out of health


(Demolama) #13

carnage… it doesnt matter… I purposed an ammo limit to etpro for medics… the people hated the idea claiming “omg you mean you want medics to rely on fieldops? lame”

http://bani.anime.net/banimod/forums/viewtopic.php?t=5161&start=15

just give up… no change will even happen to the medic class… especially if the change idea is from RTCW

if anything is going to happen to the medic class it will more than likely be the removal of the self regen or their ability to pack themselves… defeating the whole purpose of this class… which is to revive teammates.


(Lanz) #14

ETPro is dominating the mod scene yes, but this is still a mod forum and those implementations would take any modders 5 minutes to implement. Would it get played? Well that depends on the rest of the mod. As long as a mod has a small following, it’s enough.


(dark-tim) #15

when i compile i get this “undeclared identifier” error (i know it’s noob) but

int i, drop, chargetime;

is added on the top of the code :S i don’t get it


(carnage) #16

medics relying on filed ops is not lame… many rambo medics would revive teamtes but cos they are so hard to kill they can get way away fromn there team into enemy teritory, if medics had to stay neer filed ops then they would be near the ppl who needed reviving and some ppl would revive them.

but a samll mod like that would never take off on a large scale as most players couldnty be bothered with hastle for sutch a small change. it would need to be in a larger mod where lots of changes have been made giving the players a reason do download


(dvldrmmr) #17

Sorry to revive an old thread, but I was adding this to my mod and found a way to make the ammo/med packs go in different directions(a circle around the player actually):

take bacons original code

int i, drop;
   if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
      drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9;
      for( i = 0 ; i < drop ; i++ ) {
         Weapon_MagicAmmo( self );
      }
   } else if (self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC) {
      drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;
      for( i = 0 ; i < drop ; i++ ) {
         Weapon_Medic( self );
      }
   }

and change it to this:

int i, drop;
// x and y components of the direction vector
float x, y;
// the item (med/ammo pack)
gitem_t *item;
// direction vector
vec3_t dir;
if( self->client->ps.stats[STAT_PLAYER_CLASS] == PC_FIELDOPS) {
    // find the right item
    item = BG_FindItem( self->client->sess.skill[SK_SIGNALS] >= 1 ? "Mega Ammo Pack" : "Ammo Pack" );
    drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9;
} else if(self->client->ps.stats[STAT_PLAYER_CLASS] == PC_MEDIC ) {
    // find the right item
    item = BG_FindItemForClassName("item_health");
    drop = (self->client->sess.skill[SK_FIRST_AID] / 4) * 9;
} else {
    item = 0;
}
if( item ) {
    // do this for all the packs
    for( i = 0; it < drop; i++ ) {
        // find the x component
        x = 300 * cos( DEG2RAD(360 / drop) * i );  
        // find the y component
        y = 300 * sin( DEG2RAD(360 / drop) * i );
        // set the direction vector
        VectorSet( dir, x, y, 5 );
        // launch the pack
        ent2 = LaunchItem( item, self->r.currentOrigin, dir, self->s.number );
        // so it will go away after a while like normal packs do
        ent2->think = MagicSink;
        ent2->nextthink = level.time + 30000;
    }
}

Now you’ll have a ring of packs around the dead player.

dvl

EDIT:
you need to add this in g_local.h

void MagicSink( gentity_t *self );

(*Shadow* Commando) #18

You can also make a command for the amount of packages that are dropped.

Just change:

drop = (self->client->sess.skill[SK_SIGNALS] / 4) * 9; 

To:

drop = g_droppackets.integer;

Same for medicpacks
You of course need to make a command for it.


(*Shadow* Commando) #19

There is only one bug in your code.
The ammo packs that are dropped don’t give ammo.


(jaybird) #20

I’ve got a simple addition to handle dropping both, but I’m not home at the moment. I’ll post this later when I get home. There’s a couple extra steps for ammo…