Homeworld Effects Manual: setOffsetArray()
setOffsetArray(string name)
Sets the positions of a number of objects.
This command requires some setup earlier in the file. You must make define what exactly name means. This is done with a label() statement and a number of float statements. Unlike setAnimation() and setMeshAnimation(), you do not need int 4294967295 to mark the end of the array. This block of code should go between eventStart() and
label(R1starting09) float [1.2188 *1000 ] float [-1.1775 /1000 ] float [-1 * (-812.4666 )] float [1.2155 *1000 ] float [330.0874 ] float [-1 * (-534.7788 )] float [1.2119 *1000 ] float [217.8 ] float [-1 * (380 )] float [1.7922 *1000 ] float [1.7119 /1000 ] float [-1 * (-481.8517 )] float [1.4053 *1000 ] float [-116.1768 ] float [-1 * (-344.702 )] float [1.2119 *1000 ] float [153.45 ] float [-1 * (564.1907 )] float [1.7039 *1000 ] float [-153.45 ] float [-1 * (564.1907 )] float [1.7039 *1000 ] float [210.1504 ] float [-1 * (380 )] float [1.7783 *1000 ] float [114.7421 ] float [-1 * (-345.5123 )]
This is an array of 9 XYZ co-ordinates (using Homeworld's crazy co-ordinates).
setDefaults() setTexture(textures\glow32,0,0,32,32) setScale(50) setOffsetArray(R1starting09) createSprites(9,0)
This code snippet creates nine sprites using the offset array above. The first sprite will appear at the location defined by the first triplet of floats. The second will use floats 4 through 6, and so on. It is not necessary to create enough objects to use the whole array. I could have created only 1 sprite, and it would have appeared at (1218.8, -0.0011775, 812.4666 ). However, you will probably not set up an array with extraneous elements, so most of the time you will create enough objects to use the whole array.
You can have multiple offset arrays, and since they have nothing to mark their end, you can even nest them. Creating more elements than you have array elements is a bad idea, since it will keep looking for offset co-ordinates to use, and may leak into other arrays.