Tremulous Forum
Mods => Modding Center => Topic started by: Chronoslicer on November 04, 2008, 01:09:15 am
-
ok you see, i've been trying to make a new weapon called the Gauss Rifle and i'm getting some error .
g_weapon.c
/*
======================================================================
GAUSS RIFLE
======================================================================
*/
void gaussFire( gentity_t *ent )
{
gentity_t *m;
m = fire_gauss( ent, muzzle, forward );
// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
g_missile.c
/*
=================
fire_gauss
=================
*/
gentity_t *fire_gauss( gentity_t *self, vec3_t start, vec3_t dir )
{
gentity_t *bolt;
VectorNormalize (dir);
bolt = G_Spawn();
bolt->classname = "gauss";
bolt->nextthink = level.time + 10000;
bolt->think = G_ExplodeMissile;
bolt->s.eType = ET_MISSILE;
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_GAUSS_RIFLE;
bolt->s.generic1 = self->s.generic1; //weaponMode
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = GRIFLE_DMG;
bolt->splashDamage = 0;
bolt->splashRadius = 0;
bolt->methodOfDeath = MOD_PRIFLE;
bolt->splashMethodOfDeath = MOD_PRIFLE;
bolt->clipmask = MASK_SHOT;
bolt->target_ent = NULL;
bolt->s.pos.trType = TR_LINEAR;
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
VectorScale( dir, GRIFLE_SPEED, bolt->s.pos.trDelta );
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy( start, bolt->r.currentOrigin );
return bolt;
}
bg_misc.c
{
WP_GAUSS_RIFLE, //int weaponNum;
GRIFLE_PRICE, //int price;
( 1 << S3 ), //int stages
SLOT_WEAPON, //int slots;
"grifle", //char *weaponName;
"Gauss Rifle", //char *weaponHumanName;
GRIFLE_CLIPS, //int maxAmmo;
GRIFLE_MAXCLIPS, //int maxClips;
qfalse, //int infiniteAmmo;
qtrue, //int usesEnergy;
GRIFLE_REPEAT, //int repeatRate1;
0, //int repeatRate2;
0, //int repeatRate3;
GRIFLE_RELOAD, //int reloadTime;
GRIFLE_K_SCALE, //float knockbackScale;
qfalse, //qboolean hasAltMode;
qfalse, //qboolean hasThirdMode;
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qtrue, //qboolean purchasable;
qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
tremulous.h
#define GRIFLE_PRICE 550
#define GRIFLE_CLIPS 5
#define GRIFLE_MAXCLIPS 5
#define GRIFLE_REPEAT 3500
#define GRIFLE_K_SCALE 1.0f
#define GRIFLE_RELOAD 2000
#define GRIFLE_DMG HDM(170)
#define GRIFLE_SPEED 2000
but it gave me an error saying WP_GAUSS_RIFLE is undeclared.
and abit out of this topic:
how do i make a new projectile model?
-
You need to add a few things to bg_public.h, in particular a few of the enums.
-
i've fixed the above porblem but...
another problem.
it gave me an error saying
src/game/g_weapon.c:494: operands of = have illiegal types `pointer to struct gentity_s' and `int'
-
Sorry, cant help with that because I haven't bothered piecing together your code additions. I suggest you go find that line and start there.
-
nothing seems to be wrong with the code but it just keep giving me error
the error is pointing to m = fire_gauss ( ent, muzzle, forward )
-
oh yea..heres another problem..when i create a new weapon and defining it at bg_public.c they did not add them. instade they PlACE them on the position where the old one is at
lets say i put default is
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
den i placed my gauss rifle on lcannon's place
WP_MASS_DRIVER,
WP_GAUSS_RIFLE,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
and whenever i used shotgun i got error and the server shut downed. there must be some stuff to define the amount of weapons in a list or something?
-
nothing seems to be wrong with the code but it just keep giving me error
the error is pointing to m = fire_gauss ( ent, muzzle, forward )
The problem is that you have no prototype for fire_gauss in any header (g_local.h would be appropriate). This means that the compiler thinks it returns an int, and then complains that it cannot store the int in an gentity_t pointer.
oh yea..heres another problem..when i create a new weapon and defining it at bg_public.c they did not add them. instade they PlACE them on the position where the old one is at
lets say i put default is
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
den i placed my gauss rifle on lcannon's place
WP_MASS_DRIVER,
WP_GAUSS_RIFLE,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
and whenever i used shotgun i got error and the server shut downed. there must be some stuff to define the amount of weapons in a list or something?
The bg_* files are compiled into both the game.qvm and cgame.qvm. When you change the weapon numbers in bg_public and play with a new cgame.qvm on an old game.qvm or vice versa you will get these problems.
-
nothing seems to be wrong with the code but it just keep giving me error
the error is pointing to m = fire_gauss ( ent, muzzle, forward )
The problem is that you have no prototype for fire_gauss in any header (g_local.h would be appropriate). This means that the compiler thinks it returns an int, and then complains that it cannot store the int in an gentity_t pointer.
oh yea..heres another problem..when i create a new weapon and defining it at bg_public.c they did not add them. instade they PlACE them on the position where the old one is at
lets say i put default is
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
den i placed my gauss rifle on lcannon's place
WP_MASS_DRIVER,
WP_GAUSS_RIFLE,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,
and whenever i used shotgun i got error and the server shut downed. there must be some stuff to define the amount of weapons in a list or something?
The bg_* files are compiled into both the game.qvm and cgame.qvm. When you change the weapon numbers in bg_public and play with a new cgame.qvm on an old game.qvm or vice versa you will get these problems.
1st issue ( error pointing to m = fire_gauss ) :
[solved] thanks for the help gimhael :D
2nd issue ( the weapon orderings ):
so you mean i have to change stuff from cgame so that it makes it compatible with the game.qvm im using right now. if so, where is it? cant seems to find it
-
You may not have to change the cgame source code, but the compiled cgame.qvm contains a copy of the bg_* modules, just like the game.qvm, and the whole system works correctly only when the BG_* functions work identically in cgame.qvm and game.qvm, so you have to compile and use a custom cgame.qvm matching the game.qvm.
I think you'll also need a custom ui.qvm when you want the new gun available in the armoury menu. (Though /buy gauss in console would work without a custom ui.qvm)
-
ok. so u mean that i should use the cgame.qvm and the ui.qvm i compiled together with the game.qvm?
-
You "might" have some problems with the cgame.qvm, since all the backport patches(that i have seen) either do only a cgame and ui backport, or a game backport. And no, you don't need to mod the ui.qvm to add a new weapon, just cgame and game...
-
There is a patch which backports game, cgame and ui. (Thanks benmachine)
-
ok. so now i've got a r1131 backport all patch. so you mean i apply this patch and re-code my gauss rifle and put both game.qvm and cgamq.qvm onto my server's vm folder to make it work?
-
Benmachine said that you would need to send the cgame and game so they can talk to each other. So you need to define a *real* mod instead of just using base...
-
Benmachine said that you would need to send the cgame and game so they can talk to each other. So you need to define a *real* mod instead of just using base...
i don't understand what you just said. can you please elaborate it?
-
mod-backport-r1131.patch: for mod makers, makes cgame, ui, game QVMs that work with 1.1 clients and each other, but not with their 1.1 counterparts (i.e. game.qvm will confuse 1.1 cgame.qvm: you will need to offer a download). You will also need to include the configs/ and ui/ directory in your pk3s.
Clients and servers do not compile unless you apply one of the above patches (there will be some overlap, which patch will offer to ignore).
The backported game, cgame, and ui won't work with the stock 1.1 game, cgame, and ui files. Therefore, you will need to pack up all the backported files into a pk3 and force downloads.
-
ok wow wtf. what if i use the backport901
backport901.patch: everything 1.1.0 compatible
will that work normally?
-
Fixed
-
how do i make my weapon model come out ingame. cant seems to see my weapon model when i placed them in a .pk3
-
and also i cant seems to let the armoury show the text on infopane.def which i have edited. i managed to let te weapon show on armoury though
-
The Modify button has a purpose, you know.
-
no one is replying and i've put fixed on there so most of the people who knows how to mod already read this and thought its fix. so i have to bump it