ID:179494
 
I decided to try and come up with something FIRST, before I got on here and had it spoonfed to me ;-), so I came up with this little ditty for mob switching:

//First of all, I should show this
mob
arrival
peasant

world/mob = /mob/arrival

//Here is the code in question
Switchmob()
var/mob/oldmob
oldmob = src
var/mob/newmob = new /mob/peasant
newmob.key = src.key
del oldmob

It's hard to tell whether this is working or not when I run it. Also, if there is a better way for switching mobs and deleting the old 'empty' mob, please let me know.

Thanks!

-- John

[Edited due to reply]
Just to clarify, I just used a verb to show me in-game what the value of client.mob is, and I am curious... when I using the code I posted, it returns the value "The peasant", but when I comment out that code (so I retain mob/arrival status), the value is "Felegar", which I assume is the same as client.key. I wonder why the value is not "The arrival". By the way, nothing else has been assigned yet, like mob.name or anything.

-- John
In response to Felegar
Felegar wrote:
Just to clarify, I just used a verb to show me in-game what the value of client.mob is, and I am curious... when I using the code I posted, it returns the value "The peasant", but when I comment out that code (so I retain mob/arrival status), the value is "Felegar", which I assume is the same as client.key. I wonder why the value is not "The arrival". By the way, nothing else has been assigned yet, like mob.name or anything.

The default mob/Login() procedure sets usr.name to their key.