keeping track of a user's name

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
xeno
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 31st, 2007, 12:37 am
Location: United States - GA

keeping track of a user's name

Post by xeno » July 17th, 2009, 8:21 pm

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).
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: keeping track of a user's name

Post by Drofder2004 » July 18th, 2009, 3:48 am

Have you tried "setText"?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

xeno
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 31st, 2007, 12:37 am
Location: United States - GA

Re: keeping track of a user's name

Post by xeno » July 18th, 2009, 5:31 am

Isn't settext for static (unchanging) data though, and we want it to change.
Image

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: keeping track of a user's name

Post by waywaaaard » July 18th, 2009, 10:38 am

why can't you if it changes just recall setText()?
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

xeno
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 31st, 2007, 12:37 am
Location: United States - GA

Re: keeping track of a user's name

Post by xeno » July 18th, 2009, 6:48 pm

Yeah, I just tried that. It doesn't work, it displays the same problem.
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: keeping track of a user's name

Post by Drofder2004 » July 18th, 2009, 7:49 pm

what is "self.bhtarget.name"?

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

what is 'self'?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: keeping track of a user's name

Post by waywaaaard » July 18th, 2009, 7:58 pm

self should be the player
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: keeping track of a user's name

Post by Drofder2004 » July 18th, 2009, 11:49 pm

Lev!athan wrote:self should be the player
of course it should be, but the question still stands :P
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

xeno
CJ Wannabe
CJ Wannabe
Posts: 38
Joined: October 31st, 2007, 12:37 am
Location: United States - GA

Re: keeping track of a user's name

Post by xeno » July 19th, 2009, 2:52 am

the variable is declared, as iprintln shows it properly
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest