Author Topic: Single Flashbang  (Read 10838 times)

0 Members and 1 Guest are viewing this topic.

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Single Flashbang
« on: July 13, 2010, 08:57:49 am »
Name: Flash!

Author: Mighty
Script version: 3.2.0
Server version: 2.6.5
Release Date: 13th of July 2010
Last update: 20th of July 2010
Description:
Script gives player flashbang after using "/flash" command. It saves his weapons of course and after using flash they are given back. Very usefull at RS servers, can be easily modified and included to any shop system. Just modify some stuff in OnPlayerCommand. Would be awesome thing to be seen on Real & Survival servers - perfect anti-camp tool. Just in case someone didn't notice: script DOES include line of sight, it doesnt blind players behind the walls.

Preview: Demo (ofc with flashbreak = 0)

Flash320.rar includes 3 files! Includes.txt, Flash320_Normal.pas & Flash320_Survival.pas. In Survival one you can have only 1 flash per round. Default script set (in Includes.txt) is Flash320_Normal.pas

Admin Commands:

Command           X values        Default       Description
/flashhelp--Shows admin commands
/flashmod X1/01Turn the script ON/OFF
/flashwait Xseconds3Time till knife explodes (counted since hitting smth)
/flashlen Xticks?200Blinding time
/flashrange Xdistance700Blinding range
/flashbreak Xminutes4Flash picking interval (not in Survival script: 1 flash/round there)

Player Commands:

Command           X values        Default       Description
/flash--Gives player a flashbang as secondary
!flash--Sends some info about the script




Notes:
  *  Remember that flash spot is place where knife hits, not where it lands!

---

---

Code: {snippets}
Code: [Select]
(...)
if FlashesOnCount > 0 then
begin
for i:=1 to 128 do
begin
if (Flash[i].Counter > 1)  then
begin
if (GetObjectStat(Flash[i].LinkedTo,'active') = true) then // If still on the ground
begin
// countinue countdown
Flash[i].Counter := Flash[i].Counter - 1;
end
else if (GetObjectStat(Flash[i].LinkedTo,'active') = false) then // If picked up during countdown
begin
WriteConsole(0,'Impressive! FlashBang picked up!',Yellow);
Flash[i].Counter := 0; // reset counter
FlashesOnCount := FlashesOnCount - 1; // substract picked knife
Flash[i].CounterStarted := FALSE; // reset vars so the flash can be used again
Flash[i].Used := FALSE;
ObjectLinked[Flash[i].LinkedTo] := FALSE; // unlink the object completely
end;
end;
if (Flash[i].Counter = 1) then // 1 because then there is no 2nd statement needed
begin
Flash[i].BlindMade := TRUE;
Flash[i].Counter := 0;
WriteConsole(0,'  *  Flash!  *  ',White);
for j:=1 to MaxPlayers do
if CheckFlash(i,j) = TRUE then Blind(j);
FlashesOnCount := FlashesOnCount - 1;
Flash[i].CounterStarted := FALSE;
Flash[i].Used := FALSE;
ObjectLinked[Flash[i].LinkedTo] := FALSE;
KillObject(Flash[i].LinkedTo); // totaly kill the knife (no longer on map)
end;
end;
end;
(...)

Questions? Bugs? Report please --> macekmil@gmail.com

« Last Edit: October 11, 2011, 05:59:19 am by Mighty »
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Single Flashbang
« Reply #1 on: July 13, 2010, 01:06:32 pm »
sounds really neat!
questions - does it include:
1. line-of-sight?
2. less time/less blinding if relatively far?
  ie:  flashrange: 100  flashlen: 100
if within range of 0-25, full time and full blinding
if within range of 25-100, decrease time and blinding linearly (to minimum of 25/25)

dunno if i explained well... but does it include something like that?
Can't think of anything original to put here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Single Flashbang
« Reply #2 on: July 13, 2010, 05:30:59 pm »
Had a quick look and doesn't seem so.

Seeing as line of sight is a pretty major feature of Realistic, I think you should add it, at least as an option. Just add a quick raycast option before the blind procedure is called.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Single Flashbang
« Reply #3 on: July 13, 2010, 07:29:18 pm »
Does it work with different fonts ?
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Single Flashbang
« Reply #4 on: July 13, 2010, 10:59:22 pm »
Unlikely. He uses the string 'WWWWWW' to white out the screen, probably the worst character choice, no need for six of them either.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Single Flashbang
« Reply #5 on: July 13, 2010, 11:27:50 pm »
someone explain how WWWWWW will blank the screen!
i think he should incorporate the points i've made!
it would make it much better!
exclamation mark!
Can't think of anything original to put here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Single Flashbang
« Reply #6 on: July 14, 2010, 04:28:13 am »
The way typically used to fill a players screen with a colour is to use a large drawtext.
Any character will work, as long as it is large enough and not off the screen, there is no reason to use WWWWWW specifically, just a personal choice by the scripter.

All your points were good and I second them, they are rather standard and easy enough to implement, so why not?
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Single Flashbang
« Reply #7 on: July 14, 2010, 04:58:36 am »
questions - does it include:
1. line-of-sight?
2. less time/less blinding if relatively far?

1. I'm not sure if I understand it well, would you explain please? I'm not R&S player by the way. If you meant that it shouldn't blind players behind a wall for example - it doesn't. Believe me, many RayCasts used there, just to be sure. One was not enough
2. Nope, but I will add it ;) good idea.

What points you made do you mean?

Sometimes flashes just don't blow up. I actually don't have any idea why but I'm gonna check it more minutely. For now: just change your weapons few times both before and after using "/flash" cmd. Let's say you arm your nade that way :P

@xmRipper: nope, it doesn't
« Last Edit: July 14, 2010, 07:16:42 am by Mighty »
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Polifen

  • Soldier
  • **
  • Posts: 127
Re: Single Flashbang
« Reply #8 on: July 15, 2010, 02:29:30 am »
Sometimes flashes just don't blow up. I actually don't have any idea why but I'm gonna check it more minutely. For now: just change your weapons few times both before and after using "/flash" cmd. Let's say you arm your nade that way :P

Did you try "blowing" a bit higher than the knife really is? Maybe RayCast see floor as a furthest point ( like knife is on -1, floor is on 0 and player is on 1. RayCast form -1 says 0 is a wall ).

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Single Flashbang [Updated to 3.0.0]
« Reply #9 on: July 15, 2010, 03:11:42 am »

Update to 3.0.0!

Changelog and new ver added to 1st post!

Download: Flash 3.0.0


@up: I don't mean not blinding (it actually blows up 5px higher also), I'm getting some problems with detecting which knife is a flashbang. I've got an idea how to fix it tho, I'm working on it, we'll see if it works after next update
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Single Flashbang [Updated to 3.0.0]
« Reply #10 on: July 15, 2010, 09:23:23 am »
You should make a molotov script too !  :D
it would be nice  ;)

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Single Flashbang [Updated to 3.0.0]
« Reply #11 on: July 15, 2010, 11:42:41 am »
not a big deal, i can make such modification later
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

DarkCrusade

  • Guest
Re: Single Flashbang [Updated to 3.0.0]
« Reply #12 on: July 15, 2010, 12:40:53 pm »
Instead of...
Code: [Select]
if (...) then begin
  if (...) then begin
    if (...) then begin
      (.....)
    end;
  end;
end;

...you can just use:
Code: [Select]
if (...) AND (...) AND (...) then begin
  (.....)
end;

One thing about booleans:

Bad:
Code: [Select]
if (ABC = true) then begin
  if (DEF = false) then begin
    (.....)
  end;
end;

Good:
Code: [Select]
if (ABC) AND (not DEF) then begin
  (.....)
end;

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Single Flashbang [Updated to 3.1.0]
« Reply #13 on: July 16, 2010, 08:18:26 am »
About comparing booleans, yeah, i know, tho the script is 10 times clearer for me with the useless stuff

And about ANDs & ORs, I found only 1 place in whole script where using AND instead of 2nd IF would make sense.

There is no offence in that post btw ;)



Update to 3.1.0!

Changelog in 1st post

>>DOWNLOAD 3.1.0<<
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Single Flashbang [Updated to 3.1.0]
« Reply #14 on: July 16, 2010, 08:28:57 am »
Instead of...
Code: [Select]
if (...) then begin
  if (...) then begin
    if (...) then begin
      (.....)
    end;
  end;
end;

...you can just use:
Code: [Select]
if (...) AND (...) AND (...) then begin
  (.....)
end;
Actually the first option is faster especially with heavy functions in conditions. If the first one is false then the rest is not checked unlike in the second example.

Also AND does not have to be written in upper case

DarkCrusade

  • Guest
Re: Single Flashbang [Updated to 3.1.0]
« Reply #15 on: July 16, 2010, 08:40:17 am »
Writing and in upper case is just my personal coding style.

Actually it depends on what you want to do..

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Single Flashbang [Updated to 3.1.0]
« Reply #16 on: July 16, 2010, 09:16:14 am »
Instead of...
Code: [Select]
if (...) then begin
  if (...) then begin
    if (...) then begin
      (.....)
    end;
  end;
end;

...you can just use:
Code: [Select]
if (...) AND (...) AND (...) then begin
  (.....)
end;
Actually the first option is faster especially with heavy functions in conditions. If the first one is false then the rest is not checked unlike in the second example.

Also AND does not have to be written in upper case


If it's like C, then I believe you are mistaken. as soon as the first false result occurs, it skips the rest.  or is that just compiler-optimization?  or are all conditions rendered first in soldat core?
I also don't like the division by zero I can get in this case:
myvar = iif (b=0, -1, a/b).


at any rate i case i have a question (if someone can answer :D)
Code: [Select]
if (condition1) then
if (condition2) then
...
else
...;

under which if-statement is does the else-statement operate.  Is it the same in C as it is in soldat?
Can't think of anything original to put here...

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Single Flashbang [Updated to 3.1.0]
« Reply #17 on: July 16, 2010, 09:40:32 am »
I'm 100% sure it's under second one.
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: Single Flashbang [Updated to 3.1.0]
« Reply #18 on: July 16, 2010, 09:42:20 am »
Add so that after throwing the knife was possible only after 5 minutes. And to be able to set this up with the command. While most existing possi settings.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Single Flashbang [Updated to 3.1.0]
« Reply #19 on: July 16, 2010, 09:42:40 am »
Quote
If it's like C, then I believe you are mistaken. as soon as the first false result occurs, it skips the rest.  or is that just compiler-optimization?  or are all conditions rendered first in soldat core?
It doesn't skip the rest, it checks all

Quote
at any rate i case i have a question (if someone can answer )
Code: [Select]
if (condition1) then
if (condition2) then
...
else
...;

under which if-statement is does the else-statement operate.  Is it the same in C as it is in soldat?
Under the second