ID:138769
 
Code:
for(var/turf/Generic/Grass/W in world)
W.icon_state="Snow [rand(1,4)]"


Problem description: I am trying to make seasonal proc so when its winter all the grass turns into snow but not all the grass turns into snow only the one that is not under another turf

You need to give more detail. What about this is causing you problems? If it is that you don't know how to make only certain types of grass change, then make two grass types, with identical icons. E.G:

turf/Generic/Grass/W
icon = 'grass.dmi'
icon_state = "grass"
turf/Generic/Grass/W2
icon = 'grass.dmi'
icon_state = "grass"
then on the map, place the W2 grass on the locations that you don't want it to change.
I assume you have "turfs on turfs" in the map editor. This is actually not possible at runtime; the game just blends the icons together to make it look like your two turfs are still there, but in reality the turf that is there is probably the top-most one. For example, placing a "tree" turf on top of a "grass" turf would convert the entire turf to a "tree" turf, although grass still appears underneath it.

The only way you could fix that is to probably just change your trees to objs.
In response to Kaiochao (#2)
so basically i cant change grass icon_state?
In response to Hassanjalil (#3)
Hassanjalil wrote:
so basically i cant change grass icon_state?

Umm ya just make a new icon grass and pixel art it with snow and name it GrassWhite or something GrassSnow what ever you would like. Then in your code when the seasons change prompt it somewhere to change the icon state I'm sure there is a way to go about this I have a feeling you're going have to do something like

if (season) new (turf) sleep // allow time to pass before world turf changes I am not a well experienced programmer so I can not actually make you a code snippet, but from my point of view there will be a if statement, new, sleep, del those will be called somewhere along in your highly complex code.

don't mind my text, but thats all the advice I can give to you.