Author Topic: another problem for making weapon  (Read 11114 times)

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
another problem for making weapon
« 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
Code: [Select]
/*
======================================================================

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
Code: [Select]
/*
=================
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
Code: [Select]
{
    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
Code: [Select]
#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?

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Re: another problem for making weapon
« Reply #1 on: November 04, 2008, 02:06:28 am »
You need to add a few things to bg_public.h, in particular a few of the enums.

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #2 on: November 04, 2008, 02:13:14 am »
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'
« Last Edit: November 04, 2008, 02:26:02 am by Chronoslicer »

doomagent13

  • Posts: 506
  • Turrets: +18/-18
Re: another problem for making weapon
« Reply #3 on: November 04, 2008, 04:57:03 am »
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.

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #4 on: November 04, 2008, 06:46:21 am »
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 )
« Last Edit: November 04, 2008, 08:27:57 am by Chronoslicer »

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #5 on: November 04, 2008, 09:47:21 am »
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

Quote
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,

den i placed my gauss rifle on lcannon's place

Quote
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?
« Last Edit: November 04, 2008, 09:53:15 am by Chronoslicer »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: another problem for making weapon
« Reply #6 on: November 04, 2008, 12:23:22 pm »
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

Quote
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,

den i placed my gauss rifle on lcannon's place

Quote
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.

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #7 on: November 04, 2008, 02:08:08 pm »
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

Quote
WP_MASS_DRIVER,
WP_LUCIFER_CANNON,
WP_SHOT_GUN,

den i placed my gauss rifle on lcannon's place

Quote
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

« Last Edit: November 04, 2008, 02:13:08 pm by Chronoslicer »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: another problem for making weapon
« Reply #8 on: November 04, 2008, 03:09:05 pm »
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)


Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #9 on: November 04, 2008, 03:22:24 pm »
ok. so u mean that i should use the cgame.qvm and the ui.qvm i compiled together with the game.qvm?

googles

  • Posts: 219
  • Turrets: +30/-19
Re: another problem for making weapon
« Reply #10 on: November 04, 2008, 04:15:44 pm »
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...

Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: another problem for making weapon
« Reply #11 on: November 04, 2008, 04:24:33 pm »
There is a patch which backports game, cgame and ui. (Thanks benmachine)
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #12 on: November 05, 2008, 02:15:54 am »
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?

googles

  • Posts: 219
  • Turrets: +30/-19
Re: another problem for making weapon
« Reply #13 on: November 05, 2008, 02:32:57 am »
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...

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #14 on: November 05, 2008, 02:39:28 am »
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?

googles

  • Posts: 219
  • Turrets: +30/-19
Re: another problem for making weapon
« Reply #15 on: November 05, 2008, 02:44:06 am »
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.

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #16 on: November 05, 2008, 02:52:09 am »
ok wow wtf. what if i use the backport901

Quote
backport901.patch: everything 1.1.0 compatible


will that work normally?

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #17 on: November 05, 2008, 03:17:13 am »
Fixed
« Last Edit: November 05, 2008, 06:56:42 am by Chronoslicer »

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #18 on: November 05, 2008, 10:29:18 am »
how do i make my weapon model come out ingame. cant seems to see my weapon model when i placed them in a .pk3
« Last Edit: November 05, 2008, 04:16:11 pm by Chronoslicer »

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #19 on: November 05, 2008, 04:25:52 pm »
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

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: another problem for making weapon
« Reply #20 on: November 05, 2008, 08:14:38 pm »
The Modify button has a purpose, you know.

Chronoslicer

  • Posts: 23
  • Turrets: +3/-3
Re: another problem for making weapon
« Reply #21 on: November 06, 2008, 01:10:54 am »
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