ID:269960
 
Say i have turf/grass and turf/night/grass, how can i make a verb that replace the regular turf with the night turf like a day night system. Like in dwl.
You shouldn't change turf types when you do stuff like that. Since night turfs (i'm guessing in your game) might just be an edited darker version of the 'day' turfs, you can just change the icons. You can't directly change path types anyway, so you should just have alternate files with the night turfs in them.

~~> Unknown Person
In response to Unknown Person
I have 2 code files of night and day.
In response to Xx Dark Wizard xX
Uh...how is that relevant to what he posted?
In response to Hell Ramen
turf
water
icon='water.dmi'
water
icon_state="water"
density=1
waternight
icon_state="waternight"
density=1
lava
icon_state="lava"
density=1
lavanight
icon_state="lavanight"
density=1
thats what i have
In response to Xx Dark Wizard xX
i changed it a bit
In response to Xx Dark Wizard xX
veryyyy long
for(var/turf/grass/a in world)
new/turf/grassnight(a.loc)
del(a)
or you can easily do
for(var/turf/a in world)
a.icon_state = "night"
assuming you use a different icon for each turf
In response to Rky_nick
any easier way?
In response to Xx Dark Wizard xX
dunno. depends on what exactly your day/night system does
In response to Rky_nick
ok this is what it is. i have
turf
water
icon='water.dmi'
water
icon_state="water"
density=1
waternight
icon_state="waternight"
density=1
lava
icon_state="lava"
density=1
lavanight
icon_state="lavanight"
density=1
dw1water
icon_state="dw1water"
density=1
dw1waternight
icon_state="dw1waternight"
density=1
snownight
icon_state="snownight"
density=1
snow
icon_state="snow"
density=1

I need a verb that adds the text "night" after the turf's iconstate, and changing them, from day to night to day etc etc.
In response to Xx Dark Wizard xX
there is a lot easer way creaed a icon. make have the pixele black and the other have invible. like this patten

X0X0X0X0X0X0X0X
0X0X0X0X0X0X0X0
X0X0X0X0X0X0X0X
0X0X0X0X0X0X0X0
X0X0X0X0X0X0X0X
0X0X0X0X0X0X0X0

Where X = Black
0 = Invible

Then when its night overlay it on every turf and when its day remove it from every turf
In response to The Riddler
I made the icons, i just need a verb that will change all the regular turfs to night like turf/grass and replace it with turf/grassnight. and affect every turf on the map.
In response to Xx Dark Wizard xX
You can't just change path types of an object. In order to do that, you'd have to create a new object in replacement for that, which I doubt you'd want to do. As I said earlier, you want to change the icon instead.

~~> Unknown Person
In response to Unknown Person
yes how can i change all the icons.
In response to Xx Dark Wizard xX
A simple for() loop will do. You need to have a global variable checking if it is day or night.

var
day = 1 // if true, it is day, otherwise it's night

proc
daynight()
day = !day
world << "It is now [day ? "day" : "night"]"
for(var/atom/a in world)
a.icon = day ? 'turfsday.dmi' : 'turfsnight.dmi'


This would work if all atomic object's icons were in one file. If not, you would have to set some conditions.

~~> Unknown Person
In response to Unknown Person
mob/verb
daynight()
day = !day
world << "It is now [day ? "day" : "night"]"
for(var/atom/a in world)
a.icon = day ? 'turfsday.dmi' : 'turfsnight.dmi'


how do i apply that to
turf
water
icon='water.dmi'
water
icon_state="water"
density=1
waternight
icon_state="waternight"
density=1
lava
icon_state="lava"
density=1
lavanight
icon_state="lavanight"
density=1
i have atleast 150 turfs.
In response to Unknown Person
This is my turf file
turf
water
icon='water.dmi'
water
icon_state="water"
density=1
waternight
icon_state="waternight"
density=1
lava
icon_state="lava"
density=1
lavanight
icon_state="lavanight"
density=1
dw1water
icon_state="dw1water"
density=1
dw1waternight
icon_state="dw1waternight"
density=1
snownight
icon_state="snownight"
density=1
snow
icon_state="snow"
density=1
downedge
icon_state="downedge"
density=1
downedgenight
icon_state="downedgenight"
density=1
leftedge
icon_state="leftedge"
density=1
leftedgenight
icon_state="leftedgenight"
density=1
upedge
icon_state="upedge"
density=1
upedgenight
icon_state="upedgenight"
density=1
rightedge
icon_state="rightedge"
density=1
rightedgenight
icon_state="rightedgenight"
density=1
uprightedge
icon_state="uprightedge"
density=1
uprightedgenight
icon_state="uprightedgenight"
density=1
upleftedge
icon_state="upleftedge"
density=1
upleftedgenight
icon_state="upleftedgenight"
density=1
downleftedge
icon_state="downleftedge"
density=1
downleftedgenight
icon_state="downleftedgenight"
density=1
downrightedge
icon_state="downrightedge"
density=1
downrightedgenight
icon_state="downrightedgenight"
density=1
leftcorner
icon_state="leftcorner"
density=1
leftcornernight
icon_state="leftcornernight"
density=1
rightcorner
icon_state="rightcorner"
density=1
rightcornernight
icon_state="rightcornernight"
density=1

wall
icon='wall.dmi'
stone
icon_state="wall"
density = 1
stoneedge
icon_state="wall"
density = 1
fence
icon_state="fence"
density = 1
stone
icon_state="stone"
density = 1
stoneedge
icon_state="stoneedge"
density = 1
stonenight
icon_state="stonenight"
density = 1
stoneedgenight
icon_state="stoneedgenight"
density = 1
fencenight
icon_state="fencenight"
density = 1
cavewall
icon_state="cavewall"
density = 1
cavewalledge
icon_state="cavewalledge"
density = 1
dw1stone
icon_state="dw1stone"
density = 1
dw1stonenight
icon_state="dw1stonenight"
density = 1
curtains
icon_state="curtains"
density = 1
curtainsnight
icon_state="curtainsnight"
density = 1
cavewallnight
icon_state="cavewallnight"
density = 1
cavewalledgenight
icon_state="cavewalledgenight"
log
icon_state="log"
density = 1
sandfence
icon_state="sandfence"
density = 1
woodedge
icon_state="woodedge"
density = 1
woodedgenight
icon_state="woodedgenight"
density = 1
wooddown
icon_state="wooddown"
density = 1
wooddownnight
icon_state="wooddownnight"
density = 1
wood
icon_state="wood"
density = 1
woodnight
icon_state="woodnight"
density = 1
wooddownleft
icon_state="wooddownleft"
density = 1
wooddownleftnight
icon_state="wooddownleftnight"
density = 1
wooddownright
icon_state="wooddownright"
density = 1
wooddownrightnight
icon_state="wooddownrightnight"
density = 1
woodupleft
icon_state="woodupleft"
density = 1
woodupleftnight
icon_state="woodupleftnight"
density = 1
woodupright
icon_state="woodupright"
density = 1
wooduprightnight
icon_state="wooduprightnight"
density = 1
lognight
icon_state="lognight"
density = 1
sandfencenight
icon_state="sandfencenight"
density = 1
tallstoneedge
icon_state="tallstoneedge"
density = 1
tallstoneedgenight
icon_state="tallstoneedgenight"
density = 1
ceiling
icon_state="ceiling"
density = 1
ceilingnight
icon_state="ceilingnight"
density = 1
cobbleedge
icon_state="cobbleedge"
density = 1
cobbleedgenight
icon_state="cobbleedgenight"
density = 1
cobble
icon_state="cobble"
density = 1
cobblenight
icon_state="cobblenight"
density = 1
pillarup
icon_state="pillarup"
density = 1
pillarupnight
icon_state="pillarupnight"
density = 1
pillardown
icon_state="pillardown"
density = 1
pillardownnight
icon_state="pillardownnight"
density = 1
lion
icon_state="lion"
density = 1
lionnight
icon_state="lionnight"
density = 1
window
icon_state="window"
density = 1
windownight
icon_state="windownight"
density = 1
leftcastlecorner
icon_state="leftcastlecorner"
density = 1
leftcastlecornernight
icon_state="leftcastlecornernight"
density = 1
rightcastlecorner
icon_state="rightcastlecorner"
density = 1
rightcastlecornernight
icon_state="rightcastlecornernight"
density = 1
leftcastle
icon_state="leftcastle"
density = 1
leftcastlenight
icon_state="leftcastlenight"
density = 1
rightcastle
icon_state="rightcastle"
density = 1
rightcastlenight
icon_state="rightcastlenight"
density = 1
stairsleft
icon_state="stairsleft"
density = 1
stairsleftnight
icon_state="stairsleftnight"
density = 1
stairscenter
icon_state="stairscenter"
density = 1
stairscenternight
icon_state="stairscenternight"
density = 1
stairsright
icon_state="stairsright"
density = 1
stairsrightnight
icon_state="stairsrightnight"
density = 1
leftcastlecornerdirt
icon_state="leftcastlecornerdirt"
density = 1
leftcastledirtnight
icon_state="leftcastledirtnight"
density = 1
rightcastlecornerdirt
icon_state="rightcastlecornerdirt"
density = 1
rightcastledirtnight
icon_state="rightcastledirtnight"
density = 1



how do i make a verb that changes the regular turfs to night ones
In response to Xx Dark Wizard xX
for(var/turf/T in world)
T.icon+='nightoverlay.dmi'


Download the dither demo and do the opposite. :o.
In response to Mysame
no, i have turfs from dragon warrior 4 which i ripped at night time. I dont need dither, i just need a verb that will replace all my turf/whatever with turf/whatevernight. for every turf.
In response to Xx Dark Wizard xX
examle