Raised This Month: $51 Target: $400
 12% 

Changing Sprite Alpha in-Game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 05-17-2010 , 09:43   Changing Sprite Alpha in-Game
Reply With Quote #1

I'm trying to get a car's brake lights get brighter when the player presses the brakes. It detects when the player is hitting the brakes or not which is good. Problem is I don't know how to make the sprites brighter or not.

Here is the code trying to make them brighter:

PHP Code:
        new car_index g_CarIndex[car];
        new 
max g_CarLightQuantity[car_index];
        if (
max 0)
        {
            new 
buffer 0;
            
decl light;
            do
            {
                
light g_CarLights[car_index][buffer];
                
SetVariantString("255");
                
AcceptEntityInput(light"Alpha"lightlight0);
                
buffer += 1;
            } while (
buffer max);
        } 
I can't get the alpha to go up to 255. (They spawn at only 100.) I can get them to turn off when the player exits the car, but I can't change their brightness.
NatalyaAF is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 05-17-2010 , 10:12   Re: Changing Sprite Alpha in-Game
Reply With Quote #2

which entity are you using for the sprite? alpha is transparency not brightness.
blodia is offline
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 05-17-2010 , 10:24   Re: Changing Sprite Alpha in-Game
Reply With Quote #3

I guess transparency would do the same thing. I am using env_sprite for it.
NatalyaAF is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 05-17-2010 , 10:50   Re: Changing Sprite Alpha in-Game
Reply With Quote #4

AFAIK: That is not really possible after entity has been already created. I had the same issue when tried to create transparent icons above player's head and had to use proxies for that.
http://developer.valvesoftware.com/w...terial_Proxies
http://developer.valvesoftware.com/w...terial_Proxies
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 05-17-2010 , 12:23   Re: Changing Sprite Alpha in-Game
Reply With Quote #5

looking at http://developer.valvesoftware.com/wiki/Env_sprite you could try the glow proxy.

assuming this is for css you could wait until the update and get access to orange box input features for colour intensity.

you could also try a env_lightglow http://developer.valvesoftware.com/wiki/Env_lightglow.
blodia is offline
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 05-17-2010 , 12:32   Re: Changing Sprite Alpha in-Game
Reply With Quote #6

Thx for the help guys. Since it wasn't possible to edit the sprites, I came up with a new solution... I spawned 4 env_sprites instead of two, so each brake light had two. They all get turned off when the car is not being used, but when you hop in the car only two which have renderamt 100 get displayed. Then, when you hit the brakes the other two which have renderamt 155 get displayed, giving the illusion of a renderamt 255 sprite over each tail light. When you release the brakes I used HideSprite on the two 155 sprites, so you again only see the originals which are 100.








Last edited by NatalyaAF; 05-17-2010 at 12:45.
NatalyaAF is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode