Can't Create object runtime in Developer Help
|
|
Code:
Protego() if(usr.wandequiped) set category = "Spells" view() << "<b>[usr] says:<i><font color = blue>Protego!" var/P = new/obj/Protego new P(usr.x,usr.y-1,usr.z) new P(usr.x,usr.y+1,usr.z) new P(usr.x+1,usr.y+1,usr.z) new P(usr.x+1,usr.y-1,usr.z) new P(usr.x-1,usr.y-1,usr.z) new P(usr.x-1,usr.y,usr.z) new P(usr.x+1,usr.y,usr.z) sleep(1000) del P else usr << "<i>You must equip your wand before casting any spells!"
|
Problem description:
Everytime I use the verb "Protego", I get a runtime error, saying I can't create.
|
Second:
var/P = /obj/Protego
new P
You can't use new on a reference, only a type path. Also, the way you have it, they will all stay forever because you're deleting P, not all of the copies of P.