ID:1792945
 
(See the best response by Ter13.)
Code:
turf/RPGMAKER/Water
icon='RPGMAKERTURFS/Beach.dmi'
icon_state="water"
var
DeepWater=0
Enter(mob/M)
if(ismob(M))
if(!src.DeepWater)
if(M.Diving)
M.Diving=0
M.layer=4
return 1
else return 1
Entered(mob/M)
if(ismob(M))
//M.underlays=null
if(src.DeepWater)
if(!M.Diving)
M.icon_state="swimming";world<<"[M.icon_state]"
M.energy-=rand(10,50)
if(src.icon_state=="Deep Water")
M.energy-=rand(100,250)
if(M.energy<=0)
M.layer=src.layer-1
M.icon_state=""
M.Diving=1
if(M.client)
M.client.screen+=new/obj/HUD/Air
if(!M.Diving)
M<<"You fall into the Water."
return
Exited(mob/M)
if(ismob(M))
if(M.icon_state=="swimming")
M.icon_state=""
else return 1


Problem description:The game tells me my icon_state changes, via the world<< but..it doesn't change in-game..even though it says it does.

</<>
Best response
If there is no icon_state in the icon file named "swimming", it will default to the first icon_state in the file. Likely, there is no icon_state named "swimming" in the file. Make sure that capitalization is correct, and that the icon_state in the file EXACTLY matched the string "swimming".

If you still haven't found an error, try running this:

mob
verb
check_icon_state()
var/list/l = icon_states(src.icon)
if("swimming" in l)
usr << "found icon state: swimming"
else
usr << "unable to find swimming state"

 turf/RPGMAKER/Water
Entered(var/mob/M)
if(ismob(M))
//M.underlays=null
if(src.DeepWater)
if(!M.Diving&&M.Diving=0)
M.icon_state="swimming";world<<"[M.icon_state]"
M.energy-=rand(10,50)
if(src.icon_state=="Deep Water")
M.energy-=rand(100,250)
if(M.energy<=0)
M.layer=src.layer-1
M.icon_state=""
M.Diving=1
if(M.client)
M.client.screen+=new/obj/HUD/Air
if(!M.Diving)
M<<"You fall into the Water."
return



I tried what Ter said first. The icon_state was found, but it still doesn't change via entering the water.

I then tried what Tarun said, no luck either.

Update: I think I fixed it. I think my movement coding was interfering with the water coding, so I had to change a bit of both.