Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!
Moderator: Core Staff
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 28th, 2010, 7:28 am
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 ...
-
Opel
- CJ Fan
- Posts: 188
- Joined: September 15th, 2008, 12:28 pm
- Location: Scotland
Post
by Opel » May 28th, 2010, 1:34 pm
it should be set value instead of set text im sure.
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 28th, 2010, 2:03 pm
Then I get type struct is not an entity..
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » May 28th, 2010, 8:07 pm
Are you correctly calling self?
Please show us the function where you actually thread the above from.
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
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 28th, 2010, 9:14 pm
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);
}
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » May 28th, 2010, 10:07 pm
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.
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
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 29th, 2010, 5:37 am
pip.gsc
Code: Select all
main()
{
thread pip\hud::main();
// other threads here...
}
and in
_load.gsc:
-
Rezil
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » May 29th, 2010, 6:08 am
you don't call this thread on anything so self has no meaning.
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.
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 29th, 2010, 10:46 am
So... what do I do to fix it....?
-
Moustache
- CJ Worshipper
- Posts: 476
- Joined: August 18th, 2008, 9:30 am
Post
by Moustache » May 29th, 2010, 11:48 am
Change self in to player and define player?
Maybe that work.
-
positive
- CJ Wannabe
- Posts: 11
- Joined: August 21st, 2009, 3:17 pm
Post
by positive » May 29th, 2010, 3:17 pm
Ok it works now
Users browsing this forum: No registered users and 2 guests