| Author |
Topic: Pick numbers |
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Saturday, Dec. 4, 2010 07:20 pm |
 |
i could be wrong im not sure if this is what your looking for but try this and tell me if this is what your looking for.
Code: game["hud_idk"] = &"hello there";
precacheString(game["hud_idk"]);
game["hud_idkagain"] = &"hello again";
precacheString(game["hud_idkagain"]);
level.idk = newHudElem();
level.idk.x = 520;
level.idk.y = 280;
level.idk setText(&"");
while(1)
{
level.idk fadeOverTime(1);
level.idk.alpha = 1;
level.idk setText(game["hud_idk"]);
wait 5;
level.idk fadeOverTime(1);
level.idk.alpha = 0;
wait 1;
level.idk fadeOverTime(1);
level.idk.alpha = 1;
level.idk setText(game["hud_idkagain"]);
wait 5;
level.idk fadeOverTime(1);
level.idk.alpha = 0;
wait 1;
}
you may want to precache those somewere else i just put those there so you know what im doing in the setText part of the code. |
 |
|
|
|
|
Category: CoD2 Scripting Posted: Saturday, Dec. 4, 2010 07:29 pm |
 |
Your script makes a message appear, disapear and then a new one appear.
What I would like is that it displays 2 messages at the same time, like:
Code: self thread showMessage(&"YOU_WERE_KILLED");
self thread showMessage(&"NOW_YOU_DIE");
and then:
Code: ShowMessage(message)
{
//the first time this script is called (YOU_WERE_KILLED), so now num=0
self.message[num] = newClientHudElem(self);
self.message[num].x = 0;
self.message[num].y = -100+(num+12); //-100+(0*12) = hud at -100
Code: ShowShowMessage(message)
{
//second time this script is called (NOW_YOU_DIE), so now num=1
self.message[num] = newClientHudElem(self);
self.message[num].x = 0;
self.message[num].y = -100+(num+12); //-100-(1*12) = hud at -112
So what I need is something which gives me this numbers. |
 |
|
|
| IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, Dec. 4, 2010 11:25 pm |
 |
Why do you want multiple hud elements?
Look through some localized string files and find this:
Code:
REFERENCE SD_OBJECTIVES
LANG_ENGLISH "Allies: Destroy target A or B by planting explosives at either location.\nAxis: Protect target A and B from being destroyed. If explosives are planted at either location, defuse them before they explode.\n"
Seems like \n gives you a new line.
So:
Code:
"You were killed \nNow you die"
might work |
 |
|
|
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 5, 2010 12:01 am |
 |
I already tryed, but is looks a little bit strange, because then the short line is not centered...
I saw at the Paulus Zombie mod is a script for that, but it gives a sciprt runtime error, and dont know how to fix.
P.D.: Maybe I could simply let some space before... but it's un professional :P
edited on Dec. 4, 2010 07:02 pm by Leal |
 |
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 223 Last: Mar 24, 2011 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 5, 2010 02:55 am |
 |
Code:
level waitill("connected",player)
player.messagenum = -1;
Thread that and loop it, sets a variable to -1 (will be 0 when it's needed) so we can start somewhere...
Then replace each:
Code:
self.message[num]
with
Code:
self.message[self.messagenum]
Basicaly the variable is going from 'num' to 'self.messagenum'
Then at the very beginning of the thread ShowMessage();
Just add
Code:
self.messagenum++;
And it should work? Am I going in the right direction? |
 |
|
|
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 5, 2010 10:55 am |
 |
Yes, something like that!
clanhelio writes...Quote:
Code:
level waitill("connected",player)
player.messagenum = -1;
Thread that and loop it, sets a variable to -1 (will be 0 when it's needed) so we can start somewhere...
Where do I thread this two lines?
The only thing, is that the messages destroy themselves after some time, that means that the numbers are aviable again.
Code: self.messagenum--;
Maybe this would work at the end ot f the thread ShowMessage(message), but if there are simultaneous messages there could be a error, couldnt it? |
 |
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 223 Last: Mar 24, 2011 [view latest posts] |
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 5, 2010 08:02 pm |
 |
No, I mean:
Code: ShowMessage(message)
{
self.messagenum++;
self.message[self.messagenum] = newClientHudElem(self);
[...]
self.message[self.messagenum] destroy();
self.messagenum--;
}
Because the message disappears (destroy) after some seconds, and a self.messagenum-- would be to say that you can use again the last number... But if there are simultaneus messages it may not work. |
 |
|
|
| IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|