I have made this little script for myself to better understand scripting in OFp.
It uses two arrays, some random numbers and a game logic which runs the script to move the game logic around the map to predefined positions at various heights.
But in the control with hint the first position is always okay (and varying),
then on the second the getpos command delivers always position "10968.8,3284.92,-0.440994".
It is not possible for the height value to go into negative with this script.
And this value will stay there forever, while the variables in the setpos command function as i thought they'd do and will be actualized with the loop.
The positions roughly equal some trees in Lipani,Nogova.
#loop
_treesX=[10650.293945,10700.918945,10707.552734,10734.062500,10735.851563,10745.424805,10749.095703,10780.573242,10805.087891,10814.947266,10823.416016,10835.656250,10839.375000,10843.005859,10881.998047,10901.287109,10914.408203,10926.298828,10951.916992,10974.490234,10980.588867]
_treesZ=[3187.731934,3062.773193,3196.926758,3150.397461,2976.351074,3182.318115,3293.530273,3294.403809,3026.086914,2992.170654,3257.679688,3282.161621,3031.016602,2976.652588,3241.941162,3032.453125,2957.813965,3094.065186,3173.368164,3115.416016,3242.299561]
_rand=random 20
_whichtree=_rand - (_rand mod 1)+1
_rand=random 4
_height=_rand - (_rand mod 1)+1
this setpos[_treesX select _whichtree,_treesZ select _whichtree,_height]
hint format["%1 %2 %3\n%4 %5 %6",getpos this select 0,getpos this select 1,getpos this select 2,_treesX select _whichtree,_treesZ select _whichtree,_height]
~3
goto "loop"
Can anybody see an error in it which would explain this behaviour?
Thanks, StG