ID:264211
 
Code:
obj
DarkBlast
icon='skills.dmi'
icon_state="darkblast"
DblClick()
DarkBlast_1()


proc
DarkBlast_1()
blastdamage = input("How much of your lifeforce to inflict damage?")
usr.hp -= blastdamage
var/obj/blast = new /obj/darkblast(src.loc)
blast.dir = src.dir
blast.loc = src.loc
blast.density = 1
while(blast)
walk(blast,blast.dir)
var/turf/T = blast.loc
if(T.density == 1)
del(blast)
break
for(var/mob/M as mob in T)
if(M)
Bump(M)
M.hp -= blastdamage
M.Deathcheck()
if(usr.battletext ==1)
usr << "You Blasted the enemy for [blastdamage] damage"
if(M.battletext ==1)
M << "[src] used Dark Blast on you for [blastdamage] damage"
del(blast)


Problem description:

spells and skills.dm:151:error:src.loc:undefined var
spells and skills.dm:152:error:src.dir:undefined var
spells and skills.dm:153:error:src.loc:undefined var
spells and skills.dm:175:error:src.loc:undefined var
spells and skills.dm:176:error:src.dir:undefined var
spells and skills.dm:177:error:src.loc:undefined var


I have no idea...sigh
It's a global proc, and global procs have no src's. Also, calling Bump() like that isn't very robust, considering it will call it naturally if it is dense and bumps something. Ever hear of boolean logic, by the way =]?
In response to Jeff8500
obj
DarkBlast
icon='skills.dmi'
icon_state="darkblast"
DblClick()
blastdamage = input("How much of your lifeforce to inflict damage?")
usr.mp -= blastdamage
var/obj/blast = new /obj/darkblast(src.loc)
blast.dir = src.dir
blast.loc = src.loc
blast.density = 1
while(blast)
walk(blast,blast.dir)
var/turf/T = blast.loc
if(T.density == 1)
del(blast)
break
for(var/mob/M as mob in T)
if(M)
// Bump(M)
M.hp -= blastdamage
M.Deathcheck()
if(usr.battletext ==1)
usr << "You used Dark Blast on the enemy for [blastdamage] damage"
if(M.battletext ==1)
M << "[src] used Dark Blast on you for [blastdamage] damage"
del(blast)




ok now what, i double click and it asks for the damage then nothing



getting this in DD:

runtime error: type mismatch: 225 -= "10"
proc name: DblClick (/obj/spells/StaffBlast/DblClick)
usr: Chase Hammer (/mob)
src: StaffBlast (/obj/spells/StaffBlast)
call stack:
StaffBlast (/obj/spells/StaffBlast): DblClick("Spells/Skills", "infowindow.info", "left=1")
In response to Chase_Hammer
i messed around with it, adding "as num" to the input but then it just kills EVERY mob in the world...sigh. anyways its bed time i have a early morning. any help is appreciated as always.
In response to Chase_Hammer
StaffBlast
icon='skills.dmi'
icon_state="staffblast"
DblClick()
blastdamage = input("How much of your MP to inflict damage?") as num
usr.mp -= blastdamage
var/obj/blast = new /obj/staffblast(usr.loc)
blast.dir = usr.dir
blast.loc = usr.loc
blast.density = 1
while(blast)
walk(blast,blast.dir)
// var/turf/T = blast.loc
// if(T.density == 1)
// del(blast)
// break
for(var/mob/M as mob in oview(usr,usr.dir))// in T)
if(M)
// Bump(M)
if(istype(M, /mob/Shadow))
return ..()
else
M.hp -= blastdamage
M.Deathcheck()
if(usr.battletext ==1)
usr << "You used Staff Blast on the enemy for [blastdamage] damage"
if(M.battletext ==1)
M << "[usr] used Staff Blast on you for [blastdamage] damage"
sleep(10)
del(blast)



Problem:

i keep only attacking myself. on the like where is says if(mob/M as mob... i have tried nothing after it (it attacks the whole world), then i tried oview (attacks me and my shadow) so i fixed the shadow attack and now it just attacks me. any help on this PLEASE. also the actual icon/obj of the blast never actuall appears on the screen.
In response to Chase_Hammer
while(blast)
walk(blast,blast.dir)

That's bad; you're calling walk() recursively. Look up what procs do before you use them!

Also, you should use the Bump() proc to handle all collision. It's built into BYOND.

Your little return ..() will only stop the proc, without deleted the blast; look up break and continue. This shouldn't even be a loop, though, since walk() is only required once.

Also look up Boolean logic; as I've said before, there is an entire chapter on it in the DM guide.
In response to Jeff8500
DarkBlast
icon='skills.dmi'
icon_state="darkblast"
DblClick()
blastdamage = input("How much of your lifeforce to inflict damage?") as num
usr.mp -= blastdamage
var/obj/blast = new /obj/darkblast(usr.loc)
blast.dir = usr.dir
blast.loc = usr.loc
blast.density = 1
walk(blast,blast.dir)
// var/turf/T = blast.loc
var/mob/M as mob
if(M)
Bump(M)
if(istype(M, /mob/Shadow))
del(blast)

return
else
M.hp -= blastdamage
if(usr.battletext ==1)
usr << "You used Dark Blast on [M] for [blastdamage] damage"
if(M.battletext ==1)
M << "[src] used Dark Blast on you for [blastdamage] damage"
M.Deathcheck()
sleep(10)
del(blast)



not it goes to a mob then the blast freezes, doesnt attack and doesnt delete
In response to Chase_Hammer
Look up procs before you use them, please. The return ends it, and you obviously have no clue what your doing when it comes to Bump(). You want to override Bump(), not call it directly.
In response to Jeff8500
dude i wish you would look before you speak. the return ONLY ends it on an Shadow...which it is not.

also IT DOESNT END as i said before. thanks for not helping.
In response to Chase_Hammer
Thanks for not learning.

Really, at least indent nicely; I skimmed it and I don't discern spaces from tabs when I read tabbed code. If you're going to be ignorant and rude, leave; I tried helping, and you just don't get it.