#1 2016-07-19 14:08:16

OilCityHevs
Member

Looking for A New Gun Mod

Hi there,

Just been getting into Tesseract after years of playing and modding Assualt Cube. I've seen alot of threads here talking about people having successfully added new weapons, or at least cloned the current weapons.

I am looking for someone who could upload their files for adding a new weapon in, even if its just a clone of one of the current ones, so I can set about changing even just the sound effect for one of them etc to add a little more variety. I'm not too good on anything technical so that's why I've asked for someone to share.

Kind regards,
Liam

Offline

#2 2016-07-19 15:09:09

chasester
Member

Re: Looking for A New Gun Mod

you want the model? or the code on how to change the weapon logic?

Offline

#3 2016-07-19 15:11:15

OilCityHevs
Member

Re: Looking for A New Gun Mod

Cheers for the reply chasester. I suppose both would be ideal, but I am wanting to add another weapon rather than just change the appearance of an existing.

The option for a third weapon is what I am after, even if its a duplicate of the pulse/rail. However a new model for it would be great.

Last edited by OilCityHevs (2016-07-19 15:12:18)

Offline

#4 2016-11-22 11:19:08

cavity search
Member

Re: Looking for A New Gun Mod

I would also like to add/mod/create new weapons.  Could someone point me to some sites to get me started.

Offline

#5 2016-11-22 14:37:03

chasester
Member

Re: Looking for A New Gun Mod

I dont know if there are any sites that can help. I can point you in the right direction though.

To modify weapons you will have to modify the source code. The source code is written in c++, so Im gonna assume you have a base understanding of programing in c++, if you dont you can just google c++ 101 or somethings of that nature and simply learn the basics. Modifying the weapons doesnt take much experience.

First thing we need to note, most the weapon script from sauerbraten, was removed (well commented out) in tessereact. So we can really only do basic things, without heavy modifications.

So the specs of our new weapon. We are gonna make a point-to-point weapon (meaning that it isnt a projectile, like the rail gun, so it arrives instantly), that fires every 300 millis, doing small amounts of damage. (This will be comparable to a machine gun).

So all the source code is under the scr directory. If you have windows or mac you can simply open the vcpp (windows) or xcode (mac) folder and press on the sln or prj file (if you dont have xcode or visual studio c++ you will need to download them first they are both free with an apple id or a windows id accordingly). (Google this if you have questions). If you have make you will need to download cmake, and a compiler, so code blockes. You can google how to build c++ files, or compilers for linux if you have questions.

SO NOW ONCE YOU HAVE THE PROJECTS UP AND RUNNING #thisistheezpart

Go to game.h
ln 131 (or there about)

enum { GUN_RAIL = 0, GUN_PULSE, NUMGUNS }; //we need to add our gun to the list so lets add 
some fancy name here
enum { ATK_RAIL_SHOOT = 0, ATK_RAIL_MELEE, ATK_PULSE_SHOOT, ATK_PULSE_MELEE, NUMATKS }; //here are the different attack types
-----------
enum { GUN_RAIL = 0, GUN_PULSE, GUN_MACHINE, NUMGUNS }; //this name is important so make it decriptive
enum { ATK_RAIL_SHOOT = 0, ATK_RAIL_MELEE, ATK_PULSE_SHOOT, ATK_PULSE_MELEE, ATK_MACHINE_SHOOT, ATK_MAHCINE_MELEE, , NUMATKS };

on ln 198 (or there about) we need to add sounds, but for now we are going to just use the pulse sound.
on ln 316 (or there about) we need to define how our gun works

static const struct attackinfo { int gun, action, anim, vwepanim, hudanim, sound, hudsound, attackdelay, damage, spread, margin, projspeed, kickamount, range, rays, hitpush, exprad, ttl, use; }

So what is happening here is we are declaring a static const stuct. This is a fancy way of saying we are only declaring this once and we are not gonna change it (so after this code runs we cant add any more guns or change the way these guns work (well directly any way).

attacks[NUMATKS] =
{
    { GUN_RAIL,  ACT_SHOOT, ANIM_SHOOT, ANIM_VWEP_SHOOT, ANIM_GUN_SHOOT, S_RAIL1,  S_RAIL2, 1300, 1, 0, 0,    0, 30, 2048, 1, 5000,  0, 0, 0 },
    { GUN_RAIL,  ACT_MELEE, ANIM_MELEE, ANIM_VWEP_MELEE, ANIM_GUN_MELEE, S_MELEE,  S_MELEE,  500, 1, 0, 2,    0,  0,   14, 1,    0,  0, 0, 0 },
    { GUN_PULSE, ACT_SHOOT, ANIM_SHOOT, ANIM_VWEP_SHOOT, ANIM_GUN_SHOOT, S_PULSE1, S_PULSE2, 700, 1, 0, 1, 1000, 30, 1024, 1, 5000, 15, 0, 0 },
    { GUN_PULSE, ACT_MELEE, ANIM_MELEE, ANIM_VWEP_MELEE, ANIM_GUN_MELEE, S_MELEE,  S_MELEE,  500, 1, 0, 2,    0,  0,   14, 1,    0,  0, 0, 0 }
};

So here are all the guns Notice the order of this lines up with the order of the guns static struct, so we will need to declare our variables in the same order

so lets add

attacks[NUMATKS] =
{
    { GUN_RAIL,  ACT_SHOOT, ANIM_SHOOT, ANIM_VWEP_SHOOT, ANIM_GUN_SHOOT, S_RAIL1,  S_RAIL2, 1300, 1, 0, 0,    0, 30, 2048, 1, 5000,  0, 0, 0 },
    { GUN_RAIL,  ACT_MELEE, ANIM_MELEE, ANIM_VWEP_MELEE, ANIM_GUN_MELEE, S_MELEE,  S_MELEE,  500, 1, 0, 2,    0,  0,   14, 1,    0,  0, 0, 0 },
    { GUN_PULSE, ACT_SHOOT, ANIM_SHOOT, ANIM_VWEP_SHOOT, ANIM_GUN_SHOOT, S_PULSE1, S_PULSE2, 700, 1, 0, 1, 1000, 30, 1024, 1, 5000, 15, 0, 0 },
    { GUN_PULSE, ACT_MELEE, ANIM_MELEE, ANIM_VWEP_MELEE, ANIM_GUN_MELEE, S_MELEE,  S_MELEE,  500, 1, 0, 2,    0,  0,   14, 1,    0,  0, 0, 0 },
    {GUN_MACHINE,  ACT_SHOOT, AMINM_SHOOT, AMIN_VWEP_SHOOT, AMIN_GUN_SHOOT, S_PULSE1, S_PULSE2, 300, 1, 20, 20, 0, 30, 2048, 1, 10000,0,0,0},
{ GUN_PULSE, ACT_MELEE, ANIM_MELEE, ANIM_VWEP_MELEE, ANIM_GUN_MELEE, S_MELEE,  S_MELEE,  500, 1, 0, 2,    0,  0,   14, 1,    0,  0, 0, 0 }
};

Note we add melee one more time, cuz this is melee when we have our machine gun out, (so technically you could change the way melee works based on which weapon was out :).

Lastly on ln 324 (or there about)
We have another static stuct (or class). This is basically for the model so cuz i dont wanna deal with making a model we will simply just use the pulserifle again.

static const struct guninfo { const char *name, *file, *vwep; int attacks[NUMACTS]; } guns[NUMGUNS] =
{
    { "railgun", "railgun", "worldgun/railgun", { -1, ATK_RAIL_SHOOT, ATK_RAIL_MELEE }, },
    { "pulse rifle", "pulserifle", "worldgun/pulserifle", { -1, ATK_PULSE_SHOOT, ATK_PULSE_MELEE } }
    { "pulse rifle", "pulserifle", "worldgun/pulserifle", { -1, ATK_MACHINE_SHOOT, ATK_MACHINE_MELEE } }
};

So this should work and change every thing out

I didnt test this so if you have any errors let me know (im sure it will take 10 seconds to debug :)

chasester

Offline

#6 2016-11-22 20:49:52

Hypernova^
Member

Re: Looking for A New Gun Mod

I didn't mod weapons much in Tesseract, but in Sauer, you will need to modify weapon.cpp to add trail/impact effects for it. For projectile weapons, you will need to modify server.cpp to let the server know of the new projectile. Don't forget about the AI code as well. Also, be careful of the guns enum list, in Sauer at least there is some nasty stuff in the game with logic being defined around a certain index range in the gun list (I hope in Tesseract there's not).
Game.cpp/h, ai.cpp/h, server.cpp are your playground. Do some searching over the project tree to see where the weapons are mentioned.

Last edited by Hypernova^ (2016-11-22 20:51:55)

Offline

Board footer