Ok so im trying to figure out how can i make it so a map would be populated with random foilage via turf without it overriding the turf it puts it on.
EX:not needing to make 50 different types of the same flower with the different ground BGs but just the flower alone randomly populated on the map over the different grounds
My other problem is I need a way for it to do this population 1 time without it doing it every time i reboot or host or login so people don't wonder why stuff keeps shifting around everytime and its just static.
So the overall Idea is a way to populate the map randomly with foilage without having to manually map it myself to save time and to save it somehow so it doesn't keep changing until I preform some kind of wipe of that generation of foilage for the map.
ID:2012024
Jan 4 2016, 2:24 am
|
|
so basically i would just make say a new turf and add the code for the turf decorations if i want decoration to be put on them right? so if i want sand to have the 1 out of 10 chance i just copy paste the grass code and change the overlays for the decorations then paint the map with the special sand turf right?
|
Basically, yeah. You'd just want to make sure that any turf that had a chance to be decorated had a New() proc that looked something like the New() proc I showed above.
I would definitely recommend mixing up the percentages and using a top-bottom-middle distribution as well for different turf types. You don't necessarily want every turf to have a decoration if it's got a high roll when the type changes. For instance: turf If you mix up the sweet spot, but keep the range the same, when you create a new dirt turf on top of a grass turf with a decoration, it won't necessarily have a decoration on the dirt turf, but a turf without a decoration may have one on the new turf because the sweet spots are different per type. |
only weird problem im having is when i add a new decoration below the flower it keeps freaking out about wrong indentation even though it should be right
obj why is this? |
This approach will not work for maps that dynamically change their size during runtime, but should work for individual turfs being replaced during runtime.
You can use this to generate turf randomness like so:
Random seeds don't change, so as long as the general order that you are pulling numbers from the random number generator does not change at startup, the map's results should always be the same. Avoid using any random number generators for anything other than turfs before map initialization and you should be able to have a consistent set of map decorations that never move between reboots.