Jump to content

Home

Cvar Limit


Kyle098

Recommended Posts

hey i added like 23 new cvars,so the server can control the damage and velocity of each weapon,but when i compiled it and ran it,when i did create server,right before it loaded my monitor blinked a couple of times then it quit tyjhe program,then i removed like 18 of those cvars and it worked,is there a cvar limit that i reached,because i only added 23 cvars so far to jedimod1.2,if,someone is a good coder i can give them my source so they check it out,but only if i trus you(people like ask,dest...and so on i knoiw wont steal my source because they have been through someone stealing source.)

Link to comment
Share on other sites

There's a limit for one thing: server-to-client config string:

 

// the game guarantees that no string from the network will ever
// exceed MAX_STRING_CHARS
#define	MAX_STRING_CHARS	1024	// max length of a string passed to Cmd_TokenizeString
#define	MAX_STRING_TOKENS	1024	// max tokens resulting from Cmd_TokenizeString
#define	MAX_TOKEN_CHARS		1024	// max length of an individual token

#define	MAX_INFO_STRING		1024
#define	MAX_INFO_KEY		1024
#define	MAX_INFO_VALUE		1024

#define	BIG_INFO_STRING		8192  // used for system info key only
#define	BIG_INFO_KEY		  8192
#define	BIG_INFO_VALUE		8192

 

This effectively limits the cvar number, but I do not think that this was the problem

Link to comment
Share on other sites

hey,what do u mean how am i flagging them,i add it to g_local.h,then in g_main.c i add them there and add them to the table.for example if i want my cvar to be rage_blasterdam in g__local.h i type:

extern vmCvar_t rage_blasterdam;

in g_main.c

vmCvar_t rage_blasterdam

 

then in g_main.c in the table:

{ &rage_blasterdam, "rage_blasterdam", "20", CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse },

ive also tried:

{&rage_blasterdam, "rage_blasterdam", "20", CVAR_ARCHIVE |CVAR_SERVERINFO , 0, qfalse },

with all of them but that too doesnt work,hey darth syrup if your willing to help i am willing to give you my source code and you then can see right away what the problem is.

Link to comment
Share on other sites

Change this:

{&rage_blasterdam, "rage_blasterdam", "20", CVAR_ARCHIVE |CVAR_SERVERINFO , 0, qfalse },

 

...to this:

{&rage_blasterdam, "rage_blasterdam", "20", CVAR_ARCHIVE, 0, qfalse },

 

And make sure you only have it in there once (it's shown twice above). Don't change anything else.

Link to comment
Share on other sites

hey,thanks i will try that,you are very helpfull,unlike deadlybofh,=here is my conversation with him today,and jevery other time i ask him a question:

sk8ingaelement: hey,can u answer a quick question?

Guitarist 225: depends who are u

sk8ingaelement: from the message boards,kyle098,BUT i already got the questions i asked you before all answered.i now just have a quick one.

sk8ingaelement: I wanted the time between fires to get changed,so now i made that in bg_weapons.c but when i compile it says that:

../bg_weapons.c:87: initializer must be constant

../bg_weapons.c:104: initializer must be constant

sk8ingaelement: how can i make the number be a cvar then?

Guitarist 225: ok

Guitarist 225: that doesnt help me

sk8ingaelement: what other info do u need?

sk8ingaelement: ?

sk8ingaelement: are u there?

Guitarist 225: IM BUSY

Guitarist 225: not now

sk8ingaelement: ok,i will ask like 20 minutes later.

Guitarist 225: no

Guitarist 225: ur not

sk8ingaelement: ?when?

Guitarist 225: how bout never

sk8ingaelement: why do u have to be so mean?

Guitarist 225: cuz im ****ing busy

Guitarist 225: now go away

Link to comment
Share on other sites

yay it worked,so once again thanks darth syrup.i have another question now(there is always another one,lol.,i am still sorta a biggener in this mod making.) I wanted the time between fires to get changed,so now i madecvar instead of the numbers in bg_weapons.c but when i compile it says that:

../bg_weapons.c:87: initializer must be constant

../bg_weapons.c:104: initializer must be constant .

i know it is possibe because jediplus i think has variables for it because he said ou can now change all the weapon speeds.

Link to comment
Share on other sites

If you want to change the weapon speeds, don't put the cvar in the array:

somewhere before the array is read to determine weapon speed, set the value in the array equal to the cvar. Then the array will have the value in it, and your speed will change.

Link to comment
Share on other sites

array, i am sorry but i dont know what you mean,the code is like this:

{ // WP_BRYAR_PISTOL,

// "Bryar Pistol", // char classname[32]; // Spawning name

AMMO_BLASTER, // int ammoIndex; // Index to proper ammo slot

15, // int ammoLow; // Count when ammo is low

2, // int energyPerShot; // Amount of energy used per shot

400, // int fireTime; // Amount of time between firings

8192, // int range; // Range of weapon

2, // int altEnergyPerShot; // Amount of energy used for alt-fire

400, // int altFireTime; // Amount of time between alt-firings

8192, // int altRange; // Range of alt-fire

0, // int chargeSubTime; // ms interval for subtracting ammo during charge

200, // int altChargeSubTime; // above for secondary

0, // int chargeSub; // amount to subtract during charge on each interval

1, //int altChargeSub; // above for secondary

0, // int maxCharge; // stop subtracting once charged for this many ms

1500 // int altMaxCharge; // above for secondary

 

now i change the 400 to rage_blastervel for example but it gives me that problem.

do u mean i should do the following before the setting:

#define firetime rage_blastervel;

?

Link to comment
Share on other sites

He means that before that variable is referenced, you need to make it equal to the cvar.

 

Array elements must be constant on their definitions.

 

You can always do this: a switch statement on each reference of the variable, on the condition of the currently active weapon, where you make it to use the specific cvar.

Link to comment
Share on other sites

where is this variable referenced?do u mean in g_weapons.c under the bryan pistol coding for example where it says like:

int damage = BRYAR_PISTOL_DAMAGE;

and stiff like that i should add:

int firetime = Rage_pistolvel

or in like bg_weapons.h there is a

int fireTime;

But i cant set that to a variable because it is for all the firetime weapons and i cant have one cvar for all of them.

 

Sorry for the dumb questions as i said before i am a biggener in game coding.

 

also i am trying so people can find my game like in jedimod and i replaced in ui_main.c:

static const serverFilter_t serverFilters[] = {

{"All", "" },

{"Jedi Knight 2", "" },

{"JediMod", "JediMod" },

with

static const serverFilter_t serverFilters[] = {

{"All", "" },

{"Jedi Knight 2", "" },

{"JediRage", "JediRage" },

 

but it still doesnt work.

Link to comment
Share on other sites

But i cant set that to a variable because it is for all the firetime weapons and i cant have one cvar for all of them.

Try what ASk said, make a switch statement - if it's the gun you want to change the speed for, use the cvar, else on the default case, use the array.

 

static const serverFilter_t serverFilters[] = {

{"All", "" },

{"Jedi Knight 2", "" },

{"JediRage", "JediRage" },

Is your mod loading from a "JediRage" folder in the Gamedata directory?

Link to comment
Share on other sites

Originally posted by Darth_Syrup

Is your mod loading from a "JediRage" folder in the Gamedata directory?

OHH,OK,THEN IWILL DO THAT.

 

so in bg_pmove it says:

if ( pm->cmd.buttons & BUTTON_ALT_ATTACK ) {

if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->zoomMode != 1)

{

PM_AddEvent( EV_FIRE_WEAPON );

addTime = weaponData[pm->ps->weapon].fireTime;

}

else

{

PM_AddEvent( EV_ALT_FIRE );

addTime = weaponData[pm->ps->weapon].altFireTime;

}

}

else {

PM_AddEvent( EV_FIRE_WEAPON );

addTime = weaponData[pm->ps->weapon].fireTime;

by switch statement do u mean a if then else statement?

something like:

if (wp_BryanPistol)

{

int firetime= rage_pistolvel.integer

}

Link to comment
Share on other sites

by switch statement do u mean a if then else statement?

something like:

if (wp_BryanPistol)

{

int firetime= rage_pistolvel.integer

}

Yeah, something like that. :)

Why not just:

 

if (wp_BryanPistol)

{

addTime = rage_pistolvel.integer

}

 

Then you won't have to change the array, assuming it's not used anywhere else (i'm pretty sure the firetime is only checked right here).

Link to comment
Share on other sites

i did what you told me and when i compiled it said that my cvars where undeclared identifiers so i declared each cvar in the begginign of g_pmove.c by typing the following for each cvar:

extern vmCvar_t rage_pistolspeed;

 

then it compiled but in the game now my guns shoot but they dont shoot anything?did i declare my cvars in the wrong place or did i edit the wrong thing?

Link to comment
Share on other sites

now i got the speed to go down somehow by making the if statemet to this:

if (pm->ps->weapon == WP_BRYAR_PISTOL)

{

PM_AddEvent( EV_FIRE_WEAPON );

addTime = rage_pistolspeed.integer;

}

but i stillcant chnage the speed in the game and now the alt attack on some weapons is the same as the regular attack and on some it is combined.

Link to comment
Share on other sites

The pmove stuff should be seen seperately from game and cgame..

 

it might have access to g_main, sure but it ****s up on movement prediction clientside when accessing that. you should use a seperate array in pmove_t for example. i haven't ever tested cvars in pmove i think, (never needed them) but i 'think' it ****s up.

 

(btw, there is no cvar limit, only memory limit because q3 uses a linked list if it's using a cvar system anthing like q2's)

 

also the cvars do need to be communicated with the clients for them to do correct weapon predictions.. which give problems when using alot (i did it in a q3 mod once.. lotta problems ;) but making the variable names really small and removing alot of them fixxed it)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...