Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Avarax on February 29, 2008, 10:53:14 am

Title: Ready Made: Bullet Shockwave
Post by: Avarax on February 29, 2008, 10:53:14 am
Script Name: Wave();
Script Description: Creates a customizable wave of bullets
Original Author(s): Avarax
Core Version: 2.6.3


(http://home.arcor.de/avarax3/shockwave.bmp)

Some wave shapes and combinations I came up with, while experimenting with the parameters.



Code: [Select]
Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
This procedure creates a greatly customizable wave of bullets based on geometrical calculations and the parameters you give it. Feel free to implement it into your script, but give credit ;)

Here's an explanation of the parameters:

X,Y - Starting position of the wave (the coordinates refer to the middle of the wave)
Direction - The wave's flight direction measured in radiant. You can calculate the direction from point A to point B with the Aim() function I added to the below link.
Offset - How far away the wave is from the starting XY coordinates on creation.
Radius - The radius of the wave in relation to its theoretic centre. Less radius means more curvyness.
Speed - Travel speed of the wave.
Power - The power multiplicator of the created bullets.
RoomPerBullet - How far away is from each other is each bullet forming the wave?
Radiation - A higher value makes the wave spread in a more circleish shape as it moves along. A Radiation of 0 makes it spread linear. A Radiation of 1 equates a full circle spread. Negative values can look quite funky :) (the knife pic uses some negative radiation)
Bullettype - Bullettype of the created bullets
Bulletcount - Number of bullets forming the shockwave
Owner - Owner of the bullets


NOTE: To create effects like in the pics above, you'll have to use Wave() multiple times.



Code with Aim() function (http://nopaste.com/p/aZz8smQRN)[/size]
Title: Re: Ready Made: Bullet Shockwave
Post by: rumpel on February 29, 2008, 12:43:08 pm
omg thats damn hot
gj avarax

edit:// yeah Hallo liebe Pornofreunde xD
Title: Re: Ready Made: Bullet Shockwave
Post by: Mr on February 29, 2008, 02:59:19 pm
Yay nice pic and nice script *install* :D

// EDIT:

can you give an exampe xD ?
Title: Re: Ready Made: Bullet Shockwave
Post by: xmRipper on February 29, 2008, 03:15:55 pm
Awesome script but need an example.
Title: Re: Ready Made: Bullet Shockwave
Post by: DorkeyDear on February 29, 2008, 03:55:09 pm
Dang, this looks 100x better than the last "Ready Made" thing you made that makes circle-type thing that I can't remember the name of :P

Do you remember what all or most of the parameters were in the cool negative radiation value effect?
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on February 29, 2008, 04:52:58 pm
mehehe =P
Nice math ;)

Gotta include this in an effects pack if one will ever be released xD
Title: Re: Ready Made: Bullet Shockwave
Post by: Avarax on March 01, 2008, 05:00:08 am
Ok... some examples:

Effect of an upcoming skill in MiracleMod called "Magmabreath" with simplified parameters. Becomes bigger as you move faster.
Code: [Select]
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.27,60,100,2.7+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.18,55,90,2.6+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.09,50,80,2.5+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),45,70,2.4+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.09,40,60,2.3+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.18,35,50,2.2+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.27,30,40,2.1+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);



Negative radiation wave. It will only look really cool and curvy in the first few moments, then it will kinda turn itself inward and back outside to proceed like a usual wave.
Code: [Select]
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),10,100,13,40,3,-0.8,13,20,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),30,80,13,40,2.8,-0.8,13,20,ID);


Some sort of lightning beam:
Code: [Select]
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),20,35,19,100,1.9,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),30,35,19,100,1.95,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),40,35,19,100,2,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),50,35,19,100,2.05,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),60,35,19,100,2.1,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),70,35,19,100,2.15,0,14,5,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),80,35,19,100,2.2,0,14,5,ID);



If you use a lot of bullets combined with a rather high RoomPerBullet and a small Radius, you can also create bullet circles like "cages" around a player. Cluster fragments are great for this.
Title: Re: Ready Made: Bullet Shockwave
Post by: chutem on March 01, 2008, 05:09:28 am
I just love bullet things like this :P

EDIT: I'm learning german at school, does that 'Hallo, Liebe Pornofreunde' translate into 'Hello, favourite pornofriend'? (i'm just guessing)
Title: Re: Ready Made: Bullet Shockwave
Post by: Laser Guy on March 01, 2008, 05:11:57 am
I copied the sccript into text editor and saved as a PAS file... made a folder called Wave in the Scripts folder and moved the Wave script into wave folder... And it doesn't work :(
Title: Re: Ready Made: Bullet Shockwave
Post by: chutem on March 01, 2008, 05:13:35 am
You need to call up the function, i.e. in an onplayercommand have it check the text for, say, /wave and then make it do a wave() with desired settings
Title: Re: Ready Made: Bullet Shockwave
Post by: Avarax on March 01, 2008, 05:19:51 am
"Hallo, liebe Pornofreunde" translates into "Hello, my dear Pornfans" or something like that :)
It's a phrase used in an 80's advertisement for some porn, used in this fine house tune (http://youtube.com/watch?v=6yGwKh7edLQ) by Finger & Kadell. Text is quite funny if you're able to translate it ;Q
Title: Re: Ready Made: Bullet Shockwave
Post by: chutem on March 01, 2008, 05:22:31 am
Oh i got confused with Lieblings.
Title: Re: Ready Made: Bullet Shockwave
Post by: Mr on March 01, 2008, 06:52:08 am
I just love bullet things like this :P

EDIT: I'm learning german at school, does that 'Hallo, Liebe Pornofreunde' translate into 'Hello, favourite pornofriend'? (i'm just guessing)

Hello, dear pornofriends
Title: Re: Ready Made: Bullet Shockwave
Post by: Laser Guy on March 01, 2008, 06:56:33 am
You need to call up the function, i.e. in an onplayercommand have it check the text for, say, /wave and then make it do a wave() with desired settings
No Idea what u talking bout, screens plz?
Title: Re: Ready Made: Bullet Shockwave
Post by: Avarax on March 01, 2008, 07:34:50 am
Something like this (http://nopaste.com/p/aI00QoAyh), so you have a command with which you can activate the wave.
Title: Re: Ready Made: Bullet Shockwave
Post by: Laser Guy on March 01, 2008, 08:57:13 am
Did as u told and nothing...
Title: Re: Ready Made: Bullet Shockwave
Post by: Boblekonvolutt on March 01, 2008, 07:23:20 pm
I copied the sccript into text editor and saved as a PAS file... made a folder called Wave in the Scripts folder and moved the Wave script into wave folder... And it doesn't work :(
What about the Includes.txt file?
Title: Re: Ready Made: Bullet Shockwave
Post by: chutem on March 01, 2008, 08:29:48 pm
The one attached should work, just put it in a folder (name doesn't matter) and make sure you put Includes .txt in it aswell
Title: Re: Ready Made: Bullet Shockwave
Post by: Laser Guy on March 02, 2008, 11:54:33 am
I copied the sccript into text editor and saved as a PAS file... made a folder called Wave in the Scripts folder and moved the Wave script into wave folder... And it doesn't work :(
What about the Includes.txt file?
Ahh, you reminded me, I didn't have one :P
Title: Re: Ready Made: Bullet Shockwave
Post by: Avarax on March 02, 2008, 04:04:26 pm
geez...
Title: Re: Ready Made: Bullet Shockwave
Post by: Laser Guy on March 02, 2008, 04:43:18 pm
geez...
Sorry, u can poke me in the eyes.
Title: Re: Macho
Post by: macho on March 28, 2008, 05:03:10 pm
this a wave look the example and learn

Lighting Beam:

function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
  If text = '/light' then begin
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),20,35,19,100,1.9,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),30,35,19,100,1.95,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),40,35,19,100,2,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),50,35,19,100,2.05,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),60,35,19,100,2.1,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),70,35,19,100,2.15,0,14,5,ID);
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),80,35,19,100,2.2,0,14,5,ID);
  end;
  Result := false;
end;


Magma Breath

function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
  If text = '/light' then begin
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.27,60,100,2.7+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.18,55,90,2.6+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))+0.09,50,80,2.5+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),45,70,2.4+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.09,40,60,2.3+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.18,35,50,2.2+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))-0.27,30,40,2.1+(abs(GetPlayerStat(ID,'VelX'))+abs(GetPlayerStat(ID,'VelY')))*1.4,40,5,0.7,5,4,ID);
  end;
  Result := false;
end;
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on March 28, 2008, 05:16:53 pm
what exactly would somebody learn from this? People who just started wont even get this to work, and people who know how to make this work dont need it <.<
Title: Re: Ready Made: Bullet Shockwave
Post by: amb2010 on March 28, 2008, 05:53:44 pm
When you post a snippet or something try using the code block function, makes it so much easier to read. And ya how is anyone suppose to get anything from that? It would probably help if you added parts that explained what it does...
Title: Re: Ready Made: Bullet Shockwave
Post by: alex56 on March 29, 2008, 08:38:28 pm
I've done all of the above and still haven't gotten any of the waves to work, even with includes.txt and the multiple examples, all of which I've tried
are you sure your not missing anything?
Title: Re: Ready Made: Bullet Shockwave
Post by: Hacktank on October 12, 2008, 06:44:49 pm
This script looks so cool but the link is broken, please fix it.
Title: Re: Ready Made: Bullet Shockwave
Post by: shantec on October 13, 2008, 07:41:53 am
Code: [Select]
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

Thats it, i think ;)
Title: Re: Ready Made: Bullet Shockwave
Post by: Hacktank on October 13, 2008, 04:15:41 pm
Shantec, that is the whole script? If so thank you but would it be used like so?: (i know i would have to change the parameters in procedure wave)
Code: [Select]
if Copy(Text,1,5) = '/shockwave ' then begin
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;
and how do you make commands like this only availabe to admins?
Title: Re: Ready Made: Bullet Shockwave
Post by: shantec on October 15, 2008, 01:46:41 pm
Code: [Select]
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

function OnCommand(ID: byte; text: string): boolean;
begin
  if text = '/YOURCOMMANDHERE' then begin  //// <---- Modify the YOURCOMMANDHERE
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),20,35,19,100,1.9,0,14,5,ID);  /// modify the wave, add more waves if you like
  end;
 result := false;
end;
Title: Re: Ready Made: Bullet Shockwave
Post by: JotEmI on December 31, 2008, 08:58:24 am
I've used this procedure (which is great, good job Avarax) several times in my scripts. Now I'm making a new one, little rpg mod and strange thing happens. Procedure Wave() seems to create one extra bullet according to the value in Bulletcount. If I set Bulletcount to "2' then Wave() creates 3 bullets, if I set "0' then 1 bullet is created and so on. It looks like the CreateBullet() inside the Wave() is called one time too many. Does anyone know what is the cause of this strange behaviour?
Title: Re: Ready Made: Bullet Shockwave
Post by: y0uRd34th on December 31, 2008, 11:33:07 am
Can someone say me how i can make that the bullets fly i all directions??
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on December 31, 2008, 11:38:04 am
Can someone say me how i can make that the bullets fly i all directions??
something like this? http://forums.soldat.pl/index.php?topic=20784.0
Title: Re: Ready Made: Bullet Shockwave
Post by: y0uRd34th on January 01, 2009, 07:34:34 am
Is it possible that i can the bullets shot on a bot or Player? not in the direction in that you move?
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on January 01, 2009, 09:33:50 am
Is it possible that i can the bullets shot on a bot or Player? not in the direction in that you move?
use the aim() function
Title: Re: Ready Made: Bullet Shockwave
Post by: y0uRd34th on January 01, 2009, 10:46:34 am
Code: [Select]
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),20,35,19,100,1.9,0,14,5,ID);It's in the Code or do i have to add some lines for Aim() that it works right?
Code: [Select]
,Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY'))That's the full Code:
Code: [Select]
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
  if (X2 - X1)<>0 then begin
    if X1 > X2 then
      result:= arctan((y2 - y1) / (x2 - x1)) + Pi
    else
      result:= arctan((y2 - y1) / (x2 - x1));
  end
  else begin
    if Y2 > Y1 then result:= Pi/2 + Pi/4;
    if Y2 < Y1 then result:= -Pi/2 + Pi/4;
  end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

function OnCommand(ID: byte; text: string): boolean;
begin
  if text = '/wave' then begin
    Wave(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),Aim(0,0,GetPlayerStat(ID,'VelX'),GetPlayerStat(ID,'VelY')),20,35,19,100,1.9,0,14,5,ID);
  end;
 result := false;
end;
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on January 02, 2009, 06:51:35 am
If you want it to shoot from one player towards another, you need to give both players' coordinates to aim()
Something like Aim(GetPlayerStat(ID,'X'),GetPlayerStat(ID,'Y'),GetPlayerStat(anotherID,'X'),GetPlayerStat(anotherID,'Y'))
Title: Re: Ready Made: Bullet Shockwave
Post by: y0uRd34th on January 26, 2009, 02:17:02 pm
 ::) Forgot to say 'Thanks'  ::) Now i do it 'Thanks' lol ;D It's working fine...
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on January 27, 2009, 12:34:12 am
no problem...
Title: Re: Ready Made: Bullet Shockwave
Post by: frosty on February 02, 2009, 11:38:37 pm
what would happen if i used like 20 Wave()'s lol

how would i find how many i need?
Title: Re: Ready Made: Bullet Shockwave
Post by: danmer on February 03, 2009, 09:55:10 am
how would i find how many i need?
you try some and see if its not enough or too much >.<

what would happen if i used like 20 Wave()'s lol
your head explode
Title: Re: Ready Made: Bullet Shockwave
Post by: frosty on February 03, 2009, 05:14:14 pm
LOL ok so have a play with the script and find what i like

*taps the tips of his fingers like Dr.Evil*