Jump to content

Home

strange dislocated spawning after adding new code


NITEMARE

Recommended Posts

what i was trying to do is remove the shield and the extra health when the player spawns. i found the lines responsible for the starting values on line 1916 in the g_client.c and added some code to make it a toggle.

 

	// health will count down towards max_health
ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1.25;

// Start with a small amount of armor as well.
client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0.25;
/*
if (duelffa.integer){
	ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1;
client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0;
return;
}
*/

 

at the moment it is commented out to see if it is the cause for my problem: everything went good, when i spawn i get normal 125/25 and hp is counting down like default, if i set duelffa 1 and i spawn again i get only 100/0 like i intended. but for some reason the spawnpoint is allways in the ground or in some walls, totaly dislocated. how can that happen? it must have something to do with adding the new lines, cuz for testing i just changed the original values and it worked. but i dont want to force this on other admins. so i wanted to make it a toggle for ffa games with private duels going on.

Link to comment
Share on other sites

	// health will count down towards max_health
ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1.25;

// Start with a small amount of armor as well.
client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0.25;
if (duelffa.integer){
/*
	ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1;
	client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0;
*/
	return;
}

Try using this!

Link to comment
Share on other sites

Is that ALL you changed? I had a similar bug when creating version 1.1 of my mod (fanMod). I simply forgot to put an else if for another possible way to spawn and I was spawning with 0 health. It wouldn't spawn properly. In my FanMod you can disable shield with the g_shield cvar so I know it is possible. try starting from a fresh install of the source and just comment out the part that calculates how much armor and gives it to you.

Link to comment
Share on other sites

heh i got it

after thinking about it(with my c++ ignorant brain) suddenly i found the cause for the spawn problem: the if statement has those "{" but the original lines didnt. but there was somehting coming after the original lines :

 

G_SetOrigin( ent, spawn_origin );

VectorCopy( spawn_origin, client->ps.origin );

 

 

 

 

i just added these lines to my new lines and it works!

if (duelffa.integer){

	ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1;
	client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0;
	G_SetOrigin( ent, spawn_origin );
	VectorCopy( spawn_origin, client->ps.origin );

	return;
}

Link to comment
Share on other sites

and it gets stupider (heh), i just tested it with a bot. my smart ass solution brought another glitch up. its impossible to spawn if u are in the intermission after u got killed or killed someone and looking at the kill stats. the console says that me and the bot are killing ourselfes, mabe telefrags because we spawn at the same spot. but i dont know exactly...

have to check it out with my sub n00b brain.

Link to comment
Share on other sites

heh i got it to work!

 

just added the new lines without a return and the "{}".

 

so it looks like this

 

if (duelffa.integer)

	ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1;
	client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0;

// health will count down towards max_health
ent->health = client->ps.stats[sTAT_HEALTH] = client->ps.stats[sTAT_MAX_HEALTH] * 1.25;

// Start with a small amount of armor as well.
client->ps.stats[sTAT_ARMOR] = client->ps.stats[sTAT_MAX_HEALTH] * 0.25;

G_SetOrigin( ent, spawn_origin );
VectorCopy( spawn_origin, client->ps.origin );

// the respawned flag will be cleared after the attack and jump keys come up
client->ps.pm_flags |= PMF_RESPAWNED;

trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );
SetClientViewAngle( ent, spawn_angles );

thx anyway...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...