ID:263086
 
Code:


Problem description:

Is there a way i can check to see if something CANT move? i have projectiles and if they stop at something (edge of the map) they just stand there, and you can like... wear a lightningbolt.... i need to be able to get rid of it, but its above my head so im asking for help
Look up bump() in the reference.
In response to Satans Spawn
i already am using bump, it doesnt register as bumping is my guess when its the end of the map...

    Bump(atom/A)
if(ismob(A))
var/mob/M = A
if(!src.spell)
M.hp -= src.damage
M.projectiledeathcheck(src.owner)
else
M.hp -= src.owner.int + 1
M.projectiledeathcheck(src.owner)
del(src)
In response to Koric_vod
If it is the end of the map, check the object that is moving to see if it is equal to the world.maxx and world.maxy then. if one of them is the same as the objects x or y coordinate, then it is at the end of the map. Or check it to see if it is at 0.

Or you could even add an object at the end of the map that looks like the end of the map but has a density of 1 so that the object will bump into it.
In response to Satans Spawn
ill end up doing the last one thank you!!

by the way, i love this forum, helpfull people, hope someday i know enough of DM to be able to help lol

Sadly though, i found a new problem (again with movement sigh)
mob
verb
icebolt(mob/M as mob in oview(7))
set category = "Fighting"
if(src.limit)
return
else
src.spellWait()
var/obj/icebolt/lol = new(src.loc)
while(lol.loc != M.loc)
sleep(1)
step_towards(lol,M)
if (lol.loc == M.loc)
if(M && M.loc == lol.loc)
M.hp -= src.int
M:deathcheck()
view(7) << "HIT"
del(lol)


i want to be able to cast multiple spells at once, but when i do that if M dies, the spell just sits there same as it did before, but i still have no idea how to delete the spells
In response to Koric_vod
First off, M:deathcheck() is a bad way to do it. use M.deathcheck(). I am not too sure of the reasoning behind that, I just know I heard it's bad habit.

Other than that, it would help to see your deathcheck code in this case, I may be able to help you out with how you handle your deaths so any projectiles being shot at the player will delete upon the mobs death.

Also, you should use Bump() rather than checking to see if the locations are the same.

mob
verb
icebolt(mob/M as mob in oview(7))
set category = "Fighting"
if(src.limit)
return
else
src.spellWait()
var/obj/icebolt/lol = new(src.loc)
while(lol)
sleep(1)
step_towards(lol,M)

obj/icebolt/Bump(var/O)
if(istype(O,/mob))
O.hp -= src.int
O.deathcheck()
view(7) << "HIT"
del src


That new code SHOULD fix your non-deletion problem. I never tested it or anything, but I don't see why it wouldn't.
In response to Satans Spawn
Satans Spawn wrote:
First off, M:deathcheck() is a bad way to do it. use M.deathcheck(). I am not too sure of the reasoning behind that, I just know I heard it's bad habit.

Other than that, it would help to see your deathcheck code in this case, I may be able to help you out with how you handle your deaths so any projectiles being shot at the player will delete upon the mobs death.

Also, you should use Bump() rather than checking to see if the locations are the same.

> mob
> verb
> icebolt(mob/M as mob in oview(7))
> set category = "Fighting"
> if(src.limit)
> return
> else
> src.spellWait()
> var/obj/icebolt/lol = new(src.loc)
> while(lol)
> sleep(1)
> step_towards(lol,M)
>
> obj/icebolt/Bump(var/O)
> if(istype(O,/mob))
> O.hp -= src.int
> O.deathcheck()
> view(7) << "HIT"
> del src
>

That new code SHOULD fix your non-deletion problem. I never tested it or anything, but I don't see why it wouldn't.


i fixed it, i just used the automatic missile proc to gaurantee deletion
In response to Koric_vod
Walking, moving, ... should be included in the new(), while(lol) makes no sense at all, especially because step_towards() could be replaced by walk_towards().

And if the icebolt() bumps into a densed obj/turf it'll just:
- Be unrealistic and still.. Euh.. Be there and keep on walking
- Stand..Still..In a dark corner..