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...])
Printable View
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...])
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
set the shader to black/white and:
.color = (0.7,0.7,0.7) :D
I know it's an old thread, but I'm using it.
Call on player
The only thing is, this isn't actually black and white, it's just darkened.PHP Code:
blackAndWhiteScreen()
{
blackandwhite = newClientHudElem(self);
blackandwhite.vertAlign = "fullscreen";
blackandwhite.horzAlign = "fullscreen";
blackandwhite.alpha = 0.5;
blackandwhite setShader("black", 640, 480);
wait(20);
blackandwhite destroy();
}
Although I tried using the attribute color, it didn't change anything. I tried setting it as green and not grey, didn't work.
Code:blackandwhite.color = (0,0.7,0);
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).
in DirectX9 mode you can shellshock some1 and its black/white for a few secs
You should always set the player flag in front of client elements:
PHP Code:
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();
}
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.
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.
Also tried using DXT5 instead of DXT3.Code:ERROR: Couldn't open techniqueSet 'materials/techniquesets/
=soE`v.gdf
green
104
912561463
79
.te'
WARNING: Could not find material 'green'
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.
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.
Does anything look wrong? Spent quite some time without success so far.
This is how I saved the DDS file:
Attachment 762
This is the asset manager:
Attachment 763
The result of the asset manager are 40~50 bytes iwi and material.
This is the material file opened with a hex edittor:
Attachment 764
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.
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.
Attachment 765
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?
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.
Attachment 766PHP Code:
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;
}
I just meant white-black screen like this:
Attachment 767
Well I have no ideas for that
I thought so