I downloaded this source from the net and it all works fine but i cant quite work out the attacking part which i had to put in myself
mob
icon = 'yellow.dmi'
verb
throwprojectile()
fireprojectile(/obj/projectile/projectile,src)
proc
fireprojectile(Type, mob/Who)
/*
Type = the type of projectile
Who = who fired/threw the projectile
*/
var/obj/projectile/S = new Type(Who.loc)
if(!istype(S,/obj/projectile))
world.log << "Invalid projectile:[Type]"
return
S.dir = Who.dir
S.who = Who
S.missileloop()
obj
projectile
density = 1
layer = FLY_LAYER
var
mob/who
damage = 0
mrange = 10
delay = 1
proc
missileloop()
step(src,dir)
if(--mrange > 0)
spawn(delay) missileloop()
else
endmissile()
endmissile()
del(src)
Bump(O)
if(ismob(O))
world << "[who]'s [name] hit [O] for [damage] damage!"
//do your damage routine here
endmissile()
projectile
icon = 'shield.dmi'
So here is the code for the damage that i made
var/damage
damage = usr.MAGIC_STR
src.HP -= damage
world << "[who]'s [name] hit [O] for [damage] damage!"
But i cant workout how to make the mob in the. Normaly you would use
Attack(mob/M in oview(1))
To define M but i cant with this how can i do it?
ID:148456
![]() Feb 11 2003, 1:31 am
|
|
Go to http://shadowdarke.byond.com/snippets/snippets.html and it is projectile.zip
|
well, O would be considered the thing that was hit...
so, you could do something like this: O.HP -= damage so, the thing you made would actualy be: var/damage damage = who.MAGIC_STR O.HP -= damage world << "[who]'s [name] hit [O] for [damage] damage!" or something... if you were to give the missle a MAGIC_STR, then you'd probably just have to take the who. part. |
Before I answer your question, I would like to know WHAT this downloaded source is.