|
| 01 May 2014 12:21 PM |
Normally when I use a for loop on multi values at the same time, those values are the same. This time, however all 3 values are different.
I'm trying to create a for loop that takes these 3 values (2, 1, 2.5) in a mesh scale, and reduce them to 0 in 10ths. For example the 1 is reduced by 0.1, 2 is reduced by 0.2, and 2.5 is reduced by 0.25.
for i = V, 0, V/10 do
something like that but I've never actually tried to change multiple values that are different with the same for loop before. |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 01 May 2014 12:31 PM |
Hmmm
local startSize = mesh.Size --I forget what its called
for i = 10, 0, -1 do mesh.Size = startSize-startSize/10 wait(.1) end |
|
|
| Report Abuse |
|
|
|
| 01 May 2014 12:40 PM |
I can't do that. That will end up resizing the mesh uniformly. The animation imposes a sort of squishing effect on the mesh that I just am not willing to give up.
I did try this:
local V = script.Parent.ArcaneCrystal.Mesh.Scale.X and script.Parent.ArcaneCrystal.Mesh.Scale.Y and script.Parent.ArcaneCrystal.Mesh.Scale.Z for i = V, 0, -(V/10) do script.Parent.ArcaneCrystal.Mesh.Scale = Vector3.new(i, i, i)
wait() end
It works, but not correctly. For some reason it pumps the mesh up to a scale larger than its actually starting at and then reduces it slowly even though the wait its at nil.
I can attribute that to assigning V to 3 different values. It's a start but it needs to get fixed.
In case you're wondering the idea is that the mesh starts off at the assigned values in the original post and reduces the mesh size in quotients of 10, allowing for a squishing effect in the mesh. It's just an animation.
Actually... Now that I think about... I could just use a ModuleScript and type out the lengthy reductions manually... >_> *freakin face nuke* |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 01 May 2014 12:46 PM |
I see what you mean now.
local size = Vector3.new(2, 1, 5) --What you want it to decrease it by Or make a table for a more generic case
diffs = (.1, .2, .25)
for i = 10, 0, -1 do mesh.Size = mesh.Size-Vector3.new(diffs[1], diffs[2], diffs[3]) end
|
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
| |
|
| |
|
|
| 01 May 2014 01:02 PM |
| I don't understand that at all. where's the i come in? you put for i = 10, 0, -1 do but you arent showing the i in the function at all. are you saying that it can be used as a timer this way? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 01 May 2014 01:07 PM |
| i is just a counter. It doesnt need to be used in the for loop, and the way I did it, i is essentially unnecessary. |
|
|
| Report Abuse |
|
|
|
| 01 May 2014 02:38 PM |
| I fiddled with it a bit and I think I understand for loops better now. Thank you. |
|
|
| Report Abuse |
|
|