ID:145990
 
Code:
    water
icon = 'Water.dmi'
Entered()
usr.icon += 'Dither25.dmi'
Exited()
usr.icon -= 'Dither25.dmi'


Problem description: When you enter the water, it doesn't do anything. Neither does it do a thing when you exit it.. (used to dither, but then couldnt switch back.. Meh)

try using usr.overlays += 'Dither25.dmi'.
Stefm wrote:
Code:
    water
> icon = 'Water.dmi'
> Entered()
> usr.icon += 'Dither25.dmi'
> Exited()
> usr.icon -= 'Dither25.dmi'
>


Problem description: When you enter the water, it doesn't do anything. Neither does it do a thing when you exit it.. (used to dither, but then couldnt switch back.. Meh)

First off all you're abusing usr, and using Entered() & Exited() incorrectly.Second of all is that you can't add a icon to usr.icon, a mob can only have one icon. To change usr's icon you will have to do 'usr.icon = 'Dither25.dmi'', though I don't think you meant that.

I assume you meant usr.overlays instead of usr.icon.

    water
icon = 'Water.dmi'
Entered(mob/M)
if(ismob(M)&&M.client) // you can remove the '&&M.client' part if you want NPC's to get the overlay to
M.overlays += 'Dither25.dmi'
Exited(mob/M)
if(M.client&&ismob(M))
M.overlays -= 'Dither25.dmi'

You shouldn't use usr in movement procs like Entered(), since it could be anything that moved the player. The way to track whatever is entering the turf is to get it from the argument from Entered(). It does this by default.

You also can't "redo" something added to the icon by just trying to use <code>-=</code> on it. You would need to save their original icon, then revert it back when they exit the turf.

atom
var/orig_icon
New()
..() // every icon has an original, if it can be changed
src.orig_icon = src.icon
turf/water
Entered(atom/A)
A.icon += 'Dither25.dmi'
Exited(atom/A)
A.icon = A.orig_icon


~~> Dragon Lord