var/winddirection
obj
weather
rain
icon='weather.dmi'
icon_state=winddirection
proc
windcheck()
var/Direction = rand(1,4)
switch(Direction)
if(1)
winddirection="North"
//I do this for all of the directions
Now, no matter what I try (I've been trying to an hour) I keep getting this error:
"Expected constant expression" on the line of the icon_state
And when I try to make a var like
obj
weather
rain
var/DIR = winddirection
icon='weather.dmi'
icon_state=DIR
I get an "Invalid variable" error on the icon_state line.
Any suggestions?
You can't initialize a variable to the value of another variable. If you want to do that, you have to do it in New(). That's because the compiler doesn't necessarily know what value winddirection will have at the time the rain object is created in the game.