ID:1693571
Oct 5 2014, 2:47 pm
|
|
So, i'm a zombie survival inspired by DayZ and i want to make a system like DayZ that spawns a object in the map every so to say 10 minutes. What are the ways i can do this. I've been thinking world procs but also turf procs can do the same thing. So, which way is best and why?
|
A spawner might be a good idea to implement. If an object was randomly spawned anywhere in the world, it could spawn in walls and unreachable areas.
You could also use the /area datum and change the areas of which you would like to have as places to spawn things. Then, iterate through area.contents for the turfs and randomly pick one of those. global.SpawnObject() can be placed in a world ticker (which you could make sleep every ten minutes). proc/SpawnObject(T) |
There are several ways to approach this.
One good method I can think of is manually placing nodes on the map, that way you have control over where they'll spawn, so they don't spawn somewhere ridiculous like on the roof. Another way of doing this is placing all of the tiles you want into a global list, and then choose a random tile from that list to spawn said item. |
In response to Mr_Goober
|
|
Mr_Goober wrote:
A spawner might be a good idea to implement. If an object was randomly spawned anywhere in the world, it could spawn in walls and unreachable areas. > proc/SpawnObject(T) This code, doesn't seem like it will make me choose what to spawn. |
In his example, you call SpawnObject, and pass in the type of object you want to spawn.
|
In response to Mightymo
|
|
Mightymo wrote:
Do you have the spawnable area defined and placed? Indeed in order to have them spawn in the map there needs to be some sort of region of /area/spawnable. |
In response to Mr_Goober
|
|
> proc/SpawnObject(T) Slightly shrank the code a bit. Ztars: Are you placing the /area/spawnable in your map where you want items to spawn? Do items properly show up/display if you place them in manually in the map editor? How are you calling SpawnObject()? |
world |
Guys, can we forget this, i made a easier Generating system with objects instead of areas. I think that the problem was with the area not the programming. Also, anyone has ideas on how to add a prob to a pick prob? Like a prob to generate a Swat helmet.
|
In response to FallenZtars
|
|
Are you asking for a "weighted pick", where each item has a certain weight that can make one item more rare/common than the others? I'm pretty sure I've seen that before. I suggest using the forum search.
|
Now you'd edit Spawner/New() so that you can run a loop that spawns objects when a Spawner is created.