| Author |
Topic: Cod2 Hud not working |
| securiity |
General Member Since: Jan 11, 2009 Posts: 63 Last: May 31, 2009 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Apr. 30, 2009 07:37 pm |
 |
Hi, i'm trying to get a hud working that displays text in the uper right hand corner of the screen, I have added
Code: self thread maps\mp\gametypes\_hud_stats::ShowText();
Under spawnplayer() In the default IW_07 gametype codes like dm.gsc tdm.gsc and added it to my mod and I also put
Code: {
game["text"]= &"Security ownZ";
precacheString(game["text"]);
Under Callback_StartGameType() in the gametype files too,
I also created a .gsc file called _hud.gsc and put this code in it
Code: ShowText()
{
if(!isDefined(self.text_right))
{
self.text_right = newClientHudElem(self);
self.text_right.x = -50;
self.text_right.y = -300;
self.text_right.font = "default";
self.text_right.fontscale = 1;
self.text_right.alpha = 1;
self.text_right.label = (game["text"]);
}
}
My problem is, You can download the mod and all but my hud dosent appear on the screen in the upper right corner like I want, if you can help me by reposting that would be great, If you are unsure of what my mod looks like if you would please add my xfire : cod2security and I will send you the mod.
Thanks! [: |
 |
|
|
| PwN3R |
 |
General Member Since: Jun 19, 2008 Posts: 96 Last: Mar 17, 2010 [view latest posts] |
|
|
|
|
| DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Thursday, Apr. 30, 2009 07:49 pm |
 |
It looks like your problem is you are creating a Client hud element from Callback_StartGameType(), when in fact "self" as player is not defined in that method (unless of course, you have a method to count all players and apply from there?).
Change the code to this:
Quote: ShowText()
{
if(!isDefined(level.text_right))
{
level.text_right = newHudElem();
level.text_right.x = -50;
level.text_right.y = -300;
level.text_right.font = "default";
level.text_right.archived = true;
level.text_right.fontscale = 1;
level.text_right.alpha = 1;
level.text_right.text = (game["text"]);
}
}
The archiving = true will preserve the hud element on a new round in round-based gametypes.
edited on Apr. 30, 2009 03:51 pm by DemonSeed |
 |
|
|
| Ploxxy |
General Member Since: May 1, 2009 Posts: 170 Last: Aug 31, 2011 [view latest posts] |
|
|
 |
|
|
| PwN3R |
 |
General Member Since: Jun 19, 2008 Posts: 96 Last: Mar 17, 2010 [view latest posts] |
|
|
|
|
| Ploxxy |
General Member Since: May 1, 2009 Posts: 170 Last: Aug 31, 2011 [view latest posts] |
|
|
 |
|
|
| securiity |
General Member Since: Jan 11, 2009 Posts: 63 Last: May 31, 2009 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, May. 2, 2009 12:05 pm |
 |
Lol, PWner dont waste your time, Crio didnt try anything, hes lien just to get you to make it for him, I'm the one making this hud for him and I just had that _hid.gsc problem he just wants his hud made, he dosent even know how to mod he told me lmao. But anyways thanks PWner you always seem to help all my posts [:
- And idk which one will work lol DemonSpeeds or PWners so i'll trry pwners first, it seems more sufficent, if it dosent work ill try Demonspeeds.
Thanks again
- Another addition, I tried both codes, it still dosent seem to work. Where it says
Code: level.text_right.text = (game["text"]);
I dont write anything in "text" right? Since I added text to the gametype.gsc (dm.gsc, tdm.gsc) Etc Etc. or do I? lol
edited on May. 2, 2009 08:13 am by securiity |
 |
|
|
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Saturday, May. 2, 2009 05:06 pm |
 |
Quote: Crio didnt try anything, hes lien just to get you to make it for him, I'm the one making this hud for him and I just had that _hid.gsc problem he just wants his hud made
realy??? i could have sworn u xfired me asking how to make a hud... weird so i saw a name ciro so i thought u were stealing someones mod so i gave u the wronge hud didnt think u were gona post about it so weird... so stop lieing and if u want the real hud then hear u go dont xfire me for my help anymore if ur just gona keep lieing this is the last time im helping u
Code: ShowText()
{
if(!isDefined(right_text))
{
right_text = newClientHudElem(self);
right_text.horzAlign = "left";
right_text.vertAlign = "center_safearea";
right_text.alignX = "left";
right_text.alignY = "middle";
right_text.x = 0;
right_text.y = -50;
right_text.font = "default";
right_text.fontscale = 1;
right_text.alpha = 1;
right_text.label = (game["stats"]);
}
and put this in instead thread maps\mp\gametypes\_hud_stats::ShowText(); of what u have already
PS. i told u that u had to add
game["text"]= &"Security ownZ";
precacheString(game["text"]);
in every gametype file so u would waste ur time when u could have just went to the _callbacksetutp.gsc think thats what its called and under Callback_StartGameType() u could have just added
game["text"]= &"Security ownZ";
precacheString(game["text"]);
instead i told u to do everygametype to waste ur time and if this dosnt work by the way then ur just poo-poo out of luck
edited on May. 2, 2009 01:11 pm by liltc64 |
 |
|
|
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
|
| Ploxxy |
General Member Since: May 1, 2009 Posts: 170 Last: Aug 31, 2011 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Saturday, May. 2, 2009 09:36 pm |
 |
|
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|