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

0 Members and 1 Guest are viewing this topic.

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