Jump to content
Sign in to follow this  
OneStiffRod

Sparks

Recommended Posts

I had this idea to make a script that generates, randomly, sparks using the drop command and the fire script from OFP.

The sparks would fly out in a circular pattern from the epicenter of the explosion - I thought this would be challenging but not impossible but I'm running into problems -- namely creating the circular pattern.

1) What is the best formula for creating a circle?

Trigonometry question...

I saw a tutorial in Javascript once by Dan Steinman of Netscape and I think he did something like divide sin/cos and it made a continuous loop I would love something like that since it might be faster than doing the math to get 360 points - I'm not a math major so I'm just looking for some help in this area...

2) I kinda need clarification - say I get to the point of creating the drop command sparks but I want to give them a velocity - How do I figure which way to aim the sparks - I want them to shoot outward in a semi-random direction - what I'm asking is how do I decipher direction from a velocity vector?

3) I plan on putting this script in my "Mayaguez Incident" single mission that I'm working on - to find out what that is just search google for that phrase... On that note I'm looking for a working CH-53 helicoptor addon and also a C-130 spectre gunship addon if they exist - I would appreciate it if someone could help me find these.

Thank you.

Share this post


Link to post
Share on other sites

Funny I just scripted an effect like this

It is based on the scripts already in resistance.

Script 1 "the handler" -

Firesource.sqs:

_posDrop = _this select 0

_velocity = _this select 1

_lifeTime = _this select 2

_intensity = _this select 3

_object = _this select 4

; Fire

;position velocity

[_posDrop, [0,0,0], _lifeTime, _intensity, _object] exec "fx\fire.sqs"

and thats called with a trigger using a condition of -

not alive unitname

On Activation of -

;position velocity, life, size,

[(getpos unitname), [.5,1,.5], 90, 4, "" ] exec "firesource.sqs";

then you need the fire script that the previous 1 calls -

Fire.sqs:

_numLoops = _Duration / 0.15

_loopCounter = 1

_posDrop = _this select 0

_velocity = _this select 1

_lifeTime = _this select 2

_intensity = _this select 3

_object = _this select 4

_delay = 0.3

_lifeTicks = _lifeTime / _delay

_lifeTick = _lifeTicks

#Begin

drop ["cl_basic", "", "Billboard", 1, 1.5, [(_posDrop select 0) + random 0.5, (_posDrop select 1) + random 0.5, (_posDrop select 2) + 1.5],[random 0.3, random 0.3, random 0.3], 1, 0.004, 0.004, 0.1, [5*(0.1 + 0.2 * _lifeTick/_lifeTicks), 5*(0.1 + 0.5 * _lifeTick/_lifeTicks), 5*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[0,0,0,1], [0,0,0,1], [0,0,0,1], [0,0,0,1]], [0,1,0], 0.5, 0.05, "", "", ""]

drop ["cl_fire", "", "Billboard", 1, 1.5, [(_posDrop select 0) + random 0.5, (_posDrop select 1) + random 0.5, (_posDrop select 2) + 1.5],[random 0.3, random 0.3, random 0.3], 1, 0.004, 0.004, 0.1, [5*(0.1 + 0.2 * _lifeTick/_lifeTicks), 5*(0.1 + 0.5 * _lifeTick/_lifeTicks), 5*(0.1 + 0.1 * _lifeTick/_lifeTicks)], [[1,1,1,0], [1,1,1,1], [1,1,1,0.6], [1,1,1,0]], [0,1,0], 0.5, 0.05, "", "", ""]

drop ["cl_fire", "", "Billboard", 60, 9, [(_posDrop select 0), (_posDrop select 1), (_posDrop select 2) + 1], [(_velocity select 0) + 1.5, (_velocity select 1) + 1.5, (_velocity select 2) + random 1.5], 1 , 0.185 , 0.155 , 0 , [0.05,0.25] ,[[0.3,0.6,0,1],[0.5,0.5,0,1],[0.75,0.75,0,1],[0.75,1,0,1]] , [0] , 0.3 , 0.3 , "" , "" , _object]

drop ["cl_fire", "", "Billboard", 60, 9, [(_posDrop select 0), (_posDrop select 1), (_posDrop select 2) + 1.5], [(_velocity select 0) + 1.5, (_velocity select 1) + 1.5, (_velocity select 2) + random 1.5], 1 , 0.185 , 0.155 , 0 , [0.05,0.25] ,[[0.3,0.6,0,1],[0.5,0.5,0,1],[0.75,0.75,0,1],[0.75,1,0,1]] , [0] , 0.3 , 0.3 , "" , "" , _object]

~_delay

_lifeTick = _lifeTick - 1

?_lifeTick > 0 : goto "Begin"

That should work for ya, the first Drop is the fire, the next 2 are the sparks, and finally the smoke.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×