ID:262783
 
Code:
mob/verb
Pyrodarts(mob/M in oview(src))
set category = "Spells"
if(usr.MP < 5)
usr << "You don't have enough MP to cast Pyrodarts!"
else
var/obj/projectile/fireball/F = new (src.loc, src)
walk_to(F, M, 5)
usr << "PYRODARTS!"
spawn(50)
del(F)

obj/projectile
var/mob/fireball
density = 1
New(l, mob/M)
src = M
..()
fireball
icon = 'Pyrodarts.dmi'
Bump(atom/A)
if(ismob(A))
var/mob/M = A
var/damage = usr.Magic_Attack + usr.Fire_Skill - M.Resistance
M.HP -= damage
usr << "[M] has taken [damage] damage!"
M.DeathCheck()
del(src)


Problem description:

everything checks out,but the icon doesn't appear nor does it deal damage. i also want to set a range to it. plz help. this wil be a huge help with all spells.
icon=''
you never specified an icon
look under obj/projectile, icon = 'Pyrodarts.dmi' is right there.
In response to Pyro_dragons
Doesn't look like you set a icon state though.
No put usr in proc. Ungh.

(Specifically, the usr in Bump() is very, VERY bad.)
In response to Jp
Jp wrote:
No put usr in proc. Ungh.

(Specifically, the usr in Bump() is very, VERY bad.)

Depends.. If players or mobs can't be moved by anything else but themselves it could be fine, though.

PS: Don't let this be one of 'em hijacked threads now.
In response to Mysame
It's still silly. It just doesn't go there. 'Tis not robust. And it's quite unlikely that mobs can only move themselves. It's quite likely that there will be some way where mobs will be moved by other mobs, or by some sort of world proc. It just isn't safe.
In response to Jp
ok, the spell appears, but it doesn't walk to the mob, nor does it deal damage.
In response to Pyro_dragons
Can you show us the code?
Pyro_dragons wrote:
Code:
mob/verb
> Pyrodarts(mob/M in oview(src))
> set category = "Spells"
> if(usr.MP < 5)
> usr << "You don't have enough MP to cast Pyrodarts!"
> else
> var/obj/projectile/fireball/F = new (src.loc, src)
> walk_to(F, M, 5)
> usr << "PYRODARTS!"
> spawn(50)
> del(F)
>
> obj/projectile
> var/mob/fireball
> density = 1
> New(l, mob/M)
> src = M
> ..()
> fireball
> icon = 'Pyrodarts.dmi'
> Bump(atom/A)
> if(ismob(A))
> var/mob/M = A
> var/damage = usr.Magic_Attack + usr.Fire_Skill - M.Resistance
> M.HP -= damage
> usr << "[M] has taken [damage] damage!"
> M.DeathCheck()
> del(src)
>


Whoah, what the hell did you do with my example I gave you? You ended up doing so many useless things, and breaking it up yourself.

obj/projectile
var/mob/fireball
density = 1


Why did you rename the owner of the projectile to "fireball"? That makes no sense at all. You seemed to have ignored the fact that the projectile has an owner, and taken it off yourself.

  New(l, mob/M)
src = M
..()


Are you trying to convert the fireball to the owner, or something? What it was supposed to do (what you screwed over) was to change src.owner = M (which you changed to "fireball" for some reason).

      if(ismob(A))
var/mob/M = A
var/damage = usr.Magic_Attack + usr.Fire_Skill - M.Resistance
M.HP -= damage


usr is completly useless and utterly wrong in here. You should have used the owner of the projectile which has been set to when it was created. (Which you changed to "fireball" for some odd reason, again).

        usr << "[M] has taken [damage] damage!"
M.DeathCheck()


usr is also wrong here. Since you're not passing any arguments in DeathCheck(), I'm also guessing you are using usr in there also, which is very wrong. Pass the owner through the argument to get the correct killer. Otherwise you'll end up having another error if this block of programming works.

You also need to un-indent del(src) if you want it to delete when it bumps anything. Otherwise, it'll just sit in a place until it hits a mob, which might be never.

~~> Unknown Person