ID:157510
 
Well here's the clue. what i want is to make a player created object able to damage people, not trough it being dense and using Bump(). but rather something that will damage them when it is created on/in their location.

First i thought i could use Entered and Exited. but this will not damage them if the object is created at their location.

so what i thought was i could do this:
for(var/mob/M in oview(0)) // or something?
sleep(50)
M.hp -= rand(4,8)

I had fun with this :)
mob
verb
bomb()//create a new bomb in the usr. Mostly for testing.
new/obj/bomb(usr)
placebomb(X as num, Y as num)//place a bomb on the map
new/obj/bomb(locate(X,Y,1))
checkhp()
usr<<hp
var/hp=100
obj
bomb
New(var/loc)//when a new bomb is created
..()
if(istype(loc,/mob))//if it was created in a mob
explode(loc)//blow it up!
proc/explode(var/mob/M)//When a bomb explodes
M.hp--//have it damage the mob it exploded on
M<<"A bomb exploded on you."//tell them
del src//and destroy the bomb
turf
Entered(var/mob/M)//when a mob enters a turf
..()
for(var/obj/bomb/B in contents)//have it check for bombs
B.explode(M)//and explode any of them found.


Edit: Added comments, but not sure if they were needed. Oh well...
In response to Redslash
This seems to be something like i wanted it:P

However, i want the object to continiously?(repeatedly) damage to the mob and not be deleted before a certain amount of time (set by player) has past. Don`t worry about the time thing, i think i have that worked out.

Anyways, i think i will be able to take what you have here and configure it to what I`m looking for :)

Thanks :)
In response to Zeppo
Try modding it and using spawn()
In response to Darkjohn66
depends, did you get the answers you wanted?

if not, you either give bad explainations to the problem or what you want to do, i also find that it helps to give an example of how you have tryed to solve the "problem", that way giving them a better idea of what it is you are trying to achieve.
In response to Zeppo
Idk. Anyways, I would like to see how to change the coordinates of that attack to say a targeted mob, or just place it 1 space away from the mob without having to enter any text. Im going to try to mod it.

I need to figure out how to set up variablles for the mobs location.

        placebomb2()
new/obj/bomb(locate(M.x + 1, M.y + 1, M.z))


Bomb Test.dm:8:error: M.x: undefined var
Bomb Test.dm:8:error: M.y: undefined var
Bomb Test.dm:8:error: M.z: undefined var


Edit:I got it
        placebomb2()
new/obj/bomb(locate(src.x + 1, src.y + 1, src.z))
In response to Darkjohn66
Why doesnt this do anything at all and how can I fix it? All it does is create the objs.

mob
NPC
icon = 'mob.dmi'
hp = 5
proc/HpCheck()
if(hp == 0||hp < 0)
del src

obj
nagashi
icon = 'nagashi.dmi'
New(var/loc)//when a new bomb is created
..()
if(istype(loc,/mob))
electrecute(loc)
proc/electrecute(var/mob/M)
M.hp -= 5
M<<"<font color=blue>Electricity shocks you!"
spawn(20)
del src
Bump(mob/M)
if(istype(M))
step_away(M,src,1)

mob
verb
Chidori_Nagashi()
new/obj/nagashi(locate(src.x + 1, src.y, src.z))
new/obj/nagashi(locate(src.x - 1, src.y, src.z))
new/obj/nagashi(locate(src.x + 1, src.y + 1, src.z))
new/obj/nagashi(locate(src.x - 1, src.y + 1, src.z))
new/obj/nagashi(locate(src.x + 1, src.y - 1, src.z))
new/obj/nagashi(locate(src.x, src.y - 1, src.z))
new/obj/nagashi(locate(src.x - 1, src.y - 1, src.z))
new/obj/nagashi(locate(src.x, src.y + 1, src.z))
In response to Darkjohn66
It does nothing because locate(x,y,z) gives you a turf, not a mob.