Jump to content

Home

Trouble with Classes


Brandon

Recommended Posts

Well, I followed the tutorial step by step, but nothing changed for me in the game. I'm assuming the reason for failure has something to do with the differences between Quake 3 and Jedi Outcast. Sitting down and trying to figure out wtf they're doing hasn't seemed to help me much. Generally, I try to follow tutorials to figure out how things get done.

Link to comment
Share on other sites

Well the names of the weapons, ammo, and models are different of course. look in the various files for like WP_BOWCASTER or somthing for the list and AMMO_POWERCELL etc I don't remember where they were and use like "jan/blue" or whatever instead of "biker/blue" and you can call your classes PCLASS_BFG if you want but it doesn't make much sense if the BFG doesn't exist but it will work.

Link to comment
Share on other sites

Thanks for the reply MadScientist. I replaced the Quake 3 model references with JO models like "reborn/red." I figure I'll change the class names whenever I get the mod to actually work. Right now I can go in the game and select the reborn model, but nothing different happens. I suppose I'll have to go back in and see if there are any references to a certain gametype that I have to have activated for the mod to work. I would assume something like TeamFFA, because the code specifies colors of the characters.

Link to comment
Share on other sites

Your lucky ;)

i was messing around with the "classes" too, and found out that, the jk II does something diffrent with if-statements, (or the code on the page is faulry, what happened with me, was this:

 

i had three classes for testing: Shadowtrooper first, then Storm trooper then Rebel, and if the model wasnt any three, they they became the Rebel, but when you enter the game, your always rebel.

 

Now what ok is this:

// set model
if( g_gametype.integer >= GT_TEAM ) {
	Q_strncpyz( model, Info_ValueForKey (userinfo, "team_model"), sizeof( model ) );
} else {
	Q_strncpyz( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) );
	if (!Q_stricmp (model, "shadowtrooper/default")) {
  			client->pers.newplayerclass = PCLASS_SHADOW;
	} else if (!Q_stricmp (model, "stormtrooper/default")) {
  			client->pers.newplayerclass = PCLASS_STORMTROOPER;
	} else if (!Q_stricmp (model, "rebel/default")) {
 			 client->pers.newplayerclass = PCLASS_REBEL;
	} else {
  			client->pers.newplayerclass = PCLASS_REBEL;
  			Q_strncpyz(model, "REBEL/default", sizeof( model ) ); //wiebbe edit
}

 

(dont look at the wiebbe edit, it helps me find what i changed.

what wasnt done with the code on the site, is didnt finish the if-statements, here after each else if, and else, there needs to be a

{ and } to show where the If statements ends. When i addes those bracked, it worked!

 

Just compare my code with the code on the site..

Good luck!

Link to comment
Share on other sites

Okay, I just tried out the fix. I can switch my character class without a problem, but for some reason the weapon effects don't work. All the classes start out with the Bryar Pistol and Saber regardless. Now I'm assuming there might be some line of code that over rides my spawning with certain weapons changes.

Link to comment
Share on other sites

well. what i guess you did wrong is this: Firstly your if function may be wrong? dont know for sure, cuzz you didnt post it :p

(would be alot more helpfull, so i can see what is wrong (or if you dont want to post it, mail it if you want) Check all the strings it searches for, dont know if C is case sensitive, but just make sure, its all the same captital letter.

lets take a look at the code from the site:

 

//assign weapons according to class
switch (client->pers.playerclass){
  case PCLASS_BFG:
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BFG );
     client->ps.ammo[WP_BFG] = 20;
     break;
  case PCLASS_LIGHTNING:
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_LIGHTNING );
     client->ps.ammo[WP_LIGHTNING] = 60;
     break;
  case PCLASS_RAILGUN:
  default:
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_RAILGUN );
     client->ps.ammo[WP_RAILGUN] = 20;
     break;
}

If we look at this line:

 client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_RAILGUN ); 

Its kinda easy, so i guess that i dont even have to explain, but i will try, the client->ps.stats, just says (its my guess, dunno for sure) Get from the client (self! :p ) the stats, and then go to the weapons stats (the

 [sTAT_WEAPONS]

) then is says, add to the stats! (very important, the |= means add, not replace or something, so if you would like to have them only use the Disruptor and the bryar pistol, you would get this:


  case PCLASS_REBEL:
  default:
     client->ps.stats[sTAT_WEAPONS] = ( 1 << WP_BRYAR_PISTOL ); // keep it clean here, best to follow the order its in the code (or in game..)
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_DISRUPTOR );
     client->ps.ammo[AMMO_BRYAR] = 100; // i know this is wrong, (the AMMO_bryar, but didnt feel like checking it)
     client->ps.ammo[AMMO_POWERCELL] = 150;
     break;
}

Now if it would execute this code, it would give us, a bryar, and a disruptor, but if we would change one character: this

client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_DISRUPTOR );

to

client->ps.stats[sTAT_WEAPONS] = ( 1 << WP_DISRUPTOR );

, you would only get the disruptor, so keep a look at the code, 1 minor mistake, and it doestn work well!

 

Also keep this in mind, in JKII the ammo is done like this: AMMO_POWERCELL, while in Quake3 its done like this: WP_RAILGUN, dont forget to change that.

Link to comment
Share on other sites

This is what I've changed in the code

 

 

from the g_client.c

// set model
if( g_gametype.integer >= GT_TEAM ) {
	Q_strncpyz( model, Info_ValueForKey (userinfo, "team_model"), sizeof( model ) );
} else {
	Q_strncpyz( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) );
	if (!Q_stricmp (model, "shadowtrooper/default")) {
  			client->pers.newplayerclass = PCLASS_SHADOW;
	} else if (!Q_stricmp (model, "stormtrooper/default")) {
  			client->pers.newplayerclass = PCLASS_STORMTROOPER;
	} else if (!Q_stricmp (model, "rebel/default")) {
 			 client->pers.newplayerclass = PCLASS_REBEL;
	} else {
  			client->pers.newplayerclass = PCLASS_REBEL;
  			Q_strncpyz(model, "REBEL/default", sizeof( model ) ); //wiebbe edit
}

 

from bg_public.h

typedef enum {
PCLASS_SHADOW,
PCLASS_STORMTROOPER,
PCLASS_REBEL,

PCLASS_NUM_CLASSES
} pclass_t;

 

I have put in the code like this

typedef enum {
TEAM_FREE,
TEAM_RED,
TEAM_BLUE,
TEAM_SPECTATOR,

TEAM_NUM_TEAMS
} team_t;

typedef enum {
PCLASS_SHADOW,
PCLASS_STORMTROOPER,
PCLASS_REBEL,

PCLASS_NUM_CLASSES
} pclass_t;

 

is that right, or do I have to take the first one out?

 

and there's something in the g_local.h file, but I can't remember

Link to comment
Share on other sites

Well that looks like it would work... but you haven't done anything based on the classes so you will see no difference (at least you didn't post it). There is one more step to doing all of this btw... changing it so you don't switch models until you respawn. as of now you will look like the wrong class if you switch until you respawn.

Link to comment
Share on other sites

hmm,

 

are you sure you added something like this? :

 

/assign weapons according to class
switch (client->pers.playerclass){
  case PCLASS_SHADOW:
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_DISRUPTOR );
     client->ps.ammo[AMMO_POWERCELL] = 100;
     break;
  case PCLASS_STORMTROOPER:
      client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BLASTER );
     client->ps.ammo[AMMO_POWERCELL] = 100;      break;
  case PCLASS_REBEL:
  default: // what the hell does this do? Probaly say this is the default case if none aplies? just a guess though
     client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BRYAR_PISTOL );
     client->ps.ammo[AMMO_BRYAR] = 100;      break;
}

 

This had to be there too ofcourse, when i get home, ill post where i placed it in g_client.c

also dont forget to place these:

 

client->pers.playerclass = client->pers.newplayerclass;

Link to comment
Share on other sites

yeh, I added that too, forgot to paste it

 

//assign weapons according to class
switch (client->pers.playerclass){
	case PCLASS_BFG:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BRYAR_PISTOL );
		client->ps.ammo[WP_BRYAR_PISTOL] = 50;
		break;
	case PCLASS_LIGHTNING:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_SABER );
		client->ps.ammo[WP_LIGHTNING] = 1;
		break;
	case PCLASS_RAILGUN:
	default:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BOWCASTER );
		client->ps.ammo[WP_RAILGUN] = 20;
		break;
}

 

on closer inspection, I beleive that I left the old PCLASS_RAILGUN in there instead of the new ones....hmm...

 

edit: ok, I tried it changing the PCLASS but it still didn't work

Link to comment
Share on other sites

dude, you need to give the weapons some ammo?

also, recheck that you changed the classes according to how they are defined in g_local.h.

 

check bg_weapons.h (i thought it was h, its the file of 3 k) for all the names of everything (ammo, and weapons)

Link to comment
Share on other sites

ok, I've editied the code again, but it still doesn't work

 

//assign weapons according to class
switch (client->pers.playerclass){
	case PCLASS_STROMTROOPER:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BRYAR_PISTOL );
		client->ps.ammo[AMMO_BLASTER] = 50;
		break;
	case PCLASS_SHADOW:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BLASTER );
		client->ps.ammo[AMMO_BLASTER] = 30;
		break;
	case PCLASS_REBEL:
	default:
		client->ps.stats[sTAT_WEAPONS] |= ( 1 << WP_BOWCASTER );
		client->ps.ammo[AMMO_POWERCELL] = 20;
		break;
}

 

all the other parts are the same as what I've pasted before.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...