proc/monstercheck()
for(/mob/monster/slime/s in world)
if(s<s.population)
sleep(1000)
new/mob/monster/slime
I havent tested the above code, its only what I think it would look like to do the above mentioned.
ID:165391
Jan 1 2007, 6:51 pm
|
|
I need a turf that checks the spaces around it, or even the world for a certain number of a certain monster. When this number goes below what it should be it waits a few minutes and respawns another monster in its place. I have a basic idea of what it should look like but Im not sure...
proc/monstercheck() I havent tested the above code, its only what I think it would look like to do the above mentioned. |
In response to Masuko Shintaro
|
|
Masuko Shintaro wrote:
I think it would be like this: > proc/monstercheck() // Proc name. (Duh) This isn't tested, but I believe it should work. Would I set the population limit under the slime, or as a global var? Also to set the new slimes location i'd just set
new/mob/monster/slime loc=locate(?,?,?)
right? or would it need to be? new/mob/monster/slime/s |
In response to FriesOfDoom
|
|
Both will have the same effect, by default, so just use the former; note that you're incorrect; the methods go like this:
//first (LOOK PROCS UP BEFORE USING THEM!) Also, you will probably want to sleep() at the beginning of the proc, because now you sleep after you determined the number of slimes in the world, and by the time you finish sleeping, that can indeed change. As I got it, you'll also want the proc to run in an infinite loop [as long as the 'src' turf still exists] - put all of it in a "for()" or "while(1)" statements (both have the effect of creating an infinite loop). |
In response to Kaioken
|
|
I have the slimes spawning.....but they're going crazy! Every time they multiply! Whats wrong with my code? I'm calling the proc when a new slime is made.
mob/proc/slimecheck() |
In response to FriesOfDoom
|
|
nvm.....fixed it, except now, if I kill all of the slimes, the proc no longer replaces them.
|
This isn't tested, but I believe it should work.