ID:138884
 
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.
First off, look up for().

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.
In response to Robertbanks2
I know about for, but what good will that do?
EDIT:Nevermind, for(var/obj/Protego/P in oview(1)) del P
In response to BeignetLover
No:

obj/Protego/New()
..()
spawn(1000) del

mob/verb/Protego()
for(var/turf/T in oview(1))
var/obj/Protego/P = new(T)


That will create them and then destroy them after 100 seconds.
In response to Robertbanks2
Thanks, this method works, although it does create a protego shield where the player is standing, but I can fix that.