ID:179397
 
How do you make monster spawn point
Kas wrote:
How do you make monster spawn point

How would you like the spawning process to work?

Work out the details of how you'd like it to work (a monster shows up if another monster dies, or one shows up every 5 minutes, or whatever), then we can give you some pointers.
In response to Deadron
Well from the time you kill the monster it will spawn a few mins after you kill it
In response to Kas
Kas wrote:
Well from the time you kill the monster it will spawn a few mins after you kill it

Easiest way to do that is not to delete the mob when it dies.

First, create a variable called "dead" that you check against for your AI routines (returning if dead). Then when you kill the monster, do the following:

dead = TRUE
visibility = FALSE
density = FALSE

Move the mob back to your spawn point. Then use spawn() as a timer to set dead, visiblity and density back when you want him to be reborn.
In response to Skysaw
Skysaw wrote:
Move the mob back to your spawn point. Then use spawn() as a timer to set dead, visiblity and density back when you want him to be reborn.

Also, since in this kind of game you'd probably want to place the monster in the mapper -- have the monster remember it's starting turf. That way it knowns where to respawn and you can change its place on the map without having to change any spawning code.
In response to Deadron
where would i look to find out how to do that
In response to Kas
I did it by running a loop through all mobs in the world at login and storing the turf they are standing on in a variable.

Just make sure you only do it once, you don't want them changing their spawing point whenever someone else logs in.

The way I limited it was by only running the loop if the person logging in was me (the Master GM). Is there a better way to make sure it only runs once? It seems like there should be an obvious way to do it but I'm drawing a blank.
In response to English
English wrote:
I did it by running a loop through all mobs in the world at login and storing the turf they are standing on in a variable.

Just make sure you only do it once, you don't want them changing their spawing point whenever someone else logs in.

The way I limited it was by only running the loop if the person logging in was me (the Master GM). Is there a better way to make sure it only runs once? It seems like there should be an obvious way to do it but I'm drawing a blank.

Yep! Just stick it in world/New() instead of mob/Login().
In response to Spuzzum
Spuzzum wrote:
English wrote:
I did it by running a loop through all mobs in the world at login and storing the turf they are standing on in a variable.

Just make sure you only do it once, you don't want them changing their spawing point whenever someone else logs in.

The way I limited it was by only running the loop if the person logging in was me (the Master GM). Is there a better way to make sure it only runs once? It seems like there should be an obvious way to do it but I'm drawing a blank.

Yep! Just stick it in world/New() instead of mob/Login().

Sigh, Spuzz, you should know better.

In mob.New() do the check. Then each mob will do it once on creation, with no global scans of objects or any such nastiness.
In response to Deadron
where are soem code ref. to this
In response to Kas
Kas wrote:
where are soem code ref. to this

I'm gonna challenge you...I bet you can figure out all by yourself how to have a mob check what turf it's standing on after mob.New() is called.
In response to Deadron
In mob.New() do the check. Then each mob will do it once on creation, with no global scans of objects or any such nastiness.

Oh, I didn't read the post in detail. I just figured he wanted to do some global jobs. It would be better suited to mob/New() (with no looping whatsoever), yeah.
In response to Deadron
Is mob.New() a proc
In response to Kas
Kas wrote:
Is mob.New() a proc

A quick check of the reference (hit F1 in DreamMaker) might give you a clue to this tantalizing mystery!
In response to Deadron
I thought mob/New() was only called when you create a new mob while the game is running, not for mobs that were manually placed on the map...

I basically did that for when I (as a GM) created new mobs in the game as it was running, I didn't think it ran that proc for all mobs originally on the map.
In response to English
English wrote:
I thought mob/New() was only called when you create a new mob while the game is running, not for mobs that were manually placed on the map...

It is called for all objects, created on the map or not.
In response to Deadron
That's a good thing to know, thanks :)

It doesn't mention that in the F1 desription, if it was in the FAQ or somewhere else, sorry for missing it.