Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Avarax on September 28, 2007, 02:02:53 pm

Title: Ready made: Bullet Nova
Post by: Avarax on September 28, 2007, 02:02:53 pm
(http://home.arcor.de/avarax3/nova.PNG)
Two knife novas with a total of 95 knifes



procedure Nova(X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);

This procedure creates a customized circle of bullets around the specified coordinates. Very useful for coding special effects or... magic spells :D
Requires a deg2rad function (which can also be quite useful ;) )



How to use the parameters:
X & Y:
             Coordinates for the Nova
Speed:            Speed of the bullets
Decentralize:   How far the starting circle is away from it's center (= X & Y)
Power:            Power of the bullets
ID:                  Owner of the bullets
Style:             Bullettype
n:                   Number of bullets


And the code for copy & pasting:
Code: [Select]
procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var i: integer;
    angle: single;
begin
  angle := 2*pi/n;
  for i:=0 to n do
    CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
end;
Title: Re: Ready made: Bullet Nova
Post by: Iq Unlimited on September 28, 2007, 04:19:57 pm
pointless, but CRAZY COOL :o. Gj, this would be fun with m79 bullets xD.

Iq Unlimited
Title: Re: Ready made: Bullet Nova
Post by: Kitty on September 28, 2007, 04:47:01 pm
A shield made out of grenades  :o that would be funny

Nice one ;)  ;D
Title: Re: Ready made: Bullet Nova
Post by: SirJamesaford on September 28, 2007, 04:49:07 pm
I smell a new hexer skill....fucking a.  Cant wait to see this (that is, if this is gonna be used in hexer.)
Title: Re: Ready made: Bullet Nova
Post by: Thomas on September 28, 2007, 06:45:00 pm
nice work!

i wonder if this makes any difference: (performance, but im sure it doesnt)
deg/(180/pi); <-> deg*(pi/180);
the second is how you would calculte it normally imho
Title: Re: Ready made: Bullet Nova
Post by: Kavukamari on September 28, 2007, 09:21:36 pm
you are a goddam genius Avarax!!!
Title: Re: Ready made: Bullet Nova
Post by: xmRipper on September 29, 2007, 01:51:25 am
OMG! Perfect!
you are a goddam genius Avarax!!!
Title: Re: Ready made: Bullet Nova
Post by: Avarax on September 29, 2007, 03:17:43 am
Oh come on, how does that little piece of code make someone a genius :-|
Using a negative decentralize value btw creates a nova that goes from outside to inside instead of inside to outside.
Title: Re: Ready made: Bullet Nova
Post by: Thomas on September 29, 2007, 04:35:12 am
alternatively you can also use a negative speed value, but somehow the knives didnt really hit my soldat
 i wanted to make some leet adminkill command /novakill *id*

Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
begin
  if GetPiece(Text,' ',0) = '/novakill' then begin
    Nova(
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'), //X
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'), //Y
       -6, //Speed
       50, // distance/decentralize
       100, //power
       ID, //owner
       13, //knife
       40 //n
     );
  end;
  //NOTE: This function will be called when an admin types a / command.
  Result := false; // Return true if you want to ignore the command typed.
end;
Title: Re: Ready made: Bullet Nova
Post by: Avarax on September 29, 2007, 04:37:48 am
Use a higher speed and use less decentralization.
Title: Re: Ready made: Bullet Nova
Post by: Kavukamari on September 29, 2007, 06:22:10 pm
you're not just a genius because of THIS script, it's good, but you made Hexer!!! anyone who could do that is a genius in my book ;)

Date Posted: September 29, 2007, 07:18:38 pm
what's the max number of bullets a map can render/make at once?
Title: Re: Ready made: Bullet Nova
Post by: Navy0zkr on January 25, 2008, 04:29:49 pm
AND THE COMMAND?
/???
/???
Title: Re: Ready made: Bullet Nova
Post by: chutem on January 25, 2008, 06:27:13 pm
Oh my god, stop typing in caps,

There is no command, this is just a function that you put at the start of a script and then you can call it later, so, either someone has to make you a script so you can just type /nova or something, and I can't be F***ed doing it.
Title: Re: Ready made: Bullet Nova
Post by: Navy0zkr on January 25, 2008, 09:49:09 pm
look my nova!
(http://i229.photobucket.com/albums/ee178/Navy_Ozkr/screenshot-08-01-25-03.jpg)
(http://i229.photobucket.com/albums/ee178/Navy_Ozkr/screenshot-08-01-25-04.jpg)

CODE:
Quote
function deg2rad(deg: single): single;
begin
  result:=deg/(180/pi);
end;

procedure Nova(X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var i: integer;
begin
  for i:=0 to n do
    CreateBullet(X + (cos(deg2rad(360 / n * i))*decentralize),Y + (sin(deg2rad(360 / n * i))*decentralize),(cos(deg2rad(360 / n * i))*speed),(sin(deg2rad(360 / n * i))*speed),power,style,ID);
end;
function OnCommand(ID: Byte; Text: string): boolean;
begin
  if GetPiece(Text,' ',0) = '/novakill' then begin
Nova(
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'), //X
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'), //Y
       -5, //Speed
       40, // distance/decentralize
       100, //power
       ID, //owner
       12, //knife
       40 //n
     );
    Nova(
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'), //X
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'), //Y
       -5, //Speed
       30, // distance/decentralize
       100, //power
       ID, //owner
       4, //knife
       40 //n
     );
  Nova(
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'), //X
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'), //Y
       -5, //Speed
       10, // distance/decentralize
       100, //power
       ID, //owner
       4, //knife
       40 //n
     );
Nova(
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'X'), //X
       GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Y'), //Y
       -5, //Speed
       5, // distance/decentralize
       100, //power
       ID, //owner
       13, //knife
       40 //n
     );
  end;
  //NOTE: This function will be called when an admin types a / command.
  Result := false; // Return true if you want to ignore the command typed.
end;
Quote
:D
Title: Re: Ready made: Bullet Nova
Post by: IvanTh3Great on February 12, 2008, 09:59:18 pm
can u make this into a zip file with the sub folders and whatnot...please?
Title: Re: Ready made: Bullet Nova
Post by: shantec on March 31, 2008, 02:48:20 pm
So... sumthing went wrong (probably everything)
I have the deg3rag thing and after that i have:

Code: [Select]
procedure Nova(X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var i: integer;
begin
  for i:=0 to n do
    CreateBullet((GetPlayerStat(ID,'x') + (cos(deg2rad(360 / 50 * i))*50),(GetPlayerStat(ID,'y') + (sin(deg2rad(360 / 50 * i))*50),(cos(deg2rad(360 / 50 * i))*70),(sin(deg2rad(360 / 50 * i))*70),0,14,ID);
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
  if Text = '/Nova' then begin
    Nova;
end;

Could someone tell what went wrong?
So i want the "skill" triggered with /nova
Help?
Title: Re: Ready made: Bullet Nova
Post by: sai`ke on March 31, 2008, 03:33:47 pm
One thing is that you're missing an end. It helps to line out code so that begin and end's that belong together have the same indenting. It's easier to spot errors that way.

Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
begin
  if Text = '/Nova' then
  begin
    Nova(X,Y,speed,decentralize, power, ID, style, n);
  end
end;

Also for X,Y,speed,decentralize, power, ID, style, n you need to either enter values or make them variables. Read the rest of the thread to find out what kind of values these take. You need to think about these and try various things depending on what you want...
Title: Re: Ready made: Bullet Nova
Post by: shantec on April 01, 2008, 08:07:11 am
I tried to do something but the script wont work!! >:(
I think scripting is driving me nutty... i just cant get it where is the problem.
Title: Re: Ready made: Bullet Nova
Post by: danmer on April 02, 2008, 09:49:57 am
how exactly does it "not work"? Got any error messages?
Title: Re: Ready made: Bullet Nova
Post by: shantec on April 02, 2008, 01:11:59 pm
When i try to put up the server, it gives this error:

Title: Re: Ready made: Bullet Nova
Post by: JFK on April 02, 2008, 02:09:42 pm
(19:74) means that there is an error in line 19.
If you open the script in notepad the first line is line 2.
'Close round expected' means you're probably missing a ')' in line 19, but it could be something else. Look closely.
Title: Re: Ready made: Bullet Nova
Post by: frosty on April 02, 2008, 06:53:36 pm
lol try this, it is triggered with /wave, its the funniest damn thing

try it on your soldatserver

just unzip this into your scripts folder in your soldatserver directory


anyways here is what it is,
Bullet Nova
luanches grenades
launches 1000 grenades, its pretty funny, when you do /wave you get this huge KABOOM and also you get a few grenades launch off all over the place

have fun

*edit* also blows up the map ;)
Title: Re: Ready made: Bullet Nova
Post by: trickster on April 21, 2008, 08:44:29 pm
were i should paste this thing i dont know if theres a script creator or something i meant that i dont know how to make this thing!
Title: Re: Ready made: Bullet Nova
Post by: Boblekonvolutt on April 21, 2008, 10:44:36 pm
1. Get SoldatServer (here (http://enesce.com/index.php?page=downloads&f=34))
2. Make a new folder called EvilAvarax in SoldatServer/Scripts/
3. Make a file called EvilAvarax.pas (in Scripts/EvilAvarax/)
4. Copy and paste the script into EvilAvarax.pas
5. Make a file called Includes.txt (in Scripts/EvilAvarax/)
6. Write "EvilAvarax.pas" in Includes.txt

Run soldatserver.exe, open Soldat and join your server (127.0.0.1 23073)

Didn't know where your problem was, so I put it all there. Oh yes, Avarax is evil.
Title: Re: Ready made: Bullet Nova
Post by: frosty on April 22, 2008, 04:33:39 pm
use notepad for making the pas file Trickster

hope this helps
Title: Re: Ready made: Bullet Nova
Post by: trickster on April 23, 2008, 04:09:40 pm
one more thing how i make my server stay in the lobby every day even if im not playing?
Title: Re: Ready made: Bullet Nova
Post by: Boblekonvolutt on April 23, 2008, 07:10:51 pm
Don't close it...
Title: Re: Ready made: Bullet Nova
Post by: shantec on April 24, 2008, 02:51:24 pm
I wonder... would it be possible to create a nova around other player, but the bullets still belongs to the 'creator' of the nova? 8)
Title: Re: Ready made: Bullet Nova
Post by: Irlandec on July 18, 2008, 04:42:05 am
nopaste goes mad on me , cannot copy the script :(
Title: Re: Ready made: Bullet Nova
Post by: Avarax on July 18, 2008, 05:34:02 am
Code: [Select]
procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var i: integer;
    angle: single;
begin
  angle := 2*pi/n;
  for i:=0 to n do
    CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
end;
Title: Re: Ready made: Bullet Nova
Post by: frosty on February 03, 2009, 12:44:22 am
umm how would i change the weapon style in this code? i cant remember what i did, if anyone can figure it out can it bold it for me plz in their reply?
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 := (1000 * 90) / (1000 * pi * 1);
  for i:=-1000 div 10 to 1000 div 10 + 1000 mod 2 do
    CreateBullet(centerX+cos(25+angle*i)*1+cos(25)*10,centerY+sin(Direction+angle*i)*90+sin(Direction)*1, cos(25+angle*i*1)*20, sin(25+angle*i*1)*30,80,2,Owner);
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
  If text = '/wave' then begin
    {Insert some Wave() calls in here. For example:}
    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;

been ages since ive played with my scripts

or is there a way to add a "/wave <style>" command?
Title: Re: Ready made: Bullet Nova
Post by: Avarax on February 03, 2009, 06:24:50 am
The 14 in your Wave() calls stands for the bullettype. Wrong thread btw.
Title: Re: Ready made: Bullet Nova
Post by: frosty on February 03, 2009, 05:24:56 pm
oops maybe i should have started a new thread?

wont happen again

but since i have posted here i may as well continue, can someone plz answer my last question, is there a way to add a "/wave <style>" command, or will it need to be put in a brand new script?
Title: Re: Ready made: Bullet Nova
Post by: y0uRd34th on February 04, 2009, 08:28:40 am
Do you wanna make Novas ingame?
Then use this i've made it:
Code: [Select]
procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var
   i: integer;
   Angle: single;
begin
     Angle := 2*Pi/n;
     for i:= 0 to n do
     CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
Var
   Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8: Variant;
   Temp0: String;
begin
     if Temp0 = '/nova' then begin
        Temp1 := GetPlayerStat(ID,'X');                   {Player X}
        Temp2 := GetPlayerStat(ID,'Y');                   {Player Y}
        Temp3 := strtofloat(GetPiece(Text, ' ', 1));      {Speed}
        Temp4 := strtofloat(GetPiece(Text, ' ', 2));      {Decentralize}
        Temp5 := strtofloat(GetPiece(Text, ' ', 3));      {Power}
        Temp6 := strtoint(GetPiece(Text, ' ', 4));        {Bullettype}
        Temp7 := strtoint(GetPiece(Text, ' ', 5));        {Number}
         if (Temp6 > 0) and (Temp6 < 16) then begin
         Nova(Temp1,Temp2,Temp3,Temp4,Temp5,ID,Temp6,Temp7);
      end;
   end;
Result := False;
end;
Command: "/nova <Speed> <Decentralize> <Power> <Bullettype> <Number>
NOT TESTET
Title: Re: Ready made: Bullet Nova
Post by: frosty on February 04, 2009, 04:35:38 pm
Do you wanna make Novas ingame?
Then use this i've made it:
Code: [Select]
procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var
   i: integer;
   Angle: single;
begin
     Angle := 2*Pi/n;
     for i:= 0 to n do
     CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
Var
   Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8: Variant;
   Temp0: String;
begin
     if Temp0 = '/nova' then begin
        Temp1 := GetPlayerStat(ID,'X');                   {Player X}
        Temp2 := GetPlayerStat(ID,'Y');                   {Player Y}
        Temp3 := strtofloat(GetPiece(Text, ' ', 1));      {Speed}
        Temp4 := strtofloat(GetPiece(Text, ' ', 2));      {Decentralize}
        Temp5 := strtofloat(GetPiece(Text, ' ', 3));      {Power}
        Temp6 := strtoint(GetPiece(Text, ' ', 4));        {Bullettype}
        Temp7 := strtoint(GetPiece(Text, ' ', 5));        {Number}
         if (Temp6 > 0) and (Temp6 < 16) then begin
         Nova(Temp1,Temp2,Temp3,Temp4,Temp5,ID,Temp6,Temp7);
      end;
   end;
Result := False;
end;
Command: "/nova <Speed> <Decentralize> <Power> <Bullettype> <Number>
NOT TESTET

just tested it, doesnt work

can u plz fix it?

command tried: /nova 10 5 10 4 5
Title: Re: Ready made: Bullet Nova
Post by: y0uRd34th on February 05, 2009, 01:49:46 pm
This will work:
Code: [Select]
procedure Nova(const X,Y,speed,decentralize,power: single; ID,style: byte; n: integer);
var
   i: integer;
   Angle: single;
begin
     Angle := 2*Pi/n;
     for i:= 0 to n do
     CreateBullet(X+cos(angle*i)*decentralize, Y+sin(angle*i)*decentralize, cos(angle*i)*speed, sin(angle*i)*speed, power,style , ID );
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
Var
   Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8: Variant;
   Temp0: String;
begin
        Temp0 := GetPiece(LowerCase(Text),' ',0);
     if Temp0 = '/nova' then begin
        Temp1 := GetPlayerStat(ID,'X');                   {Player X}
        Temp2 := GetPlayerStat(ID,'Y');                   {Player Y}
        Temp3 := strtofloat(GetPiece(Text, ' ', 1));      {Speed}
        Temp4 := strtofloat(GetPiece(Text, ' ', 2));      {Decentralize}
        Temp5 := strtofloat(GetPiece(Text, ' ', 3));      {Power}
        Temp6 := strtoint(GetPiece(Text, ' ', 4));        {Bullettype}
        Temp7 := strtoint(GetPiece(Text, ' ', 5));        {Number}
         if (Temp6 > 0) and (Temp6 < 16) then begin
         Nova(Temp1,Temp2,Temp3,Temp4,Temp5,ID,Temp6,Temp7);
      end;
   end;
Result := False;
end;
I forgot a little thing  ::)
Title: Re: Ready made: Bullet Nova
Post by: frosty on February 05, 2009, 02:49:38 pm
it works, thanks for the fix :D

would it be possible to add in an ID to the command so the admin can "force" a nova on another player or bot? lol

for example:
/nova (the usual parts) <ID>

if ID id blank then the nova is done on self

please? ill be forever grateful :D
Title: Re: Ready made: Bullet Nova
Post by: y0uRd34th on February 06, 2009, 08:03:56 am
Yes, but with the "SelfAim", i don't know, I'll show...