Circular Explosion
#1

Hello everyone,

I was coding a big explosion for a system of mine. I want little help from all of you. I want a Big Circular Explosion happening around the Coordinates X,Y,Z.

Suppose there is point with these X , Y , Z. I want a function which creates circular explosion around the coordinate X,Y,Z. Regardless of the real values of X,Y,Z and Number of explosions created. It should create lot of explosions in a circular form around coordinates X,Y,Z.

If you can code me one , will highly appreciate it. If you need more information , reply here.

Regards
Ballu Miaa
Reply
#2

Are you sure you want it to be circular?Can't it be an explosion on the left side of the player,on the right side,above his head,in front of him,and behind him?All of them happening at the same time(it doesn't look the same,but...).Does it have to kill the player?
Reply
#3

This shouldn't even be hard to make. I just am not good with coordinates.

I tried doing this, but like I said, not good with coordinates.

pawn Код:
stock CreateCircularExplosion(Float:PosX, Float:PosY, Float:PosZ, Range)
{
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY + Range, PosZ, 0, 10.0);
    CreateExplosion(PosX - Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY - Range, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range - 2, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY + Range - 2, PosZ, 0, 10.0);
    CreateExplosion(PosX - Range - 2, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY - Range - 2, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    return 1;
}
Try doing something like that to be able to script this.
Reply
#4

Quote:
Originally Posted by Kindred
Посмотреть сообщение
This shouldn't even be hard to make. I just am not good with coordinates.

I tried doing this, but like I said, not good with coordinates.

pawn Код:
stock CreateCircularExplosion(Float:PosX, Float:PosY, Float:PosZ, Range)
{
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY + Range, PosZ, 0, 10.0);
    CreateExplosion(PosX - Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY - Range, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range - 2, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY + Range - 2, PosZ, 0, 10.0);
    CreateExplosion(PosX - Range - 2, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX, PosY - Range - 2, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    CreateExplosion(PosX + Range, PosY, PosZ, 0, 10.0);
    return 1;
}
Try doing something like that to be able to script this.
Not bad. Thanks for making it for me. But yeah brother. Still isnt the same thing i required.

Your code creates explosions at 4 major points of the circle. I want the function to create explosion at every point of the circle when the function will be called.

I hope you understand , thanks for making this though!
Reply
#5

nah, a sin/cosinus transformation is the best way to do that. ill edit this post again, but iam running out of time ><
let me paste a part of a script which creates a circle of obejcts:
the Amount should raise linear to the radius, its 3.1415* more required for a radius lenght..
pawn Код:
new Float:Part=floatdiv(360,Amount);
    for(new i = 0; i<Amount; i++)
    {
        ocount++;
        new Float:CX,Float:CY,Float:CZ,Float:CA;
        CX=X+(Radius*floatsin(i*Part,degrees));
        CY=Y+(Radius*floatcos(i*Part,degrees));
        CZ=Z+OffSetZ;
        CA=(-i*Part+180);//that 180 degrees coz the playerid rotation..
    }
pay attention to the 2 middle lines ^^
Reply
#6

Quote:
Originally Posted by Babul
Посмотреть сообщение
nah, a sin/cosinus transformation is the best way to do that. ill edit this post again, but iam running out of time ><
let me paste a part of a script which creates a circle of obejcts:
the Amount should raise linear to the radius, its 3.1415* more required for a radius lenght..
pawn Код:
new Float:Part=floatdiv(360,Amount);
    for(new i = 0; i<Amount; i++)
    {
        ocount++;
        new Float:CX,Float:CY,Float:CZ,Float:CA;
        CX=X+(Radius*floatsin(i*Part,degrees));
        CY=Y+(Radius*floatcos(i*Part,degrees));
        CZ=Z+OffSetZ;
        CA=(-i*Part+180);//that 180 degrees coz the playerid rotation..
    }
pay attention to the 2 middle lines ^^
I was looking for this thread of mine since an hour. I was actually trying to do something similar on another project.

I did not understand anything from your code above. You're awesome Babul but hope you can explain it a bit more to me. I suck at Maths most of the times in every way.

PS

I know i bumped an old thread but i bumped it because i dont want to waste space for another thread.
Reply
#7

i think its clever to bump an old thread, since it already contains relevant information.
pm sent.
Reply
#8

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
I was looking for this thread of mine since an hour. I was actually trying to do something similar on another project.

I did not understand anything from your code above. You're awesome Babul but hope you can explain it a bit more to me. I suck at Maths most of the times in every way.

PS

I know i bumped an old thread but i bumped it because i dont want to waste space for another thread.
Ok, I'm also sorry for bump, but I think it's still a question unsawered and I'm checking Ballu Miaa's threads for a job

try this:

PHP код:
stock CircularExplosion(Float:XFloat:YFloat:ZFloat:OffsetZAmounttypeFloat:Radius)
{
    new 
Float:Part=floatdiv(360,Amount);
    for(new 
0i<Amounti++)
    {
        
ocount++;
        new 
Float:CX,Float:CY,Float:CZ,Float:CA;
        
CX=X+(Radius*floatsin(i*Part,degrees));
        
CY=Y+(Radius*floatcos(i*Part,degrees));
        
CZ=Z+OffSetZ;
        
CA=(-i*Part+180);//that 180 degrees coz the playerid rotation..
        
CreateExplosion(CXCYCZtypeRadius);
    }

remember, Amount can't be bigger tham 10
Reply
#9

Quote:
Originally Posted by dudaefj
Посмотреть сообщение
Ok, I'm also sorry for bump, but I think it's still a question unsawered and I'm checking Ballu Miaa's threads for a job

try this:

PHP код:
stock CircularExplosion(Float:XFloat:YFloat:ZFloat:OffsetZAmounttypeFloat:Radius)
{
    new 
Float:Part=floatdiv(360,Amount);
    for(new 
0i<Amounti++)
    {
        
ocount++;
        new 
Float:CX,Float:CY,Float:CZ,Float:CA;
        
CX=X+(Radius*floatsin(i*Part,degrees));
        
CY=Y+(Radius*floatcos(i*Part,degrees));
        
CZ=Z+OffSetZ;
        
CA=(-i*Part+180);//that 180 degrees coz the playerid rotation..
        
CreateExplosion(CXCYCZtypeRadius);
    }

remember, Amount can't be bigger tham 10
Well thanks yo. I will try to make this work. Even Babul sent me a code to make it work in the PM's. I will test both of them. Thanks for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)