Maxscripting Fireworks

hello guys i am having a problem for an assignment due tomorrow i need to create a firework effect without the use particle systems this is my code so far:

rollout SphereTool "Firework Creator"
(
spinner count "Number: " type:#integer range:[1,100,1]
spinner growth "Radius growth: " range:[1,100,10]
colorpicker baseColour "" color:[150,150,150] width:75 across:2
button create "Create Spheres"

on create pressed do
(
for i in 1 to count.value do
(
sphere name:"Firework" radius:(i*growth.value) position:[i^2*growth.value,0,0] wirecolor: basecolour.color
)

convertToMesh $Firework

meshop.explodeAllFaces $Firework 0

update $Firework

v = 20

animate on
(
at time (sliderTime+50.000) ( meshop.bevelFaces $Firework #{1..$Firework.numFaces} 0.0000001 0 )
at time (sliderTime+50.001) ( meshop.bevelFaces $Firework #{1..$Firework.numFaces} 0.0000001 0 )
at time (sliderTime+100) ( meshop.bevelFaces $Firework #{1..$Firework.numFaces} 100 0 )

at time (sliderTime) ( $Firework.pos = $Firework.pos )
for t = 5 to 100 by 5 do
(
v = v - 2
at time (sliderTime+t) ( $Firework.pos = $Firework.pos + [0,0,v] )
)
)
)
)
setNeedsRedraw complete:true
createDialog SphereTool width:200

my sphere goes up into the air and explodes but only does it for one sphere? any help would be appreciated if you could add in how to delete the shards of mesh after the explosion it would be most appreciated.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
daem0nz's picture

currently i have been using a

currently i have been using a very poor code which seems to work but i know it's not the way it should be done thats as follows:

rollout SphereTool "Firework Creator"
(
    spinner count "Number: " type:#integer range:[1,10,10]
    spinner radius "Radius: " range:[2,2,2] 
    button create "Create Fireworks"
	button launch "Launch Firework"
 
    on create pressed do
    (
        for i in 1 to count.value do
        (
 
            sphere radius:(radius.value) position:[0,0,0]			
 
        )
 
        setNeedsRedraw complete:true
    )
 
	on launch pressed do
	(
		animate on
 
	( 
			for i in 1 to 1 do
		(
 
			at time 0 $Sphere01.pos = [0,0,0]
			at time 20 $Sphere01.pos = [0,0,250]
		)
		for i in 2 to 2 do
		(
 
			at time 30 $Sphere02.pos = [0,0,0]
			at time 50 $Sphere02.pos = [200,0,250]
		)
		for i in 3 to 3 do
		(
			at time 60 $Sphere03.pos = [0,0,0]
			at time 80 $Sphere03.pos = [250,0,250]
		)
		for i in 4 to 4 do
		(
			at time 90 $Sphere04.pos = [0,0,0]
			at time 110 $Sphere04.pos = [250,0,250]
		)
		for i in 5 to 5 do
		(
			at time 120 $Sphere05.pos = [0,0,0]
			at time 140 $Sphere05.pos = [275,0,250]
		)
		for i in 6 to 6 do
		(	
			at time 150 $Sphere06.pos = [0,0,0]
			at time 170 $Sphere06.pos = [0,250,250]
		)
		for i in 7 to 7 do
		(
			at time 180 $Sphere07.pos = [0,0,0]
			at time 200 $Sphere07.pos = [0,450,250]
		)
		for i in 8 to 8 do
		(
			at time 210 $Sphere08.pos = [0,0,0]
			at time 230 $Sphere08.pos = [273.94,200,250]
		)
		for i in 9 to 9 do
		(
			at time 240 $Sphere09.pos = [0,0,0]
			at time 260 $Sphere09.pos = [173.94,255,275]
		)
		for i in 10 to 10 do
		(
			at time 270 $Sphere10.pos = [0,0,0]
			at time 290 $Sphere10.pos = [175,325,175]
		)
	)
 
convertToMesh $Sphere01
 
meshop.explodeAllFaces $Sphere01 0
 
update $Sphere01
 
convertToMesh $Sphere02
 
meshop.explodeAllFaces $Sphere02 0
 
update $Sphere02
 
convertToMesh $Sphere03
 
meshop.explodeAllFaces $Sphere03 0
 
update $Sphere03
 
convertToMesh $Sphere04
 
meshop.explodeAllFaces $Sphere04 0
 
update $Sphere04
 
convertToMesh $Sphere05
 
meshop.explodeAllFaces $Sphere05 0
 
update $Sphere05
 
convertToMesh $Sphere06
 
meshop.explodeAllFaces $Sphere06 0
 
update $Sphere06
 
convertToMesh $Sphere07
 
meshop.explodeAllFaces $Sphere07 0
 
update $Sphere07
 
convertToMesh $Sphere08
 
meshop.explodeAllFaces $Sphere08 0
 
update $Sphere08
 
convertToMesh $Sphere09
 
meshop.explodeAllFaces $Sphere09 0
 
update $Sphere09
 
convertToMesh $Sphere10
 
meshop.explodeAllFaces $Sphere10 0
 
update $Sphere10
v = 20
 
animate on
(
    at time (20.000) ( meshop.bevelFaces $Sphere01 #{1..$Sphere01.numFaces} 0.0000001 0 )
    at time (20.001) ( meshop.bevelFaces $Sphere01 #{1..$Sphere01.numFaces} 0.0000001 0 )
    at time (100)    ( meshop.bevelFaces $Sphere01 #{1..$Sphere01.numFaces} 100 0 )
 
 
)
animate on
(
    at time (40.000) ( meshop.bevelFaces $Sphere02 #{1..$Sphere02.numFaces} 0.0000001 0 )
    at time (40.001) ( meshop.bevelFaces $Sphere02 #{1..$Sphere02.numFaces} 0.0000001 0 )
    at time (120)    ( meshop.bevelFaces $Sphere02 #{1..$Sphere02.numFaces} 100 0 )
 
)
animate on
(
    at time (60.000) ( meshop.bevelFaces $Sphere03 #{1..$Sphere03.numFaces} 0.0000001 0 )
    at time (60.001) ( meshop.bevelFaces $Sphere03 #{1..$Sphere03.numFaces} 0.0000001 0 )
    at time (140)    ( meshop.bevelFaces $Sphere03 #{1..$Sphere03.numFaces} 100 0 )
 
)
 
animate on
(
    at time (90.000) ( meshop.bevelFaces $Sphere04 #{1..$Sphere04.numFaces} 0.0000001 0 )
    at time (90.001) ( meshop.bevelFaces $Sphere04 #{1..$Sphere04.numFaces} 0.0000001 0 )
    at time (170)    ( meshop.bevelFaces $Sphere04 #{1..$Sphere04.numFaces} 100 0 )
 
)
animate on
(
    at time (110.000) ( meshop.bevelFaces $Sphere05 #{1..$Sphere05.numFaces} 0.0000001 0 )
    at time (130.001) ( meshop.bevelFaces $Sphere05 #{1..$Sphere05.numFaces} 0.0000001 0 )
    at time (200)    ( meshop.bevelFaces $Sphere05 #{1..$Sphere05.numFaces} 100 0 )
 
)
animate on
(
    at time (150.000) ( meshop.bevelFaces $Sphere06 #{1..$Sphere06.numFaces} 0.0000001 0 )
    at time (150.001) ( meshop.bevelFaces $Sphere06 #{1..$Sphere06.numFaces} 0.0000001 0 )
    at time (230)    ( meshop.bevelFaces $Sphere06 #{1..$Sphere06.numFaces} 100 0 )
 
)
 
animate on
(
    at time (180.000) ( meshop.bevelFaces $Sphere07 #{1..$Sphere07.numFaces} 0.0000001 0 )
    at time (180.001) ( meshop.bevelFaces $Sphere07 #{1..$Sphere07.numFaces} 0.0000001 0 )
    at time (250)    ( meshop.bevelFaces $Sphere07 #{1..$Sphere07.numFaces} 100 0 )
 
)
animate on
(
    at time (200.000) ( meshop.bevelFaces $Sphere08 #{1..$Sphere08.numFaces} 0.0000001 0 )
    at time (200.001) ( meshop.bevelFaces $Sphere08 #{1..$Sphere08.numFaces} 0.0000001 0 )
    at time (270)    ( meshop.bevelFaces $Sphere08 #{1..$Sphere08.numFaces} 100 0 )
 
)
animate on
(
    at time (230.000) ( meshop.bevelFaces $Sphere09 #{1..$Sphere09.numFaces} 0.0000001 0 )
    at time (230.001) ( meshop.bevelFaces $Sphere09 #{1..$Sphere09.numFaces} 0.0000001 0 )
    at time (300)    ( meshop.bevelFaces $Sphere09 #{1..$Sphere09.numFaces} 100 0 )
 
)
animate on
(
    at time (260.000) ( meshop.bevelFaces $Sphere10 #{1..$Sphere10.numFaces} 0.0000001 0 )
    at time (260.001) ( meshop.bevelFaces $Sphere10 #{1..$Sphere10.numFaces} 0.0000001 0 )
    at time (330)    ( meshop.bevelFaces $Sphere10 #{1..$Sphere10.numFaces} 100 0 )
 
)
)
)
createDialog SphereTool width:200
<code>
daem0nz's picture

not to spam but as it's in

not to spam but as it's in for tomorrow i am in a bit of a hurry i was wondering how am i able to delete the shards left over from the explosion i did use meshop.deleteFaces but that seems to delete my spheres before they're spawned.

barigazy's picture

Delating polygons is not the

Delating polygons is not the solution.
Look at this post
http://www.scriptspot.com/forums/3ds-max/general-scripting/deleting-an-a...
It's many way to achive better result,
but your time is short to change code from scratch.

barigazy

daem0nz's picture

my time is very short indeed,

my time is very short indeed, ive been working on it for a while but code has always gone straight through me, i just can't grasp it, i just need to get 10 fireworks of the same size going off in a directed path, exploding in different colours if i could and delete the resulting explosion after 3 seconds.

daem0nz's picture

that works amazingly,

that works amazingly, although my spheres size gets bigger the more of them there is like 2 spheres will spawn and the second one seems to be larger than the first one.

barigazy's picture

Part two

global SphereTool
if SphereTool  != undefined do try (destroyDialog SphereTool) catch()
rollout SphereTool "Firework Creator"
(
	spinner count "Number: " type:#integer range:[1,100,1]
	spinner growth "Radius growth: " range:[1,100,10]
	spinner delay "Delay: " range:[1,100,10]
	colorpicker baseColour "" color:[150,150,150] width:75 across:2
	button create "Create Spheres"
 
	on create pressed do
	(
		cnt = 0
		for i in 1 to count.value do
		(
			sph = sphere name:"Firework" radius:(i*growth.value) position:[i^2*growth.value,0,0] wirecolor: basecolour.color
			convertToMesh sph
			meshop.explodeAllFaces sph 0
			update sph
			v = 20
			nf = sph.numFaces
			animate on with redraw off
			(
				at time (sliderTime+50.000+cnt) ( meshop.bevelFaces sph #{1..(nf)} 0.0000001 0 )
				at time (sliderTime+50.001+cnt) ( meshop.bevelFaces sph #{1..(nf)} 0.0000001 0 )
				at time (sliderTime+100+cnt) ( meshop.bevelFaces sph #{1..(nf)} 100 0 )
				at time (sliderTime) ( sph.pos = sph.pos )
				for t = 5 to 100 by 5 do
				(
					v = v - 2
					at time (sliderTime+t) ( sph.pos = sph.pos + [0,0,v] )
				)
			)
			if cnt != 0 do (moveKeys sph.pos.track cnt) ; cnt+=delay.value
			if i == count.value do
			(
				keyscount = sph.pos.controller.keys.count
				lastKeyTime = sph.pos.controller.keys[keyscount].time
				animationRange = (interval 0f lastKeyTime )
			)
		)
	)
)
 
createDialog SphereTool width:200 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

barigazy's picture

Fireworks

Is this what you want?

rollout SphereTool "Firework Creator"
(
	spinner count "Number: " type:#integer range:[1,100,1]
	spinner growth "Radius growth: " range:[1,100,10]
	colorpicker baseColour "" color:[150,150,150] width:75 across:2
	button create "Create Spheres"
 
	on create pressed do
	(
		for i in 1 to count.value do
		(
			sph = sphere name:"Firework" radius:(i*growth.value) position:[i^2*growth.value,0,0] wirecolor: basecolour.color
			convertToMesh sph
			meshop.explodeAllFaces sph 0
			update sph
			v = 20
			nf = sph.numFaces
			animate on with redraw off
			(
				at time (sliderTime+50.000) ( meshop.bevelFaces sph #{1..(nf)} 0.0000001 0 )
				at time (sliderTime+50.001) ( meshop.bevelFaces sph #{1..(nf)} 0.0000001 0 )
				at time (sliderTime+100) ( meshop.bevelFaces sph #{1..(nf)} 100 0 )
				at time (sliderTime) ( sph.pos = sph.pos )
				for t = 5 to 100 by 5 do
				(
					v = v - 2
					at time (sliderTime+t) ( sph.pos = sph.pos + [0,0,v] )
				)
			)
		)
	)
)
 
createDialog SphereTool width:200

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.