ID:159087
 
After like 30 minutes 'cuz I'm a noob, I found out how to add something to the user's spell inventory in one line:

usr.spells+= new /mob/spells/Magic_Missile(usr.spells)

But now, how can I make it so that in another place, it removes that spell from the user's spell inventory in one line?

I just tried this method, myself:

usr.spells-= /mob/spells/Magic_Missile

but it didn't work =(.
That's because you're adding a new instance of an object but trying to remove a path.

You should locate() the item and then remove it.
var/item/A = locate(/spell/B) in X.list
if(A) X.list -= A


X.list.Remove(locate(/spell/B) in X.list)


There could be an easier way I can't remember