Ok i found this code on having multiple areas but now i am getting errors and i dont know how to use it, here is the code.
region
var/name
var/list/contents // a list of areas belonging to this region
proc/Exit(atom/movable/A)
return 1
proc/Enter(atom/movable/A)
return 1
proc/Exited(atom/movable/A)
proc/Entered(atom/movable/A)
area
Enter(atom/movable/A)
var/region/R
var/list/otherregions
var/list/regions
if(A.loc && A.loc.loc)
otherregions=A.loc.loc.regions
if(regions)
for(R in regions-otherregions)
if(!R.Enter(A)) return 0
if(otherregions)
for(R in otherregions-regions)
if(!R.Exit(A)) return 0
return ..()
Entered(atom/movable/A,atom/oldloc)
var/region/R
var/list/otherregions
if(oldloc && oldloc.loc)
otherregions=oldloc.loc.regions
if(otherregions)
for(R in otherregions-regions)
R.Exited(A)
if(regions)
for(R in regions-otherregions)
R.Entered(A)
region/town // no attacking anything here
Entered(atom/movable/A)
A << "Welcome to [name]!"
Exited(atom/movable/A)
A << "You have left [name]."
Enter(atom/movable/A)
return
region/monsterspawn
var/list/monstertypes
var/spawntime
proc/SpawnMonsters()
... // do the work of creating monsters (if necessary) here
spawn(spawntime) SpawnMonsters()
region/forest
var/list/healed
Entered(atom/movable/A)
if(istype(A,/mob/aggresive/Player))
var/mob/aggresive/Player/M=A
if(healed && healed[M]>world.time) return
if(M.HP>=M.MAXHP) return
if(!healed) healed=list()
healed[M]=world.time+6000 // wait 10 minutes
M.HP=round((M.HP+M.MAXHP)/2,1)
M << "You feel soothed by the forest."
spawn(6000)
healed-=M
if(!healed.len) healed=null // delete the list
region/tavern
Entered(atom/movable/A)
Exited(atom/movable/A)
ID:148843
Sep 9 2002, 2:18 am
|
|
In response to Lummox JR
|
|
Ok i am getting some undefined errors
loading Classic Adventures.dme loading stuff.dms Regions.dm:34:error:regions:undefined var Regions.dm:36:error:regions:undefined var Regions.dm:37:error:regions:undefined var Regions.dm:19:error:A.loc.loc.regions:undefined var Regions.dm:32:error:oldloc.loc.regions:undefined var the regions var can be fixed by var/list/regions i dont know if that is right but the other ones i cant figure out. |
In response to Mrhat99au
|
|
Mrhat99au wrote:
Ok i am getting some undefined errors It looks like these all stem from the same problem, and it's in my original code. Change this: area ...to this: area That area.regions list will have to be initialized if you assign the area a region. You might want to add a few procs to help you set up the regions, which will also take care of list initialization for you: area Lummox JR |
What errors are you getting?
When I wrote up that code it was untested; I did it basically as an example for how datums can be used to simulate area overlaps. It's gonna take a little work to get it to run, but I think ultimately would be useful enough to warrant the effort.
I wouldn't be surprised if there are some syntax errors and whatnot, though. Pobody's nerfect.
Lummox JR