ID:176298
 
proc Night() for(var/turf/T in world) if(T.icon_state == "")//if its a day icon T.icon_state = "night"//make them night spawn(12000) //20 min Night()//call it again if(T.icon_state == "night")//if its night T.icon_state = ""//make the icons day spawn(12000)//20 min Night()//again world New() ..() Night()

Now, when I add this, the turfs dont change to the night icons state. also I want This to be called for all Obj, and i also want it to give all human players mobs(not including NPC's)if(T.icon_state == "night")then mobs var night = 0 and if(T.icon_state == "") then mobs var night = 1

If anyone can help me do this, i will be greatly appreciative

______
|ETG|
--------
world
New()
..()
Night()
I think the problem is in here, the proc seems to be fine, But the Obj and the Mobs var i still would need help with.

______
|ETG|
--------
In response to Erdrickthegreat2
Ughh...

proc/Night()
for(var/atom/A in world)
A.icon_state = "night"
spawn(12000) Night()
In response to Garthor
garthor, I dont want mobs icon state to change though...
In response to Erdrickthegreat2
for(var/turf/T in world)
In response to Garthor
see, i want Obj and turfs to change.... eh that was my original question
In response to Erdrickthegreat2
Then use two separate loops, one for turfs and one for objs.
In response to OneFishDown
world
New()
..()
Night()

is this called wrong?
In response to Erdrickthegreat2
Couldnt you just dither the mobs? Or overlay the whole world?
In response to Mrhat99au
No, i have specific icons states made for each turf and obj of night.
Erdrickthegreat2 wrote:
<code> > proc > Night() > for(var/turf/T in world) > if(T.icon_state == "")//if its a day icon > T.icon_state = "night"//make them night > spawn(12000) //20 min > Night()//call it again > if(T.icon_state == "night")//if its night > T.icon_state = ""//make the icons day > spawn(12000)//20 min > Night()//again Dangerous stuff alert!! You are calling Night() once for each turf, and each turf in turn is called by Night(). Therefore, if you had 100 turfs, you would spawn 100 calls to Night() for 20 minutes down the road. The next time, each one of those 100 proc calls will call Night() 100 more times, and at the 40 minute mark, you would have 10,000 Night() procs running, and 1,000,000 at 60 minutes, unless your PC melts first. Try this: proc Night() for(var/turf/T in world) if(T.icon_state == "")//if its a day icon T.icon_state = "night"//make them night else//if its night T.icon_state = ""//make the icons day spawn(12000)//20 min Night()//again
In response to Skysaw
am I calling it right at world new, cause it isnt working..

world
New()
..()
Night()


In response to Erdrickthegreat2
Erdrickthegreat2 wrote:
am I calling it right at world new, cause it isnt working..

world
New()
..()
Night()

I wonder if the turfs are created in time for the first run of this proc? According to the reference, the only thing preceeding world.New() "would be the initialization of global variables and objects on the map." Since turfs aren't technically objects, this entry is unclear. I've always assumed they were included, but I'm not certain.

Try as a test:

world
New()
..()
spawn(20)
Night()

Also, make sure you've changed your line:
if(T.icon_state == "night")//if its night

to be
else//if its night

Otherwise the icon_states will flip to night and back to day again before you can probably even see what happened.