[Closed] please help for loop
Hi, I new to maxscript and would like to get better. I made up a simple example where i placed several point locators in a scene and then created just one little plane which i named “impactFlashes”. I want to be able to make copies of this impact flash and place each one on a point helper. Along the way also adding the current active material to the array of impactFlashes. This is what I have so far. Please give me insight into what I am doing wrong.
delete $ImpactFlashes0* \\--- deletes extra copies of impactflashes when script re-run
myPointers = $point*
for i = 1 to 6 do instance $ImpactFlashes
myImpactFlashes = $ImpactFlashes* as array
myImpactFlashes.material = medit.getCurMtl()
for i in myImpactFlashes do (
myCounter = 0
myImpactFlashes[myCounter+=1].pos = myPointers[myCounter+=1].pos
)
in line01 delete the \
\ in maxscript is a break line, comment is –
delete $ImpactFlashes0* \\--- deletes extra copies of impactflashes when script re-run
myPointers = $point*
is like:
delete $ImpactFlashes0* myPointers = $point*
its wrong, do you understand?
the last FOR you can write like this:
for i=1 to myImpactFlashes.count do
(
myImpactFlashes[i].pos = myPointers[i].pos
)
or
myCounter = 1
for i in myImpactFlashes do (
myImpactFlashes[myCounter].pos = myPointers[myCounter].pos
myCounter += 1
)
thank u sooooo much my friend. It works perfectly and I understand what I am doing wrong. much appreciated Aline3d
Do me a favor and put a post on all the duplicates of this thread so that people (like me) don’t answer what’s already been answered. (Also, my version is better with the single for loop:)