Any idea why this doesn't work?

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

Moderator: Core Staff

Post Reply
User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Any idea why this doesn't work?

Post by Rezil » May 18th, 2010, 4:42 pm

Code: Select all

start()

{
	for(;;)
	
	{
	
		players = getentarray("player", "classname");
		for(i = 0; i < players.size; i++) 
		
		{
			
		if ((!isdefined(players[i].reset)) && (isalive(players[i])))
			
			{
				
			players[i].reset = true;
			players[i].have_messhall_key = false;
			players[i] thread CruiseHUDStuff();
				
			}
		}
		wait 0.5;
	}
}

CruiseHUDStuff()

{

	if(!isdefined(self.objective_one))
	{
		
		self.objective_one = newclienthudelem(self);
		self.objective_one.x = 36;
		self.objective_one.y = 100;
		self.objective_one.allignx = "center";
		self.objective_one.alligny = "middle"; 
		self.objective_one.alpha = 1;
		self.objective_one.fontScale = 1; 	
		self.objective_one.color = (1, 1, 1);
		self.objective_one settext(&"blah.");
	}


	else if(!isdefined(self.objective_two))
	{

		self.objective_two = newclienthudelem(self);
		self.objective_two.x = 10;
		self.objective_two.y = 265;
		self.objective_two.allignx = "center";
		self.objective_two.alligny = "middle";
		self.objective_one.alpha = 1;
		self.objective_two.fontScale = 1; 	
		self.objective_two.color = (1, 1, 1);
		self.objective_two settext(&"blah2");
	}
}
Any clue as to why this doesn't display any text on the screen?
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

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

Re: Any idea why this doesn't work?

Post by Drofder2004 » May 18th, 2010, 5:09 pm

try doing "setValue(999)" to test if the HUD is being displayed correctly.
Not sure, but you may need to precache text.
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
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Any idea why this doesn't work?

Post by Rezil » May 18th, 2010, 5:13 pm

Drofder2004 wrote:try doing "setValue(999)" to test if the HUD is being displayed correctly.
Not sure, but you may need to precache text.
Tried both, it DOES display value, it can also display shaders, tried precaching strings and they do show(as .label = &"text";), but that means I cannot change them via script anymore which is what I want.

What's more, using level.blah settext("text"); displays text correctly, setting it for one person doesn't...
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

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

Re: Any idea why this doesn't work?

Post by Drofder2004 » May 18th, 2010, 5:23 pm

level.hudtext = "Text";
self.hud setText(level.hudtext);

That is basically how it is done with the voting hud for the CJ mod.
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
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Any idea why this doesn't work?

Post by Rezil » May 18th, 2010, 5:26 pm

Right, but the variable hudtext is global in your case, I want a variable only for one player.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

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

Re: Any idea why this doesn't work?

Post by Drofder2004 » May 18th, 2010, 9:28 pm

Rez|l wrote:Right, but the variable hudtext is global in your case, I want a variable only for one player.
The make it self.hudtext?
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
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Any idea why this doesn't work?

Post by Rezil » May 18th, 2010, 11:57 pm

Tried it, doesn't work. I've made a workaround so it doesn't matter anymore. Thanks for trying to help.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

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

Re: Any idea why this doesn't work?

Post by Drofder2004 » May 19th, 2010, 12:33 am

No probs.
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

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests