Raised This Month: $ Target: $400
 0% 

Trying to get a user's screen to go black for 2 seconds...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 06-14-2006 , 00:56   Trying to get a user's screen to go black for 2 seconds...
Reply With Quote #1

I'm useing screenfade....

But how do I get the duration to last for 2 seconds? I'm just not sure what "type" i.e. ms or s the message accepts...

I'm doing:

Create_ScreenFade( iAttacker, 2, (1<<10), (1<<12), 0, 0, 0, 255 );


Code:
stock Create_ScreenFade(id, duration, holdtime, fadetype, red, green, blue, alpha){     message_begin( MSG_ONE,gmsgScreenFade,{0,0,0},id )              write_short( duration )         // fade lasts this long duration     write_short( holdtime )         // fade lasts this long hold time     write_short( fadetype )         // fade type (in / out)     write_byte( red )               // fade red     write_byte( green )             // fade green     write_byte( blue )              // fade blue     write_byte( alpha )             // fade alpha     message_end() }

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-14-2006 , 01:07  
Reply With Quote #2

i believe that the duration is in decisecs, so try 20 instead of 2
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 06-14-2006 , 01:10  
Reply With Quote #3

nope :/
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-14-2006 , 01:11  
Reply With Quote #4

i don't know why, but i would also try duration and holdtime both at 20
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 06-14-2006 , 01:15  
Reply With Quote #5

hehe yea i did that too :/ Been trying a bunch of diff. combos... My current solution is to loop a set_task at 0.1 seconds... it works but i'd prefer just giving it a longer time :/
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 06-14-2006 , 01:16  
Reply With Quote #6

This is a stock from superhero

Code:
stock setScreenFlash(id, red, green, blue, decisecs, alpha) {     if (!is_user_connected(id)) return     message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)     write_short( 1<<decisecs ) // fade lasts this long duration     write_short( 1<<decisecs ) // fade lasts this long hold time     write_short( 1<<12 ) // fade type (in / out)     write_byte( red ) // fade red     write_byte( green ) // fade green     write_byte( blue ) // fade blue     write_byte( alpha ) // fade alpha     message_end() }

and here is an example of it being used

Code:
            new alphanum = damage * 2             if (alphanum > 200) alphanum = 200             else if (alphanum < 40) alphanum = 40             setScreenFlash(attacker, 255, 10, 10, 10, alphanum )  //Red Screen Flash

this ends up being a pretty quick red flash with a varying alpha ammount.

Some colors are not allowed so you might want to try another color first (like the one I use here works for sure). Another option would be to use a message logger and then enable that cvar "fadetoblack". Catch that message and then replicate it.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-14-2006 , 01:18  
Reply With Quote #7

hehe, thats actually what ive got going on in my pokemod... another thing you could do is
Code:
		message_begin(MSG_ONE,gmsgFade,{0,0,0},id)
		write_short( 15 )
		write_short( 15 )
		write_short( 12 )
		write_byte( r )
		write_byte( g )
		write_byte( b )
		write_byte( alpha )
		message_end()
and then when you want it to end you can just do your create_screenfade.

anyone got an answer, im curious now also.

edit: jtp, i dont know if it was you i talked to, but with that, it still wouldnt go over 1 second.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
VEN
Veteran Member
Join Date: Jan 2005
Old 06-14-2006 , 05:57  
Reply With Quote #8

jtp10181: Let's say i input 50 decisecs (5 seconds) duration will be 1_125_899_906_842_624, doesn't seems to be correct. ;)

Below is the my method.


For int seconds:
Code:
#define SECONDS_TO_SCREENFADE_UNITS(%1) ((1<<12) * (%1))

For float and int seconds (a bit slower):
Code:
#define SECONDS_TO_SCREENFADE_UNITS(%1) floatround(float((1<<12)) * (%1))

Last edited by VEN; 10-02-2006 at 06:52. Reason: fixed
VEN is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 06-14-2006 , 09:47  
Reply With Quote #9

yeah I don't know how the seconds works really, thats just what was in there when I started working on SH. Like I said, best bet would be to catch a message and then copy it.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
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 08:06.


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