lfnetwork.com mark read register faq members calendar

Thread: strange dislocated spawning after adding new code
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 06-24-2002, 01:46 AM   #1
NITEMARE
 
NITEMARE's Avatar
 
Join Date: Apr 2002
Posts: 413
strange dislocated spawning after adding new code

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.

Code:
	// 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.
NITEMARE is offline   you may: quote & reply,
Old 06-24-2002, 02:11 AM   #2
normal
 
normal's Avatar
 
Join Date: May 2002
Location: California, USA
Posts: 234
Re: strange dislocated spawning after adding new code

Code:
	// 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!
normal is offline   you may: quote & reply,
Old 06-24-2002, 04:00 AM   #3
NITEMARE
 
NITEMARE's Avatar
 
Join Date: Apr 2002
Posts: 413
didnt work...
what exactly is different anyway?
NITEMARE is offline   you may: quote & reply,
Old 06-24-2002, 04:07 AM   #4
LordEradicator
 
Join Date: May 2002
Location: Canada
Posts: 34
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.


Eradicator:
Programmer - JK2: The Fan's Version
Programmer - Tenebrae
INI Editor - CnC Generals: Second Wave
Programmer - Enhanced Half-Life
LordEradicator is offline   you may: quote & reply,
Old 06-24-2002, 05:11 AM   #5
NITEMARE
 
NITEMARE's Avatar
 
Join Date: Apr 2002
Posts: 413
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!
Code:
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;
	}
NITEMARE is offline   you may: quote & reply,
Old 06-24-2002, 05:40 AM   #6
normal
 
normal's Avatar
 
Join Date: May 2002
Location: California, USA
Posts: 234
I knew it was a stupid error. :P
normal is offline   you may: quote & reply,
Old 06-24-2002, 06:01 AM   #7
NITEMARE
 
NITEMARE's Avatar
 
Join Date: Apr 2002
Posts: 413
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.
NITEMARE is offline   you may: quote & reply,
Old 06-24-2002, 07:33 AM   #8
NITEMARE
 
NITEMARE's Avatar
 
Join Date: Apr 2002
Posts: 413
heh i got it to work!

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

so it looks like this

Code:
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...
NITEMARE is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > General Editing > strange dislocated spawning after adding new code

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:07 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.