Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Saving data to a file

Author
Message
airforce1
15
Years of Service
User Offline
Joined: 2nd Apr 2009
Location:
Posted: 2nd Jun 2009 10:17
I was wanting to know if there is a way to save data to a file

where it keeps its position? Like if I randomly place trees using

a for next (rnd) command, when it loads can I save their position

so it won't load up different next time?

Also how can I stop the trees from loading up inside each other

when its random? So they are not to close to one another.

Thank you for any help
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 2nd Jun 2009 17:41
If you used the randomize command at the top of your code, that means that the rnd() that you use will always return the same value for the same randomize value.

However, if you made a tree map, ie an image which has a coloured dot representing the location of a tree, that would be a quickish way to position objects in the same location time after time. Youd just need to read the pixel position from the image, and then position an object at the relevant 3d location. This would also stop trees from loading inside each other.

bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 2nd Jun 2009 17:59 Edited at: 2nd Jun 2009 17:59
yep, the image is probably the best way, but if you still want to use files, read this tutorial: http://forum.thegamecreators.com/?m=forum_view&t=96084&b=7 . that should explain most of it. and about the randomize command, if you use it, you're just giving the rnd command a new seed. it doesn;t make rnd static or something.

*ding ding*
airforce1
15
Years of Service
User Offline
Joined: 2nd Apr 2009
Location:
Posted: 2nd Jun 2009 21:02
I appreciate the help guys. Is there somewhere that explains a little

more on the plant maps and how to go about using one?


Thanks again

Login to post a reply

Server time is: 2024-11-25 06:42:55
Your offset time is: 2024-11-25 06:42:55