Here is what I have so far.
area/Apartment/var/Price
area/Apartment/var/Owner
mob/var/Ownership
area
Apartment
Home
Apartment1
Price = 100
Apartment2
Price = 150
Apartment3
Price = 300
mob/SuperTenant
icon = 'SuperTenant.dmi'
mob/SuperTenant/verb
Rent()
set src in oview(1)
var/area/Apartment/A=input("Which Apartment would you like to Rent?","Apartment") as null|anything in Apartments
usr << "This Apartment costs [A.Price]."
switch(alert("Are you sure you want to rent it?",,"Yes","No"))
if ("Yes")
usr.Money -= A.Price
A.Owner = usr
usr << "You pay $[A.Price] to rent the apartment for a week."
if ("No")
usr << "Thanks anyways."
area/Apartment/verb/TestOwn() //When I tested this, it says: You don't own this place. which means, I never actually owned it.
set src in view(1)
if (usr == src.Owner)
usr << "You own this place"
else
usr << "You don't own this place"
area/Apartment/proc
Ownership()
set src in view(1) //When I used the TestOwn() verb with (src.Owner != 1) it always said I do own the place, even if I didn't
if (src.Owner != 1)
usr << "You don't own this place"
else
usr << "Congratulations on buying your new home"
area/Apartment/ARVerbs/verb
Lock_Door()
usr << "You lock the door"
var/list/Apartments = list(new /area/Apartment/Apartment1, new /area/Apartment/Apartment2)
area
Apartment
Apartment1
Apartment2
Apartment3
Problem description: I have the option to pick which apartment I want and pay for it, the area of each apartment has been mapped, and that part of the code works... But I don't actually own the apartment and can't use ownership verbs.
If you want your Apartments list to refer to the areas on the map, you need to populate it with those areas, which only exist after the map is loaded (which happens after global variables, such as Apartments, are initializing).
Example:
Example usage: