PDA

View Full Version : Weapon Ammo


alexx860
11-21-2004, 10:15 AM
Hi all
I want know, how make unlimited ammo for a weapon, like the blaster dl44. Not showing 999, but just -- in the ammo indicator in the lower left of the sreen

thx in advance
alexx

Barada
11-21-2004, 02:08 PM
should be in bg_weapons.c

just zero out energyPerShot and altEnergyPerShot for the specified weapon.

alexx860
11-21-2004, 08:45 PM
OK, the weap no longer take ammo when firing, but how much ammo must I set ?
client->ps.stats[STAT_WEAPONS] |= (1 << WP_BOWCASTER);
client->ps.stats[STAT_WEAPONS] |= (1 << WP_DISRUPTOR);
client->ps.weapon = WP_BOWCASTER;
client->ps.ammo[AMMO_POWERCELL] = -1;

with -1, there is no ammo counter at all, but I can't select weapon (because there are out of ammo, for the game)
so where can I change when a weapon is "out of ammo", and disable it for my two weaps

thx in advance
alexx

Barada
11-22-2004, 01:21 AM
I was able to obtain this by the change I mentioned in bg_weapons, but I also have a client compile. Try compiling client.

Yeah, that sucks if you're trying to go serverside only mod, I know. But, it works.

Just to test it, I removed my mods cgame, and the weapons sure enough are back to 999, and not -- in the ammo counter.

alexx860
11-22-2004, 10:48 AM
OK i've tried to compile the cgame, but when I start the game, when I join, it's very laggy, I can't move at all, but when I remove the cgame, it dont lag

whats the problem

Thx for your answers
alexx :jawa

razorace
11-22-2004, 12:28 PM
Did you make any other changes to the bg code?

alexx860
11-22-2004, 08:05 PM
dont remember exactly but yes I think, why?

alexx860
11-23-2004, 08:35 AM
err i think there is a problem.. I've tried to compile WITHOUT any change AT ALL at the code.. (i use the universal jka sdk) and it's always laggy. It's just when i join players, but when i'm spectator, there is no problems

thx

alexx

alexx860
11-23-2004, 12:29 PM
razorace told me to break the code when the bug occurs, and it stop here :
float powf ( float x, int y )
{
float r = x;
for ( y--; y>0; y-- )
r = r * r;
return r;
}
(in game/q_math.c)

The only place where i've find 'powf' are in cg_view.c
else if (cg_thirdPersonTargetDamp.value>=0.0)
{
// Calculate the difference from the current position to the new one.
VectorSubtract(cameraIdealTarget, cameraCurTarget, targetdiff);

// Now we calculate how much of the difference we cover in the time allotted.
// The equation is (Damp)^(time)
dampfactor = 1.0-cg_thirdPersonTargetDamp.value; // We must exponent the amount LEFT rather than the amount bled off
dtime = (float)(cg.time-cameraLastFrame) * (1.0/(float)CAMERA_DAMP_INTERVAL); // Our dampfactor is geared towards a time interval equal to "1".

// Note that since there are a finite number of "practical" delta millisecond values possible,
// the ratio should be initialized into a chart ultimately.
ratio = powf(dampfactor, dtime);

// This value is how much distance is "left" from the ideal.
VectorMA(cameraIdealTarget, -ratio, targetdiff, cameraCurTarget);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
}

and

else if (dampfactor>=0.0)
{
// Calculate the difference from the current position to the new one.
VectorSubtract(cameraIdealLoc, cameraCurLoc, locdiff);

// Now we calculate how much of the difference we cover in the time allotted.
// The equation is (Damp)^(time)
dampfactor = 1.0-dampfactor; // We must exponent the amount LEFT rather than the amount bled off
dtime = (float)(cg.time-cameraLastFrame) * (1.0/(float)CAMERA_DAMP_INTERVAL); // Our dampfactor is geared towards a time interval equal to "1".

// Note that since there are a finite number of "practical" delta millisecond values possible,
// the ratio should be initialized into a chart ultimately.
ratio = powf(dampfactor, dtime);

// This value is how much distance is "left" from the ideal.
VectorMA(cameraIdealLoc, -ratio, locdiff, cameraCurLoc);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
}

I tried to replace those two files by the originals one of the SDK, nothing

thx in advance
alexx

razorace
11-23-2004, 05:57 PM
Logic seems to indicate that there's something wrong with the dtime getting way too big. I'd do some breaking to figure out what the heck is happening there.

ensiform
11-23-2004, 05:59 PM
um if u got the weapons too use infinite ammo, all that needs fixing is the hud stuff in cg_draw or even the actual hud menu file.

Originally posted by alexx860
err i think there is a problem.. I've tried to compile WITHOUT any change AT ALL at the code.. (i use the universal jka sdk) and it's always laggy. It's just when i join players, but when i'm spectator, there is no problems

thx

alexx

umm this happens when u play base also not much u can do. same when u die sometimes and when someone joins/connects. although if your cgame is being weird i dunno, may i also suggest not messing with q_* files that can be dangerous :) only thing i can think of about ur prob is that u added something u maybe weren't supposed too and causes too much lag when sending maybe ?

alexx860
11-23-2004, 11:41 PM
I know damp, cameradamp, etc are for the ThirdPerson view, so i tested to enter the game in first person view, and, it's not laggy, it's normal, but when I toggle in third person view, it's laggy again
(by laggy I mean I cant move, because the image uptdate every ~30sec, like that..)

Thx in advance, I'll search too
alexx

alexx860
11-24-2004, 05:16 AM
Ive solved my problem by unzip the universal sdk, and paste the original sdk in the same folder, with replacing files. I've paste the modified files one by one, and now it works

Thanks for your help all
alexx

razorace
11-24-2004, 09:45 AM
interesting. Sounds like the universal SDK is broken.

ensiform
11-24-2004, 10:07 AM
my universal sdk works just fine with cgame, game, and ui.