Page 1 of 1
					
				Health display
				Posted: May 28th, 2010, 7:28 am
				by positive
				Hi, i'm trying to make a health display but it doesn't seem to work...
This is what I've so far: I get all sorts of errors...
Code: Select all
hpinfo()
{
	self.hpinfo = NewclientHudElem(self);
	self.hpinfo.alignX = "right";
	self.hpinfo.alignY = "top";
	self.hpinfo.x = 400; //temporary placing.
	self.hpinfo.y = 20; // same
	self.hpinfo.archived = true;
	self.hpinfo.fontScale = 1.4; 
	self.hpinfo.alpha = 1;
	self.hpinfo.hidewheninmenu = true;
	self.hpinfo setText(self.health);
}
}
I also tried first making a new variable self.hpleft = self.health; and put that in settext() but no luck there ...
 
			
					
				Re: Health display
				Posted: May 28th, 2010, 1:34 pm
				by Opel
				it should be set value instead of set text im sure.
			 
			
					
				Re: Health display
				Posted: May 28th, 2010, 2:03 pm
				by positive
				Then I get type struct is not an entity..
			 
			
					
				Re: Health display
				Posted: May 28th, 2010, 8:07 pm
				by Drofder2004
				Are you correctly calling self?
Please show us the function where you actually thread the above from.
			 
			
					
				Re: Health display
				Posted: May 28th, 2010, 9:14 pm
				by positive
				hud.gsc
Code: Select all
main() {
	self thread hpinfo();
	//thread modinfo();
	
	//self.hpover = self.health;
	//player = self;
}
modinfo()
{
	level.modinfo = NewHudElem();
	level.modinfo.alignX = "right";
	level.modinfo.alignY = "top";
	level.modinfo.x = 400;
	level.modinfo.y = 20;
	level.modinfo.archived = true;
	level.modinfo.fontScale = 1.4; 
	level.modinfo.alpha = 1;
	level.modinfo.hidewheninmenu = true;
	level.modinfo setText("PIP-Mod Made by Pozzuh");
}
hpinfo()
{
	self.hpinfo = NewclientHudElem(self);
	self.hpinfo.alignX = "right";
	self.hpinfo.alignY = "top";
	self.hpinfo.x = 400;
	self.hpinfo.y = 20;
	self.hpinfo.archived = true;
	self.hpinfo.fontScale = 1.4; 
	self.hpinfo.alpha = 1;
	self.hpinfo.hidewheninmenu = true;
	self.hpinfo setvalue(self.health);
}
 
			 
			
					
				Re: Health display
				Posted: May 28th, 2010, 10:07 pm
				by Drofder2004
				Who is "self"?
Self does NOT refer to a player in all circumstances, self is the entity on which the function is called.
Keep going back, where is "main()" called from.
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 5:37 am
				by positive
				pip.gsc
Code: Select all
main() 
{
	thread pip\hud::main();
       // other threads here...
}
and in 
_load.gsc:
 
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 6:08 am
				by Rezil
				you don't call this thread on anything so self has no meaning.
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 10:46 am
				by positive
				So... what do I do to fix it....?
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 11:48 am
				by Moustache
				Change self in to player and define player?
Maybe that work.
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 3:17 pm
				by positive
				Ok it works now
			 
			
					
				Re: Health display
				Posted: May 29th, 2010, 3:43 pm
				by Moustache
				K nice 
