ID:179699
 
mob/Login()
blah blah
usr.spells += new/obj/spell/testone

mob
verb
use_magic(mob/M in oview(5))
for(var/obj/spell/S in usr.spells)
var/use = input("use [S]?", text) in list("ya","na")
switch(usr)
if("ya")
S.use()
if("na")
..()
obj
spell
testone
use(mob/M in oview(5))
blah blah
mob
var
list/spells[1]

my main problem here is that the spells never show up. I add one at log in, put there is no spell( i have a state panel) and when i use magic, it just sits there. what's wrong with this? i get no compiler errors


It looks like you want to add an actual object to usr.spells, but you are only adding a type. Try this:
mob/Login()
var/obj/spell/testone/T
T = new(spells)


Now I'm not exactly sure if you can specify a declared list as a location, but it's worth a try. If the compiler complains with the above, you'll have to create the new spell in the mobs contents: T = new(src), then add it to the list: spells += T.

If you don't like the idea of the spell object being in your inventory, you might want to represent spells not as objects, but as keywords in your list. Then you can cycle through the keywords, and branch from there.

Let me know if you need more help on this.