ID:264316
 
Code:
obj/projectile
var/damage=0
var/owner
var/odir
var/delay=3
proc/Effect(mob/A)
A.hp -= damage
A.mhp += damage/2
viewers(A) << "[A] has been hit by [src.owner]'s spell!"
A.Deathcheck()
Stupefy
icon='attacks.dmi'
icon_state = "stupefy"
oicon='attacks.dmi'
oiconstate="stupefy"


density=1
damage=25

Bump(A)
if(ismob(A))
var/mob/M=A
M.stupe=1
M.sight |= BLIND
Effect(M)
..()
del src
return
else
viewers(A) << "[A] has been hit by a poorly aimed spell!"
del src
return


mob/Spell
verb
Stupefy()
set category = "Spells"
if(wandout == 1)
if(usr.pertr==0 && usr.incar==0 && usr.ricte==0 && usr.froze==0 && usr.stupe==0)
if(confound == 1)
usr.random=rand(1,2)
if(random == 1)
hearers(usr) << "<font color = teal><b><u>[usr]</b></u><font color = teal>:<i><font color = green> Stupefy!"
var/obj/projectile/Stupefy/P = new(null,usr)
P.loc = usr.loc
P.dir = usr.dir
P.owner = usr
P.odir = usr.dir
walk(P,P.odir)
if(random == 2)
usr << "You raise your wand, only to find the spell leave your grasp"
return
else
hearers(usr) << "<font color = teal><b><u>[usr]</b></u><font color = teal>:<i><font color = green> Stupefy!"
var/obj/projectile/Stupefy/P = new(null,usr)
P.loc = usr.loc
P.dir = usr.dir
P.owner = usr
P.odir = usr.dir
walk(P,P.odir)
else
usr<<"A curse, jinx, spell or enchantment is preventing you from casting spells!"
else
usr << "You must have your wand out!"


Problem description: For some reason, after being hit with the spell, the character's blind bit won't turn on.

Because you're trying to add Blind to the other bits that allow you to see, nulling themselves out and allow you to see everything.

Ditch the |= operator and use =. That should fix the problem.

Also, like in an other post I've told you, start using boolean shortcuts. They make your code easier to read.
In response to Andre-g1
Interesting. I used it that way before and normally it would work...

And what is a Boolean shortcut, if you don't mind me asking?
In response to Demon_F0rce
Instead of checking a value like :

if(something == 1)

// It's better to do

if(something) // as it checks for true values, which are also strings and negative values

//and instead of

if(something == 0)

//do

if(!something) // as it checks for empty strings (""), 0 or null values


It was covered in this</a href> article that I showed you on the other post.
In response to Andre-g1
Ah yes. I updated that on a few of my procs, I'll probably get around to doing to a bunch of others later when I start to properly clean my code up. Thanks for that.
In response to Andre-g1
BLIND should do what it does; make the player blind, regardless of the other bits he has turned on.


Unless, of course, he has things like SEE_TURFS and stuff that could interfere with it on.