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

Members Online

»
0 Active | 12 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
Previous Page Next Page
subscribe
Author Topic: Pick numbers
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, 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.
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 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.
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 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
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
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
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
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?
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
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?
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Dec. 5, 2010 07:45 pm
Thread it anywhere. Somewhere at the beginning of the game.

No, you don't want to subtract, you want to add. Don't you?
And what's wrong with putting it in the beginning? If you put it in the end, yes, you'll likely get weird things happening
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
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.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Dec. 5, 2010 08:15 pm
Even so, it WILL not work!
DO NOT USE ABOVE CODE.

It will mess stuff up badly when you call more than 1 message.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Dec. 5, 2010 09:50 pm
All right thank you! :)
Share |
Restricted Access Topic is Locked
Page
Previous 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

»