Author |
Topic: Pick numbers |
|
Category: CoD2 Scripting Posted: Saturday, Dec. 4, 2010 10:47 am |
|
Hi all
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 |
|
|
|
SQUISHY44 |
|
General Member Since: Apr 16, 2007 Posts: 213 Last: Jul 20, 2011 [view latest posts] |
|
|
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;
}
|
|
|
|
|
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). |
|
|
|
Pedro699 |
General Member Since: Jun 19, 2006 Posts: 781 Last: Dec 18, 2010 [view latest posts] |
|
|
|
|
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. |
|
|
|
|
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) |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
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;
|
|
|
|
|
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();
} |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
|
|