ID:264308
 
Code:
turf/Resources
Clay_Pit_Lv_0
icon = 'Turfs.dmi'
icon_state = "clay pit"
density = 0
level = 0
resclay = 3
rewood = 25
reclay = 20
reiron = 20
rewheat = 10
verb/Lv_up()
if(usr.wood < src.rewood)
src << "You need more wood."
src << "to build it."
return
if(usr.clay < src.reclay)
src << "You need more clay."
src << "to build it."
return
if(usr.iron < src.reiron)
src << "You need more iron."
src << "to build it."
return
if(usr.wheat < src.rewheat)
src << "You need more wheat."
src << "to build it."
return
else
usr.wood -= src.rewood
usr.clay -= src.reclay
usr.iron -= src.reiron
usr.wheat -= src.rewheat
src = new /turf/Resources/Clay_Pit_Lv_1 ()

Clay_Pit_Lv_1
icon = 'Turfs.dmi'
icon_state = "clay pit"
density = 0
level = 1
resclay = 5
rewood = 35
reclay = 25
reiron = 25
rewheat = 20


Problem description:
runtime error: bad loc
proc name: Lv up (/turf/Resources/Clay_Pit_Lv_0/verb/Lv_up)
source file: Clay_Pit.dm,34
usr: Prf X (/mob)
src: Clay Pit Lv 0 (10,10,2) (/turf/Resources/Clay_Pit_Lv_0)
call stack:
Clay Pit Lv 0 (10,10,2) (/turf/Resources/Clay_Pit_Lv_0): Lv up()


        src = new /turf/Resources/Clay_Pit_Lv_1 ()


You aren't setting it's loc when you create it, so it shoots an error about bad loc.

Also, what you would want to be using is objects for this, since you can't delete and create turfs like you are trying to do at runtime.
AGH! MY EYES! X_X
In response to Andre-g1
Andre-g1 wrote:
You aren't setting it's loc when you create it, so it shoots an error about bad loc.

So how do i set it's loc?

Thank
In response to Prf X
Look up the locate() function in F1/the reference.
In response to Mizukouken Ketsu
Thank
In response to Andre-g1
Andre-g1 wrote:
Also, what you would want to be using is objects for this, since you can't delete and create turfs like you are trying to do at runtime.

Though objects might work better in this situation, it is untrue that turfs cannot be created like this at runtime. It's perfectly valid to instantiate turfs at runtime using the new keyword.
In response to IainPeregrine
But turfs can't be deleted at runtime, can they ?
In response to Andre-g1
Of course they can, they just can't be moved. Deleting a turf will either result in a black square or the default turf being visible if you have one set.