Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 5 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Cod2 Hud not working
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
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! [:
Share |
PwN3R
General Member
Since: Jun 19, 2008
Posts: 96
Last: Mar 17, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, Apr. 30, 2009 07:42 pm
Try with this m8

ShowText()
{
if(!isDefined(self.text_right))
{
self.text_right = newHudElem();
self.text_right.x = 50;
self.text_right.y = 300;
self.text_right.alignX = "left";
self.text_right.alignY = "middle";
self.text_right.sort = 1;
self.text_right.alpha = 1;
self.text_right.fontScale = 1.2;
self.text_right.archived = true;
self.text_right setText(&"the text");
}
}
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
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
Share |
Ploxxy
General Member
Since: May 1, 2009
Posts: 170
Last: Aug 31, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, May. 1, 2009 07:34 pm
:O having same problem. i want to make that logo
that pwner has but in different writing and im confused cuz i tried alot of different things and it didnt work so i was wondering if some 1 could tell me were the Callback stuff are.
i barely find things im busy alot on other things
Share |
PwN3R
General Member
Since: Jun 19, 2008
Posts: 96
Last: Mar 17, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 1, 2009 08:36 pm
for understand all pls read first what security ask later my psot and later the demonseed post...do not search only answers
Share |
Ploxxy
General Member
Since: May 1, 2009
Posts: 170
Last: Aug 31, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, May. 1, 2009 09:48 pm
pwner lol... um can u teach me then??? my xfire is crioprodcrio

plz[machine_gun]
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
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
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
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 [pimp]

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
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, May. 2, 2009 05:12 pm
change stats to text by the way [pimp]
Share |
Ploxxy
General Member
Since: May 1, 2009
Posts: 170
Last: Aug 31, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, May. 2, 2009 09:36 pm
bs..lol security i didnt say that... i said i can mod and all that i just dont know SOME SOME SOME SOME things... of modding because i have other stuff to pay attention too also so yea ive been busy around

- i tried seeds and pwners and they both dont work and i am about to try lilts and if that doesnt work... than i give up im going to let security do it for me cuz im pissed off and thats what i am focusing on getting so far.. btw security xfire me when you get it working and plz dont lie. [mad][pimp][sniper][smokin][evil]
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»