Author Topic: Ready Made: Bullet Shockwave  (Read 13637 times)

0 Members and 1 Guest are viewing this topic.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Ready Made: Bullet Shockwave
« 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




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[/size]
« Last Edit: February 29, 2008, 10:54:55 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Ready Made: Bullet Shockwave
« Reply #1 on: February 29, 2008, 12:43:08 pm »
omg thats damn hot
gj avarax

edit:// yeah Hallo liebe Pornofreunde xD
banned.

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Ready Made: Bullet Shockwave
« Reply #2 on: February 29, 2008, 02:59:19 pm »
Yay nice pic and nice script *install* :D

// EDIT:

can you give an exampe xD ?
« Last Edit: February 29, 2008, 03:00:55 pm by Mr »

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Ready Made: Bullet Shockwave
« Reply #3 on: February 29, 2008, 03:15:55 pm »
Awesome script but need an example.
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Ready Made: Bullet Shockwave
« Reply #4 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?

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #5 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

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Ready Made: Bullet Shockwave
« Reply #6 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.
« Last Edit: March 01, 2008, 05:03:04 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Ready Made: Bullet Shockwave
« Reply #7 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)
« Last Edit: March 01, 2008, 05:12:05 am by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Ready Made: Bullet Shockwave
« Reply #8 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 :(
Text goes here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Ready Made: Bullet Shockwave
« Reply #9 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
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Ready Made: Bullet Shockwave
« Reply #10 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 by Finger & Kadell. Text is quite funny if you're able to translate it ;Q
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Ready Made: Bullet Shockwave
« Reply #11 on: March 01, 2008, 05:22:31 am »
Oh i got confused with Lieblings.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Ready Made: Bullet Shockwave
« Reply #12 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

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Ready Made: Bullet Shockwave
« Reply #13 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?
Text goes here...

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Ready Made: Bullet Shockwave
« Reply #14 on: March 01, 2008, 07:34:50 am »
Something like this, so you have a command with which you can activate the wave.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Ready Made: Bullet Shockwave
« Reply #15 on: March 01, 2008, 08:57:13 am »
Did as u told and nothing...
Text goes here...

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Ready Made: Bullet Shockwave
« Reply #16 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?

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Ready Made: Bullet Shockwave
« Reply #17 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
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Ready Made: Bullet Shockwave
« Reply #18 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
Text goes here...

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Ready Made: Bullet Shockwave
« Reply #19 on: March 02, 2008, 04:04:26 pm »
geez...
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Ready Made: Bullet Shockwave
« Reply #20 on: March 02, 2008, 04:43:18 pm »
geez...
Sorry, u can poke me in the eyes.
Text goes here...

Offline macho

  • Major(1)
  • Posts: 2
Re: Macho
« Reply #21 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;

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #22 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 <.<

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Ready Made: Bullet Shockwave
« Reply #23 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...
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".

Offline alex56

  • Major(1)
  • Posts: 4
Re: Ready Made: Bullet Shockwave
« Reply #24 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?

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Ready Made: Bullet Shockwave
« Reply #25 on: October 12, 2008, 06:44:49 pm »
This script looks so cool but the link is broken, please fix it.


Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Ready Made: Bullet Shockwave
« Reply #26 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 ;)
Also Known As REIMA


Lol Happles (happy apples)

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Ready Made: Bullet Shockwave
« Reply #27 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?
« Last Edit: October 13, 2008, 04:56:38 pm by Hacktank »


Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Ready Made: Bullet Shockwave
« Reply #28 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;
Also Known As REIMA


Lol Happles (happy apples)

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Ready Made: Bullet Shockwave
« Reply #29 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?

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Ready Made: Bullet Shockwave
« Reply #30 on: December 31, 2008, 11:33:07 am »
Can someone say me how i can make that the bullets fly i all directions??

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #31 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

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Ready Made: Bullet Shockwave
« Reply #32 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?

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #33 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

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Ready Made: Bullet Shockwave
« Reply #34 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;

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #35 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'))

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Ready Made: Bullet Shockwave
« Reply #36 on: January 26, 2009, 02:17:02 pm »
 ::) Forgot to say 'Thanks'  ::) Now i do it 'Thanks' lol ;D It's working fine...
« Last Edit: January 26, 2009, 02:22:31 pm by y0uRd34th »

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #37 on: January 27, 2009, 12:34:12 am »
no problem...

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Ready Made: Bullet Shockwave
« Reply #38 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?
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Ready Made: Bullet Shockwave
« Reply #39 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

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Ready Made: Bullet Shockwave
« Reply #40 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*
check out my server! click here

If at first you don't succeed, Improvise! :D