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

Members Online

»
0 Active | 38 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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: Pick numbers
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 10:47 am
Hi all [wave]

I tryed a lot but did not get to make a script which takes numbers (not random, like 0, then 1, then 2...) for an array.

Could somebody help me?

Greetings
Share |
SQUISHY44
General Member
Since: Apr 16, 2007
Posts: 213
Last: Jul 20, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 11:07 am
Ok it's been a while but I'll give this a go (assuming you want to count up):
Code:

//other code
max = 0;
while(i = 0; i >= max; i++)  
{
iprintln(i);
wait 1.0;
}
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 11:21 am
No, it's to display different Hud messages with the same settings.

Code:
	self.mess[num] = newClientHudElem(self);


If I want to display more then one message, the different messages need a different value for numl. So I need to make a type of loop I think which sets a new value on the number if the number before is not destroyed (= the hud vefore is not destroyed).
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 11:34 am
I'm a little confused. Can you explain what you want to do more thoroughly?

If you just want a set of rotating messages in the same place there is no need to create new hudelems for each one - you can just change the contents of the message.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 11:42 am
There will be 2 or 3 lines, one under the other, with the same hud characteristics. And at the same time. So with one script he need to look which number of hud he takes, and then, if the number is e.g. 1, the y position will be X+(num*12) (X the original position, num in this case 1), and if it's an other line, he makes num*13 (num = 2 e.g.) (and the first one is X+(num*12), num = 0, so the original position X.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 03:57 pm
In other words: Different players get different messages with the same caracteristics, and I don't want to make

Code:
	self.message_1 = newClientHudElem(self);	
	self.message_2 = newClientHudElem(self);	
	self.message_3 = newClientHudElem(self);	
        ...


I would like to make

Code:
        self.message[num] = newClientHudElem(self);


but therefor I need something which gets the number. (and if 1 is got, then it needs to get 2, and so on)
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 05:28 pm
in init or smthing:
Code:
level.messages[0]="random message";
level.messages[1]="another random message";
level.currentmessage=0;
for(i=0;i<level.messages.size;i++)
       precachestring(level.messages[i];


per player messages:
Code:

self.messagehudelem=newclienthudelem(self);
self.messagehudelem settext(level.messages[level.currentmessage]);
level.currentmessage++;
if(level.currentmessage>level.messages.size)
      level.currentmessage=0;
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 05:52 pm
But this does not work with what I need.

I do it like this:

Code:
//in any part of the tdm.gsc
self thread showMessage(&"YOU_WERE_KILLED");
self thread showMessage(&"NOW_YOU_DIE");	


And then the thread:

Code:

ShowMessage(message)
{
        //and now here would need to be this number definer and checker
	self.message[num] = newClientHudElem(self);	
	self.message[num].x = 0;
	self.message[num].y = -100;
	self.message[num].alignX = "center";
	self.message[num].alignY = "middle";
	self.message[num].horzAlign = "center_safearea";
	self.message[num].vertAlign = "center_safearea";
	self.message[num].alpha = 1;
	self.message[num].archived = false;
	self.message[num].font = "bigfixed";
	self.message[num].fontScale = 0.625;
	self.message[num].label = (message);

	wait 6;

	self.message[num] fadeOverTime(2);
	self.message[num].alpha = 0;
	self.message[num] destroy();
}
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 06:07 pm
Why dont you just destroy the old hudelem?
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 06:26 pm
Because the messages dont appear one after the other, they appear at the same time.
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

»