Page 1 of 1

keeping track of a user's name

Posted: July 17th, 2009, 8:21 pm
by xeno
Okay, well My friend and I are making a new gametype called Bounty Hunter, which is where when you spawn everyone is assigned a target which they have to kill. When they kill the target they get one point, and if they kill the person hunting them they get another point. If they kill everyone else they get -1 points.

I need to be able to track the users kills and name. Originally Nightmare made the code and had some errors in it, well we managed to get those errors to work. But now we just need to be able to track the players name correctly, so the person knows who their target is.


Code: Select all

	precacheString(&"BH_HUD2_TARGET");

Code: Select all

	self.bh_hud2_target = newClientHudElem(self);
	self.bh_hud2_target.archived = false;
	self.bh_hud2_target.x = 519.5;
	self.bh_hud2_target.y = 402;
	self.bh_hud2_target.alignX = "left";
	self.bh_hud2_target.alignY = "top";
	self.bh_hud2_target.sort = 1;
	self.bh_hud2_target.fontScale = .8;
	self.bh_hud2_target.label = &"BH_HUD2_TARGET";
	self.bh_hud2_target setValue(self.BHTarget.name);
	iprintln("bhtarget:" + self.BHTarget.name);
So what this code does is make a hud element that says 'BH_HD2_TARGET' instead of the value contained in self.BHTarget.name. I've tested the value in self.BHTarget.name with iprintln and it contains the correct value (it's not null).

Re: keeping track of a user's name

Posted: July 18th, 2009, 3:48 am
by Drofder2004
Have you tried "setText"?

Re: keeping track of a user's name

Posted: July 18th, 2009, 5:31 am
by xeno
Isn't settext for static (unchanging) data though, and we want it to change.

Re: keeping track of a user's name

Posted: July 18th, 2009, 10:38 am
by waywaaaard
why can't you if it changes just recall setText()?

Re: keeping track of a user's name

Posted: July 18th, 2009, 6:48 pm
by xeno
Yeah, I just tried that. It doesn't work, it displays the same problem.

Re: keeping track of a user's name

Posted: July 18th, 2009, 7:49 pm
by Drofder2004
what is "self.bhtarget.name"?

How is it being registered?
Where is it being registered?

what is 'self'?

Re: keeping track of a user's name

Posted: July 18th, 2009, 7:58 pm
by waywaaaard
self should be the player

Re: keeping track of a user's name

Posted: July 18th, 2009, 11:49 pm
by Drofder2004
Lev!athan wrote:self should be the player
of course it should be, but the question still stands :P

Re: keeping track of a user's name

Posted: July 19th, 2009, 2:52 am
by xeno
the variable is declared, as iprintln shows it properly