ID:149993
 
Ok first off, here's my code:

proc
DeathCheck(mob/mKilled,mob/mChecker)
if (mKilled.HP <= 0)
if (mKilled.client)
mChecker << "You killed [mKilled]!"
world << "[mKilled] dies!"
del(src)
else // It's an NPC!
mChecker << "You killed a(n) [mKilled]!"
mKilled.HP = mKilled.MHP
mKilled.Move(locate("Outside_StartingPoint"))


What this should do, is if the mob killed is a player, then del the player (kick him off the game) and do the proper notification. But if it's an NPC, I want it to randomly put it in the "Outside_StartingPoint" area. But for some reason, when I kill the NPC mob, it just reappears right were it started (making it not move at all). Anyone have a clue about this one?
Dreq wrote:
mKilled.Move(locate("Outside_StartingPoint"))

...But if it's an NPC, I want it to randomly put it in the "Outside_StartingPoint" area. But for some reason, when I kill the NPC mob, it just reappears right were it started (making it not move at all). Anyone have a clue about this one?

That will only work this way if "Outside_StartingPoint" is a tag that has been assigned to something in the game...did you assign that tag to the area you want?
In response to Deadron
I made a new instance of the area and gave it the tag "EnemyLocA" and told it to warp to locate("EnemyLocA"), and still it doesn't work :(
In response to Dreq
Dreq wrote:
I made a new instance of the area and gave it the tag "EnemyLocA" and told it to warp to locate("EnemyLocA"), and still it doesn't work :(

Did you place the area on the map?

Anyway, probably better than using a tag would be this:

var/area/EnemyLocA/enemy_loc

area
EnemyLocA
New()
enemy_loc = src
return ..()


Then just use mob.Move(enemy_loc).
In response to Deadron
:\
This is gonna be a looong night aparently ;)
Still doesn't want to work... oh well, that's for trying!
In response to Deadron
When i say locate(areawhatever), it locates the first free space, which is almost always the same space. Is there a way to ranomize which space in that location it goes to?
In response to Dreq
Here's one way. It's not the easiest or the cleanest. If you want either of those, figure them out yourself.

First, make a list of all the turfs in the area:

var/list/l = list()
for (var/turf/t in thisarearighthere)
l.Add(t)

Then, pick one item in that list at random. How do you do that? By taking advantage of the fact that if you put

list[n]

where list is the name of the list and n is a number, the computer reads this as "the (n)th item in the list".

So, var/turf/newloc = list[3] will take the third item from the list and name it newloc... all you have to do is tell the computer to move the mob to newloc. But you don't want to just take the 3rd item from the list, or the 1st, or the last. You want to choose an item at random. Well, do you know any way to get a random number? Sure you do... the rand() proc. rand(x,y) will return a number between x and y... you know that x needs to be 1, but what should y be? You could count the number of turfs in the area... but then, you'd have to change the code every time you change the map. Messy, huh? Well, list.len, where list is the name of the list, will give you the length of the list, right?

If you've read this whole post, you now know everything you need to do to solve your problem. No further clarification or help will be given by me.
In response to Lesbian Assassin
PERFECT! Hehe, that was exactily what I needed. And it works. Thanks :)