coding problem....


(hell247) #1

was wondering how i can change the “SERVER INFO” text on the load screen of w.et to my mods name? just wondering how that can be changed or which c++ file in the source is it in?

thanks


(isbowhten) #2

have a look at the server.cfg … i think it is MOTD … i am not sure,but search for it and try out


(hell247) #3

na you know when you join a server with jaymod running the text above the MOTD is “JAYMOD #VERSION#” in blue and yellow, thats what i want to change


(hell247) #4

ah i found the text, its in the ui\ingame_serverinfo.menu file.:smiley:


(IlDuca86) #5

Give a look in cg_loadpanel.c , in the function CG_DrawConnectScreen.

6th param. of CG_Text_Paint_Centred_Ext is the text, and it allow colorcodes :wink:


(hell247) #6

AHA! THANKYOU!

another issue im currently having is locating the max health values for the game, i cant find them anywhere…

if you know of their location in the code that would be great also hehe!


(IlDuca86) #7

Give a look in g_client.c at the function ClientSpawn. There you can see how, every respawn, the health is resetted.

There are :

client->ps.stats[STAT_MAX_HEALTH]

and

client->pers.maxHealth

The 1st one store the “current” amount of health a player has ( and it can be different then the max, since if someone hit you, you start to lose hp in example… ). The second one as you see is stored in the persistent client information structure, and it stores the max health a player can have. If you look at the function ClientSpawn you can find in order :

1st

// clear entity values
client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;
client->ps.eFlags = flags;
// MrE: use capsules for AI and player
//client->ps.eFlags |= EF_CAPSULE;

Here the health of the player is set to max possible

2nd

AddMedicTeamBonus( client );

Look this function…

void AddMedicTeamBonus( gclient_t *client ) 
{
	int numMedics = G_CountTeamMedics( client->sess.sessionTeam, qfalse );

	// compute health mod
	client->pers.maxHealth = 100 + 10 * numMedics;
	
	if( client->pers.maxHealth > 125 ) 
	{
		client->pers.maxHealth = 125;
	}

	if( client->sess.skill[SK_BATTLE_SENSE] >= 3 ) 
	{
		client->pers.maxHealth += 15;
	}
	
	client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;
}

This is the function that sets the max health of a player ( as you see, depending on the number of medics in the team the maxHealth is increased since the value of 125, decided with the first “if”, and the second “if” add 15 HP if you have level 3+ in battle sense skill ). Finally, the “current” health of the player is set in this function too, with the line :

client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;

But it’s not all!

3rd

if( client->sess.skill[SK_BATTLE_SENSE] >= 3 )
	{
		// We get some extra max health, but don't spawn with that much
		ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH] - 15;
	}
	else
	{
		ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];
	}

Beh i’m going offtopic… the answer is just “pers.maxHealth” :slight_smile:


(hell247) #8

hmm ok, well since i want the default max health to be 1000 instead of 100 i changed the relevant values so:

// compute health mod
client->pers.maxHealth = 1000 + 10 * numMedics;

if( client->pers.maxHealth > 1000 ) {
client->pers.maxHealth = 1000;
}

but that made no difference so… youll have to teach me here. i know c++ but not the system ID or SD developed.


(kamikazee) #9

Make sure you compile the mod properly - and do remember that some pieces of code are shared between client and server. This means you need both the game and cgame dll’s updated if you start changing bg_xxx.cpp/h files.

Also, 1000 HP? Is this some medic-fest-mod?


(hell247) #10

haha

my mod has fast firing weapons, and having health at 100 doesnt give people chance lol


(IlDuca86) #11

Hey i just made a test, and worked :wink:

So if you compiled well, the problem could be in the packaging and in the files you’re using to test it…

Did you created a .pk3 for your mod to test it, or just putted the mod librery in a folder inside ET game directory?

About the code :

client->pers.maxHealth = 1000 + 10 * numMedics;

if( client->pers.maxHealth > 1000 ) {
client->pers.maxHealth = 1000;
}

give a look at it … if you just want everybody to have 1000 HP, just use the line :

client->pers.maxHealth = 1000;

but if you want to keep the “HP surplus due to number of medics per team” then :

client->pers.maxHealth = 1000 + 10 * numMedics;

if( client->pers.maxHealth > 1025 ) {
client->pers.maxHealth = 1025;
}