In response to Exadv1 (#19)
Hey, whoah, just had a brain fart on this one.

Instead of basing the code for buying / selling / whatever on the -map-, why not make an NPC standing outside the buyable turf, that will tell you if the areas been boughten, and if not how much it is. The NPC could then let the person who bought it into the turf, as well as anyone that the owner wanted to let in.

Just a thought ^_^ Another way to go about it perphaps. Then you could drop a bunch of vars, as well as make it so the code wouldnt have to go through -all- the vars -every- time someoen goes go buy a plot, itd just go through the ones for that plot when requested, and no others.


Elorien
In response to Elorien (#20)
That wouldn't exactly work because I have like 20+ plots. That is expanding and will expand.
In response to Exadv1 (#19)
Exadv1 wrote:
Question on Keys.
Lummox JR using the key code you gave me how would I make a copy of the key?

With my code, you could do something like this:
obj/key
...

verb/Copy()
var/mob/M=usr
if(keyname!="[M.client.ckey]:[M.name]")
usr << "You can't make a copy of [src]."
return
new /obj/key(loc,purpose,keyname)

This should place a copy of the key in the owner's inventory. To keep people who own copies from making copies themselves, I put in the above snippet of code that checks to see if usr is the person who owns the key.

The code is a little simplistic, since you'd probably only want copies made at a locksmith's shop, but you get the basic idea.

Lummox JR
I haven't read through all of the posts (yet) but here's how I have done it in the past with a little improvision...

You go to the land that you know is for sale, you use a verb which then references the land with an object (preliminary deed) which can be traded to someone else or whatever. There can be fifty of these pieces of paper floating about, doesn't really matter. The land is just referenced by location (X,Y,Z) or area, however you're doing it.

You take the paper to the deed office, tell the deed officer you want to buy the deed for this land. The deed officer checks to see if the land has been purchased since the paper was created.

Once the deed officer checks to ensure that the land is not owned, the land is sold to the player (variable on the turf or area referencing the player). The player is now the proud owner of the piece of land.

The player goes back to the area or turf that he just purchased. The turf itself (by type) determines what can be built on it. A mountainous area for example might give the player the option to build a mine if the correct materials are nearby while grasslands might allow the player to start farming. Any sort of structure requires that nessisary materials be dedicated to the land. I tracked these by more variables (cords of wood, lbs of iron, etc) once the player brought the material to the site and dedicated the materials through verbs (the materials were just deleted and added to the variable counters).

I used this same concept for housing - once the materials were dedicated, the player could then say "X number of workers that I have hired will now build a stone wall on this turf". The turf itself contains the verb and only allows the verb to be available if the player owns it and the materials are available (X lbs of stone and at least one worker). The number of workers dedicated the project determines how many hours before the project is completed.
In response to Gabriel (#23)
I handled the transfer of deeds by going back to the deed officer (both players had to be available although you could code around this) and transfering deed ownership. Fairly simply...
In response to Exadv1 (#21)
Itd still be easier then having a thousand and one vars per plot, that -all- have to be acessed or messed with to get what you want done O.o;

*shrug* Oh well ^_^ Its your project. ^_^

Elorien
In response to Lummox JR (#22)
How would I add the area plot to the deed like I mentioned earlier.
how would I check variables made in the area. I think I mentioned these earlier but I am not sure.
In response to Exadv1 (#26)
Exadv1 wrote:
How would I add the area plot to the deed like I mentioned earlier.

Try something like this:
obj/item/landdeed
name="land deed"
var/keyname // indicates the owner
var/list/history // keeps track of previous owners
var/area/plot

New(newloc,area/A,mob/M)
..()
plot=A
history=list()
Transfer(M)

proc/Transfer(mob/M)
if(M.client) keyname="[M.client.ckey]:[M.name]"
else keyname=":[M.name]"
history["[world.realtime]"]=keyname
// tell the area it's been sold, so it can adjust housekeys and such
if(hascall(A,"Transfer")) A:Transfer(M)

You can add other code to show when this deed was created, who it originally belonged to, and who it was transferred to and when.

how would I check variables made in the area. I think I mentioned these earlier but I am not sure.

Not sure what you mean here.

Lummox JR
In response to Lummox JR (#27)
Every area has variables like price and size so how can I get it so the seller mob can access the variables in the area.
In response to Exadv1 (#28)
Exadv1 wrote:
Every area has variables like price and size so how can I get it so the seller mob can access the variables in the area.

Oh, that shouldn't be too hard. Try something along these lines:
mob
// you should check buyer.gold before an offer is made,
// but be sure to check a second time in case he does
// other buying before the seller says yes
proc/BuyOffer(mob/buyer,area/plot)
if(!client)
... // handle AI yourself
return
var/obj/landdeed/deed
for(deed in src) if(deed.plot==plot) break
if(!deed)
buyer << "[src] isn't carrying the deed."
src << "[buyer] wants to buy a plot of land (#[plot.n]) from you, but you need the deed if you want to sell it."
return
var/ans=alert(src,"[buyer] has made an offer to buy a plot of land from you. (Plot #[plot.n], [plot.width*plot.height] square yard\s, worth $[plot.price].) Would you like to sell it?","Buy offer from [buyer]","Yes","It's not for sale")
if(ans!="Yes")
buyer << "Sorry, but [src] won't sell that plot."
return
if(buyer.gold<plot.price)
src << "Nevermind. Turns out [buyer] doesn't have enough money."
buyer << "You can't afford to pay $[plot.price] for the land."
return
buyer.gold-=plot.price
gold+=plot.price
deed.Transfer(buyer)
src << "You've just sold plot #[plot.n] to [buyer] for $[plot.price]."
buyer << "You've just bought plot #[plot.n] from [buyer] for $[plot.price]."

Now, I should warn you that that interface is deeply flawed; the seller might take a long time to answer, or an annoying buyer might make an offer over and over just to keep sticking the seller with input boxes. A better way would be to add something to the stat panel to check on pending buy offers, and use the mini-browser to review, modify (like to haggle over price), and finalize the transaction. Still, the code to do that would be a little long to post here, and having done nothing of the sort yet myself I couldn't really offer the example anyway.

Lummox JR
In response to Lummox JR (#29)
Oy, Lummox, you sure like to write everything on one line. =)

Have you tried using the '\' after a sentence to carry the current line over to the next? It makes code much more readable, in my opinion.
In response to Lummox JR (#29)
But how would I buy th ploe outright if the names of the plot area's are
plot1
plot2
plot3
plot4
plot5
...
Here isd the faulty code. If you need more code tell me. Excuse the indentation the HTML messed it up.
<DM>
mob/landdeedseller
icon = 'deedseller.dmi'
speed = 10
warea = /area/doffice
var
plotbuy
wantbuy
proc
buyland(plotnumbuying)
usr << "You bought plot number [plotnumbuying]. Happy Building"
var/obj/deed/POH/D = new(usr)
D.plotnumber = plotnumbuying
verb
Purchase_land()
set src in oview(1)
plotbuy = input("What plot number would you like to buy","Buying POH land")
for(var/obj/deed/POH/D in world)
if (D.plotnumber == src.plotbuy)
usr << "Sorry someone else already owns that piece of land"
return 0
usr << "Lucky you that plot of land has not been purchased yet"
sleep(10)
wantbuy = input("Would you like to buy plot number [plotbuy]","Buying POH land")in list("Yes","No")
if (wantbuy == "No")
return 0
else
for(var/obj/gold/G in usr.contents)
if(istype(G,/obj/gold/fifth))
for(var/area/POH/A in world)
if (A.num == plotbuy)
if (G.amount >= A.price)
G.amount -= A.price
buyland(plotbuy)
return
else
usr << "You don\'t have enough cash."
return
else usr << "You must have the gem currency type"


obj/door/POH // Begin POH door code
var/keyname
density = 1
icon = 'door.dmi'
proc/openme()
usr << "Unlocking"
density = 0
proc/closeme()
usr << "Locking"
density = 1
proc/SetOwner(mob/M)
if(M.client) M.keyname="[M.client.ckey]:[M.name]"
// no idea why client would be null, but just in case...
else M.keyname=":[M.name]"

proc/CreateKey(atom/newloc)
new /obj/key/POH(newloc,src,keyname)

verb/UnLock()
set src in oview(1)
var/mob/M=usr
for(var/obj/key/POH/key in M)
if(key.purpose==src && key.keyname==keyname)
openme()
src.verbs += /obj/door/POH/verb/Lock
src.verbs -= /obj/door/POH/verb/UnLock
return 1
usr << "You don't have a key for this door."
return 0
verb/Lock()
set src in oview(1)
var/mob/M=usr
for(var/obj/key/POH/key in M)
if(key.purpose==src && key.keyname==keyname)
closeme()
src.verbs -= /obj/door/POH/verb/Lock
src.verbs += /obj/door/POH/verb/UnLock
return 1
usr << "You don't have a key for this door."
return 0

obj/key/POH
var/keyname
var/authusername
var/purpose
icon = 'key.dmi'
icon_state = "POH"
verb
Drop()
src.Move(usr.loc)
New(atom/newloc,_purpose,_keyname)
..()
if(_purpose)
name = "key to [_purpose]"
purpose = _purpose
keyname = _keyname
obj/deed/POH
var/plotnumber
var/price
icon = 'deed.dmi'
insurance = 200
verb
Examine()
set src in usr.contents
usr << "This is the deed to plot number [plotnumber]"
proc
Plotnumbercreate(plotbought,priceboughtat)
src.plotnumber = plotbought
src.price = priceboughtat
In response to Exadv1 (#32)
It seems to work but you never end up recieving the deed.
In response to Exadv1 (#33)
Here is another problem, these lines
verb//POH verbs
Build_Door()
set category = "POH"
for(var/obj/deed/POH/D in usr.contents)
for(var/area/POH/A in world)
if(A.num == D.plotnumber && A.loc == dd_area())
break
var/obj/door/POH/N = new(src.loc)
N.SetOwner(usr)
N.CreateKey(usr)
continue
return 1
else usr << "You cannot build here"
return

Nevermind the error was an indentation one.
In response to Exadv1 (#34)
Ignore the search for money types I have decided to stick with a currency for now.....
Page: 1 2