PDA

View Full Version : Where is the code for guns?!?


Azrael666
01-19-2004, 12:35 AM
Im trying to find the code for gun, but where sabers have their .sab files i can find nothing. Specifically i want to see if i can find how to make it so a lightsaber hittinga target causes the disintegration effect.

[ONE]Mushroom
01-20-2004, 02:58 PM
AFAIK, you need to code C to get that effect.

WP_DisruptorAltFire from g_weapon.c

Azrael666
01-20-2004, 03:31 PM
So wheres the actual code in assets?

Will puting WP_DisruptorAltFire 1 in the .sab file work?

I can do C if needed, working on it in Uni at the moment.

razorace
01-20-2004, 07:06 PM
It's the .dll files that controls that behavior. You'll need the SDK to be able to change anything inside them.

Azrael666
01-20-2004, 10:15 PM
I have the SKD kit, i dont know what to do withit or where to find these .dll files!

Azrael666
01-20-2004, 10:47 PM
Anyway, all i want is the code to make it so that when i kill someone with a saber, they disintegrate like with a kill from a disruptor. The best i have at the moment is replacing the shader for cuts on bodies with orange glow effect for the disruptor, which just look weird. I need to know either:

a. the code so that i can make kills from this saber disintergrate

or

b. where the code for the gun is kept, something more than just one files name, a file path within assets or something.

[ONE]Mushroom
01-21-2004, 07:13 PM
OK, firstly realise that modding the .dlls is not necessarily trivial. They are stored in assets3.pk3 (if you have patched), but you will need to recompile (possibly just jampgamex86.dll), and put in your mod directory.

It would be easier if you have MS Visual C++ 7, or at least MSVC6.

This (http://www.lucasfiles.com/index.php?s=&action=file&id=331) is the SDK you need. (IIRC there is also a modelling SDK).

Unzip it, go into the codemp directory it creates. Read the MakeAMod_readme.txt (not very helpful I'm afraid). The best intro I've read for Quake 3 engine modding is Code3Arena (http://www.planetquake.com/code3arena/index.shtml). Be aware though that JK:JA does not use QVMs, for reasons best known to Raven it uses .dll files for Windows and .so files for Linux.

Open up the project file in MSVC7, if you have MSVC6 there is a project converter here (http://www.arstdesign.com/articles/prjconverter.html) or here (http://www.codeproject.com/tools/prjconverter.asp) .

Open up g_weapon.c, find the function WP_DisruptorAltFire, and see why the disruptor disintegrates the target.

This seems to be the code:

if (traceEnt->client && preHealth > 0 && traceEnt->health <= 0 && fullCharge &&
G_CanDisruptify(traceEnt))
{ //was killed by a fully charged sniper shot, so disintegrate
VectorCopy(preAng, traceEnt->client->ps.viewangles);

traceEnt->client->ps.eFlags |= EF_DISINTEGRATION;
VectorCopy(tr.endpos, traceEnt->client->ps.lastHitLoc);

traceEnt->client->ps.legsAnim = preLegs;
traceEnt->client->ps.torsoAnim = preTorso;

traceEnt->r.contents = 0;

VectorClear(traceEnt->client->ps.velocity);
}

Include something similar in the right place in w_saber.c and rebuild the .dll

You may need to add more code to get it to work, but I'll leave that to you :)

Azrael666
01-21-2004, 08:04 PM
Hmm, well, im not sure i actually have to mess around with the weapons, i just wanted to understand the code. I guess the thing to do would be to create a new kind of saber in .dll, so now all saber have this effect. So the if statement would be for the type of lightsaber (maybe if sabername=disintegrator&& health <=0 then: or something)

At eany rate, i proably need that in the saber file with a different if statement. Bonza.

Azrael666
01-21-2004, 08:14 PM
BTW, will textpad be ok for this stuff?

[ONE]Mushroom
01-25-2004, 04:21 AM
You'll need a compiler (which I assume Textpad doesn't include), and preferably an Integrated Development Environment. You'll have to find (or create) project files / Make files yourself if you use anything other than MSVC6/7 though (although AFAIK you'd only need to build the server side game project).

DevC++ (http://www.bloodshed.net/devcpp.html) is a very popular free solution. Maybe someone has already created the project files you'd need for this; ask on the coding forum.