ID:178630
 
Is there a way to make it so when a monster dies it respawns randomly somewhere else?
Of coarce, when it dies, instead of deleting it just relocate it. Instead of putting del(M) or something similar, put either a rand with max-coordinates, or rand areas, the latter of which would let you define places where you want it to respawn.
In response to Loduwijk
could you put that in code, because I'm bad about knowing exactly where to put stuff in the code. I'm just learning this and all I've ever worked with is Basic.
In response to Loduwijk
Two things,

1. Why are you writing in bold?

2. If you're going to do it, close your tags.
In response to Foomer
bold? I'm writing in bold?
In response to Likwiddraino000
Version 1. This will locate the mob or obj to a random location within your world's coordinates.

<code>proc/RandomLoc(atom/movable/M) M.loc = locate(rand(1,world.maxx),rand(1,world.maxy),rand(1,world.ma xz)) return</code>

Verion 2. This takes longer, but it will locate the mob or obj to a random non-dense turf in your world.

<code>proc/PickLoc(atom/movable/M) var/list/picklist = list() for(var/turf/T in world) if(O.density) continue picklist += T M.loc = pick(picklist) return</code>


In response to Foomer
I put the code in and it all works fine but it sez this:

frogworld.dm:93:error:O.density:undefined var

for this line of code:

if(O.density) continue

HOW could density be undefined!!
In response to Likwiddraino000
Is O defined as an atom?

var/obj/O
var/turf/O
var/mob/O
var/atom/O
var/area/O

Would work

var/O

Wouldn't.
In response to Nadrew
here's the code:

proc/PickLoc(atom/movable/M)
var/list/picklist = list()
for(var/turf/T in world)
if(O.density) continue
picklist += T
M.loc = pick(picklist)
return


In response to Likwiddraino000
You don't have O defined anywhere, you have T and M defined.
In response to Likwiddraino000
Likwiddraino000 wrote:
here's the code:

proc/PickLoc(atom/movable/M)
var/list/picklist = list()
for(var/turf/T in world)
if(T.density) continue
picklist += T
M.loc = pick(picklist)
return



Foomer meant for that to be T.density.
In response to Foomer
What is wrong with righting in bold? Nothing<s> that I can tell.</s> <font color=blue>I cou</font><font color=red>ld even d</font><font color=gray>o this if i want</font><font size=+2>ed. There's nothing wrong wi</font>th it. Just how I felt like righting it.
In response to Loduwijk
Because abusing html is against the rules. Do you want Dantom to strip all html from the forum?
In response to Nadrew
I'm not modifying my text guys...I'm not making it bold.
In response to Likwiddraino000
He wasn't talking to you.
In response to Nadrew
Ok, so I get the code all right with no errors. But when I run it it sez runtime error :P:

runtime error: Cannot modify null.loc.
proc name: PickLoc (/mob/proc/PickLoc)
usr: Likwiddraino000 (/mob/player)
src: Kiwi (/mob/npc/Kiwi)
call stack:
Kiwi (/mob/npc/Kiwi): PickLoc(null)
Kiwi (/mob/npc/Kiwi): Death(null)
Likwiddraino000 (/mob/player): Attack(Kiwi (/mob/npc/Kiwi))
In response to Nadrew
In response to Likwiddraino000
In response to Nadrew
I was not abusing it, I only typed in bold, which is not wrong, if you must know, I did it because I am used to typing my main text in bold so any code I type I can unbold to set it out from the rest, it is a habit. I was just making the point that there was nothing wrong with it.