ID:156162
 
client
proc
NewClass(var/NewClass)
switch(NewClass)
if("Thief")
var/mob/A
A=new/mob/Classes/Thief
A.name=mob.name
mob=A

Well, this works, only I have two things I'm wondering:
1) Is there a more efficient way to change mob paths? Or make this way more efficient?

2) It creates a shell of your former self behind, which I want to delete. How should I go about getting rid of that useless shell?

Thanks for reading/helping!
var/classPath = text2path("/mob/Classes/[NewClass]")
var/mob/A = new classpath


The shell you're referring to automatically gets picked up by BYONDs Garbage Collector. You can, however, simple set it to null.

A=null


That way, the GC won't have to look for what to collect, but will know, which saves resources.