PDA

View Full Version : Grey Screen



Loveboy
16th June 2013, 16:27
Hey Guys, i have a question:

Its possible to delete all colours and only set white and black for 20 secounds in a script?
(So grey screen [black+white without green blue red...])

kung foo man
16th June 2013, 17:00
You can precache the shader "black" and make it over the whole screen with setShader("black", 640, 480) IIRC and .alpha = 0.5

Maybe somebody want to figure out precisely

randall
16th June 2013, 17:39
set the shader to black/white and:
.color = (0.7,0.7,0.7) :D

guiismiti
16th September 2014, 18:03
I know it's an old thread, but I'm using it.
Call on player



blackAndWhiteScreen()
{
blackandwhite = newClientHudElem(self);
blackandwhite.vertAlign = "fullscreen";
blackandwhite.horzAlign = "fullscreen";

blackandwhite.alpha = 0.5;
blackandwhite setShader("black", 640, 480);

wait(20);

blackandwhite destroy();
}


The only thing is, this isn't actually black and white, it's just darkened.
Although I tried using the attribute color, it didn't change anything. I tried setting it as green and not grey, didn't work.



blackandwhite.color = (0,0.7,0);

kung foo man
16th September 2014, 18:34
Maybe "white" instead of "black"? And then using the color attribute with low numbers like (0.3, 0.3, 0.3), which should turn it darkish (just guessing).

serthy
16th September 2014, 18:49
in DirectX9 mode you can shellshock some1 and its black/white for a few secs

Tally
16th September 2014, 20:23
I know it's an old thread, but I'm using it.
Call on player



blackAndWhiteScreen()
{
blackandwhite = newClientHudElem(self);
blackandwhite.vertAlign = "fullscreen";
blackandwhite.horzAlign = "fullscreen";

blackandwhite.alpha = 0.5;
blackandwhite setShader("black", 640, 480);

wait(20);

blackandwhite destroy();
}


The only thing is, this isn't actually black and white, it's just darkened.
Although I tried using the attribute color, it didn't change anything. I tried setting it as green and not grey, didn't work.



blackandwhite.color = (0,0.7,0);


You should always set the player flag in front of client elements:


blackAndWhiteScreen()
{
// check in case element is already on player's screen
if( isdefined( self.blackandwhite ) )
self.blackandwhite destroy();

blackandwhite = newClientHudElem( self );
blackandwhite.alpha = 1;
blackandwhite.x = 0;
blackandwhite.y = 0;
blackandwhite.alignX = "left";
blackandwhite.alignY = "top";
blackandwhite.horzAlign = "fullscreen";
blackandwhite.vertAlign = "fullscreen";
blackandwhite.foreground = true;
blackandwhite.color = (0.502, 0.502, 0.502);
blackandwhite setShader( "white", 640, 480 );

self.blackandwhite = blackandwhite;

wait( 20 );

// always check for defined element in case player has disconnected. If you don't it will throw an error
if( isdefined( self.blackandwhite ) )
self.blackandwhite destroy();
}

IzNoGoD
16th September 2014, 21:38
ehm why?
Just check if self is still defined, so you know the player hasnt disconnected

Setting it to a player var might cause your script to overwrite said var and double the hud elem, making one hud elem indestructable for it has lost its pointer

I use a lot of local hud elements in some of my mods, and it works fine. No need for a player var.

guiismiti
16th September 2014, 21:57
Why is it that I can't generate valid material+image with the asset_manager?
I created a jpg file (supported format), it's a 512x512 green square. Then I followed the steps from this tutorial and got two tiny files. I set the green square as a fullscreen shader and I get an error when trying to load it.


ERROR: Couldn't open techniqueSet 'materials/techniquesets/
=soE`v.gdf
green
104
912561463
79
.te'
WARNING: Could not find material 'green'


Also tried using DXT5 instead of DXT3.
It's the same error I was having with the killIcon yesterday when I gave up, but using the asset manager to create iwi+material seems like a very basic thing for modding.
Thanks in advance.

@kung foo man - I'm gonna try to use the white shader now.
Tested - alpha 0.4 and color(0,0.5,0) looks really nice.

Tally
16th September 2014, 22:07
ehm why?
Just check if self is still defined, so you know the player hasnt disconnected

Setting it to a player var might cause your script to overwrite said var and double the hud elem, making one hud elem indestructable for it has lost its pointer

I use a lot of local hud elements in some of my mods, and it works fine. No need for a player var.

Hud elements are not vars. They are structs. Furthermore, and here is a PRO-TIP: if you check to see if the hud element is defined before you create it, you will never double your hud elements.

And finally, all client hud elements are player elements. It is impossible for them to be otherwise. That is why they are called CLIENT elements. As in PLAYER! So, your nonsense-talk about local vars vs player vars is completely invalid.

Tally
16th September 2014, 22:12
Why is it that I can't generate valid material+image with the asset_manager?
I created a jpg file (supported format), it's a 512x512 green square. Then I followed the steps from this tutorial and got two tiny files. I set the green square as a fullscreen shader and I get an error when trying to load it.


ERROR: Couldn't open techniqueSet 'materials/techniquesets/
=soE`v.gdf
green
104
912561463
79
.te'
WARNING: Could not find material 'green'


Also tried using DXT5 instead of DXT3.
It's the same error I was having with the killIcon yesterday when I gave up, but using the asset manager to create iwi+material seems like a very basic thing for modding.
Thanks in advance.

@kung foo man - I'm gonna try to use the white shader now.

You cannot use .JPG to create a materials + .IWI file. It must be either .DDS or .TGA

guiismiti
16th September 2014, 22:47
Does anything look wrong? Spent quite some time without success so far.

This is how I saved the DDS file:
762

This is the asset manager:
763

The result of the asset manager are 40~50 bytes iwi and material.
This is the material file opened with a hex edittor:
764

Tally
16th September 2014, 23:15
That is not a valid materials file. You aren't saving your .GDT file in the right location. It has to go into [COD2 INSTALL]/source_data/[name_of_custom_file].gdt

Whenn you open Asset Manager, click "open" and navigate to the source_data folder and open your .GDT file. Then, click the entry you want to compile, and it should all work properly then.

guiismiti
16th September 2014, 23:31
Really stupid mistake..... I was getting the output .iwi from the cache directories instead of main/images.

Thanks for helping anyway. I'm also saving the gdt on source_data from now on.

765

IzNoGoD
17th September 2014, 00:02
Hud elements are not vars. They are structs. Furthermore, and here is a PRO-TIP: if you check to see if the hud element is defined before you create it, you will never double your hud elements.

And finally, all client hud elements are player elements. It is impossible for them to be otherwise. That is why they are called CLIENT elements. As in PLAYER! So, your nonsense-talk about local vars vs player vars is completely invalid.
Im just saying that if you know what you're doing you dont need to store the hud in a player.var, but you can keep it in a normal var. (or struct for that matter, as hud elems are a special kind of struct again)

Tally
17th September 2014, 00:21
Im just saying that if you know what you're doing you dont need to store the hud in a player.var, but you can keep it in a normal var. (or struct for that matter, as hud elems are a special kind of struct again)

I know what I'm doing. But ever since I first met you, you've been trying to teach me how to mod. I keep telling you I know how to do it already, but you keep insisting on trying to teach me. If you can't get the message, then best if you don't reply to any of my posts. That way you wont fuck me off any more than you already have.

Are we clear? Or do I need to draw you a picture?

guiismiti
17th September 2014, 01:40
This is the final result for the green screen.
This will create the green screen and also two vertical black bars aligned to left and right to make you have a squared view instead of fullscreen (rectangular) view.
Tested on 1366x768 and 640x480, but not on 1920x1020 (although it should work).
The only thing is, I set sort to 0 but the black bars are still over the clock.



cameraScreen()
{
if(isdefined(self.hud_green))
self.hud_green destroy();

self.hud_green = newClientHudElem(self);
self.hud_green.vertAlign = "fullscreen";
self.hud_green.horzAlign = "fullscreen";
self.hud_green.alpha = 0.4;
self.hud_green setShader("white", 640, 480);
self.hud_green.color = (0,0.5,0);
self.hud_green.sort = 0;

if(isdefined(self.hud_black1))
self.hud_black1 destroy();

self.hud_black1 = newClientHudElem(self);
self.hud_black1.vertAlign = "fullscreen";
self.hud_black1.horzAlign = "center";
self.hud_black1.x = -492;
self.hud_black1.alpha = 1;
self.hud_black1 setShader("white", 180, 480);
self.hud_black1.color = (0,0,0);
self.hud_black1.sort = 0;

if(isdefined(self.hud_black2))
self.hud_black1 destroy();

self.hud_black2 = newClientHudElem(self);
self.hud_black2.vertAlign = "fullscreen";
self.hud_black2.horzAlign = "center";
self.hud_black2.x = 312;
self.hud_black2.alpha = 1;
self.hud_black2 setShader("white", 180, 480);
self.hud_black2.color = (0,0,0);
self.hud_black2.sort = 0;
}


766

Loveboy
20th September 2014, 21:30
I just meant white-black screen like this:

767

guiismiti
20th September 2014, 21:44
Well I have no ideas for that

Tally
21st September 2014, 09:31
I just meant white-black screen like this:

767

It can't be done in COD2. COD4 has engine functions to completely "wash" all color from the screen (r_filmEnable, r_filmContrast, r_filmDesaturation, r_filmInvert). No such functions exist in COD2.

guiismiti
21st September 2014, 16:18
I thought so