Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Avkon on July 25, 2007, 05:54:46 am

Title: Blackout Script
Post by: Avkon on July 25, 2007, 05:54:46 am
This is a really, really, really small script, and it's effect is to cause a 'blackout' for any specified player.

Here's the code:

Code: [Select]
if (StrPos('/blackout', Text) > 0) then begin
  DrawText(ID,'||',90,RGB(0,0,0),40,-2500,-500);
end;

Stick this into the OnCommand procedure, and anyone who types '/blackout' will be blinded temporarily, i.e. his/her screen goes black for sometime.
Of course, no one is going to type it themselves, but you can use this as some kind of 'skill' gained by a player, or the like usually found in RPG-modded servers.

Also, to create a blindflash instead of a blackout, edit:

Code: [Select]
RGB(0,0,0)
To:

Code: [Select]
RGB(255,255,255)
That's it! You can also change the RGB colors to anything you want.

To change the amount of time the player is blinded, edit:

Code: [Select]
90
To anything you want.
I've found 90, 125, and 165 work the best for me - they're long enough to have an effect, and short enough not to be annoying.

Enjoy! :)
Title: Re: Blackout Script
Post by: Flacid Assassin on July 25, 2007, 06:03:16 am
thats pretty cool, put in server and tell people to do it they will freak out haha
Title: Re: Blackout Script
Post by: zyxstand on July 25, 2007, 08:46:27 am
Doesn't it get messed up with different screen modes?!
Few things:
1) If a cap/kill message occurs while you're supposed to be blinded, the "black out" goes away.  Therefore make it be so that you create many short blackouts.
2) For an even better effect make the procedure be called like this:
BlackOut(color: Single; blacktime, fadetime: Byte);  //example:  Blackout($C0FF00FF, 3, 4);

Then read the transparency (using bitwise AND or subtracting its mod of a number) and decrease it linearly to 0 over the specified time.  This will create a fading blackout that's stays 75% (C0 = 75%) purple for the first 3 seconds and then it'll fade to visible again over the next 4 seconds.

If you want a blackout that's black for the first 5 seconds and then fades away slowly you would use:
BlackOut($FF000000, 5, 7);  // (I think FF = not transparent though it might be 00)
This creates a black screen for 5 seconds and then fades constantly over the next 7.

Also I think you should use #219 instead of || since #219 is a solid, full-sized block-character.
Title: Re: Blackout Script
Post by: DorkeyDear on July 25, 2007, 10:52:26 am
My font is set to Arial and this seems to not work with that font. :(
i changed the '||' to Chr(219) and that doesn't work for Arial neither.

So I guess this is meant for people with default font? :)
Title: Re: Blackout Script
Post by: xmRipper on July 25, 2007, 11:00:41 am
Yes, doesnt work with other fonts.
Title: Re: Blackout Script
Post by: Avkon on July 27, 2007, 03:42:08 pm
Hmm.. xyzstand, those are some really food ideas, but I'm not going to be doing any more scripting till my vacation's over, but thanks anyway, I'll see if I can get the time to do it.
Title: Re: Blackout Script
Post by: Master Chief43 on July 27, 2007, 06:56:17 pm
Hm... When the screen goes from blackout to normal, does it fade away of just goes back to normal in a flash?
Title: Re: Blackout Script
Post by: Avkon on July 28, 2007, 12:10:05 am
It fades away, but goes out in a flash if there's another DrawText event like how xyzstand said.
Title: Re: Blackout Script
Post by: Master Chief43 on July 28, 2007, 12:23:56 am
uh... Can you put this into PlayerDamage so every time someone gets hurt, screen will turn red? Also, can you make it transparent so you can still see alittle?
Title: Re: Blackout Script
Post by: Avkon on July 28, 2007, 02:48:18 am
Uhh... read my last post. :p
Title: Re: Blackout Script
Post by: Dizzy So 1337 on August 02, 2007, 12:54:32 am
... once someone figures out how to make working flashbangs with this puppy, the CS crowd is gonna go nuts :)
Title: Re: Blackout Script
Post by: DorkeyDear on August 02, 2007, 07:05:38 pm
... once someone figures out how to make working flashbangs with this puppy, the CS crowd is gonna go nuts :)
would be perfect with RayCast to check if the flash's blind hits the person! Should be a way to get a grenade's X,Y... :( like when it explodes, would be cool.
Title: Re: Blackout Script
Post by: Tosty on August 03, 2007, 02:06:32 am
Could someone make this so that it happens on another persons screen then post it here??
Title: Re: Blackout Script
Post by: 1221995 on August 04, 2007, 06:13:14 am
Thats a cool script