Ok, if you want to do it that way, I will give you some hints.
I would make a grid similar to the influence map.
- So you need two variables: grid_x_max and grid_y_max (grid_x means the maximum number of grid tiles in x direction)
- important information: grid_x_max * grid_y_max = number_of_nodes
- tile_width = level_width/grid_x_max (example: 40000/20 = tile_width = 2000 .... tile_length similar with y_max
- example for 3x3 grid (grid_x_max=3, grid_y_max=3)it looks like this
7 8 9
4 5 6
1 2 3
- make while loop from i=1 up to number_of_nodes
- inside the loop: calculate the position of the node (use the cornerpoint or the middle point) - (the next calculation is for your lowest level borders in x and y direction at Zero, if it is not use an offset)
x-position (middle of the tile)= ((i-1)%grid_x_max)* tile_width + tile_width/2 and then
y-position (middle of the tile) = (int((i-1)/grid_x_max))* tile_length + tile_length/2
( for better understanding make a scatch on a sheed of paper then everything should be clear)
- the z-position, I think there are some possibilities like using trace from a position (x,y calculated before, but z much higher then the terrain), so you can calculate a good hight for every node. Or using a very high z-value and let them drop or ......
- use ent_create at the x,y,z position
This could be one way for such a function.
I haven't tested this pseudocode, so I hope everything will be correct. But it is one possible way.
I hope this will help you !!!
Bye G.S.
Last edited by Gordon_Shumway; 12/15/07 22:36.