SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/07/2012, 08:39 AM   #1
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,859
Reputation: 323
Default Circular Explosion

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
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 23/07/2012, 09:06 AM   #2
Cjgogo
High-roller
 
Cjgogo's Avatar
 
Join Date: Apr 2011
Location: Romania,Brasov,Brasov
Posts: 1,019
Reputation: 89
Default Re: Circular Explosion

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?
__________________
{POWER} + {AGILITY} + {WILL} + {NOBILITY} = "PAWN"


"A question is the key to knoweldege"

My work


Cjgogo is offline   Reply With Quote
Old 23/07/2012, 09:09 AM   #3
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,647
Reputation: 504
Default Re: Circular Explosion

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 Code:
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.
Kindred is offline   Reply With Quote
Old 23/07/2012, 09:21 AM   #4
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,859
Reputation: 323
Default Re: Circular Explosion

Quote:
Originally Posted by Kindred View Post
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 Code:
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!
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 23/07/2012, 09:58 AM   #5
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,846
Reputation: 251
Default Re: Circular Explosion

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 Code:
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 ^^
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Old 23/11/2013, 06:49 PM   #6
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,859
Reputation: 323
Default Re: Circular Explosion

Quote:
Originally Posted by Babul View Post
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 Code:
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.
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 24/11/2013, 12:20 AM   #7
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,846
Reputation: 251
Default Re: Circular Explosion

i think its clever to bump an old thread, since it already contains relevant information.
pm sent.
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Old 29/12/2013, 06:42 PM   #8
dudaefj
Huge Clucker
 
dudaefj's Avatar
 
Join Date: Jul 2011
Posts: 345
Reputation: 19
Default Re: Circular Explosion

Quote:
Originally Posted by Ballu Miaa View Post
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 Code:
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
dudaefj is offline   Reply With Quote
Old 30/12/2013, 03:47 AM   #9
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,859
Reputation: 323
Default Re: Circular Explosion

Quote:
Originally Posted by dudaefj View Post
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 Code:
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.
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Circular camera movement leong124 Scripting Help 12 18/04/2012 03:12 PM
[Ajuda] Fazer uma Circular X.x Laercio Português/Portuguese 4 07/11/2011 08:18 PM


All times are GMT. The time now is 11:35 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.