ID:145150
 
Code:
area

New()
..()
spawn(5)
day()
proc
day()
layer = 6
while(src)
luminosity = 1
sleep(10)
var/Rand = rand(1,10)
if(Rand<=8)
overlays += 'Moon.dmi'
global.moon += 1
sleep(10)
overlays -= 'Moon.dmi'
global.moon -= 1
else
luminosity = 0
sleep(10)
..()

//
// The above is from Area and the next piece is from mob
//

New()
..()
spawn(5)
werewolf()

werewolf()
if(global.moon==1)
usr.icon_state = "werewolf"


When the moon is 1 the character is supposed to become a werwolf, planned on making this more complex but ran into this little wall. The variable moon doesn't seem to change and i'm not sure why, i defined it under world as a global variable, so i'm really not sure what to do at this point.

help would be appreciated.... is this problem impossible to fix?


if(moon==1)

global not needed. if var is

world/var
moon

or

var
moon

dot and anything before dot not needed.
In response to Ripiz
just through in global. after tweeking with it for some time, it doesn't really help or hurt it.
In response to Ronincyanide
hM YOU COULD TRY SEEING IF MAKING THE DEFAULT VALUE FOR MOON = 0 WILL HELP
var/moon=0

Ofcourse if you are going to use only 1 and 0, I suggest reading about boolean shortcuts

- GhostAnime
In response to Ronincyanide
area

New()
..()
spawn(5)
day()
proc
day()
layer = 6
while(src)
luminosity = 1
sleep(10)
var/Rand = rand(1,10)
if(Rand<=8)
overlays += 'Moon.dmi'
moon += 1
sleep(10)
overlays -= 'Moon.dmi'
moon -= 1
else
luminosity = 0
sleep(10)
..()

//
// The above is from Area and the next piece is from mob
//

New()
..()
spawn(5)
werewolf()

werewolf()
if(moon==1)
usr.icon_state = "werewolf"
moon=0
In response to Ripiz
You're only checking ONCE if the <code>moon</code> variable is one. Should be in a <code>while()</code>.

Wait, scrap that. Look up <code>for()</code> to run in that Area's while().