ID:2373703
 
Hey Guys, I'm adding a housing system in my game, but I came across a problem, I added Hit Markers to rent and enter apartment which can be used to lock doors, the problem is, when I rent the apartment only the entry marker gets rented and the interior marker stays the same. I would like to rent the apartment and have both markers change to being rented by the owner...

I have a lot of pictures for the problem. And I'll leave my coding for you to look at.

Pictures:

This is a Picture of me Editing the Hit Markers using the Mapping Tool:

https://photos.google.com/photo/ AF1QipNYMA6hNamHlNJp2GWTz4OePCVWpLupbDJGA5gg

This is a Picture of me Hitting the Marker and Renting the Apartment:

https://photos.google.com/photo/ AF1QipMP7ceL4i851s6pmp1i27NYn2dE2g09WokmERmf

This Next Picture is where the real problem is, I rented the apartment but the interior is still trying to rent it out.:

https://photos.google.com/photo/ AF1QipPXb3pG-0VkNyNxAmt7DP-KSIFe7VKJcc7R_c2u

And this is a Picture of me inside showing that the other marker didn't get rented out:

https://photos.google.com/photo/ AF1QipPw25X6kxqKawd-pydz1oQFA_j7liXJqK9FQ2pr

This is my Code:
//HEY EVERYONE... I HAVE BEEN TRYING TO GET A HOUSING SYSTEM WORKING, AND I'M CLOSE HOWEVER I DON'T KNOW HOW TO MATCH TO OF THE HIT MARKERS
//TOGETHER SO THE APARTMENT MARKERS SHOW UP AS BEING RENTED ON BOTH SIDES.
//I HOPE YOU CAN HELP.
//THANK YOU.



//From Housing System

//RESIDENTIAL MARKERS

turf/Markers/ApartmentRent
RedMarkerNorth
name = "Apartment"
icon = 'Markers.dmi'
icon_state = "RedNorth"

RedMarkerSouth
name = "Apartment"
icon = 'Markers.dmi'
icon_state = "RedSouth" //THESE ARE THE MARKERS FOR ENTERING OR RENTING AN APARTMENT

GreenMarkerNorth
name = "Apartment"
icon = 'Markers.dmi'
icon_state = "GreenNorth"

GreenMarkerSouth
name = "Apartment"
icon = 'Markers.dmi'
icon_state = "GreenSouth"



turf
Markers
var
Apartment
Price
WelcomeMessage = "" //VARIABLES ALL OF THE MARKERS FOR HOUSING WILL HAVE
ExLandX
ExLandY
ExLandZ
ELandX
ELandY
ELandZ
ID


obj
var //These next few variables are so you can store the object's 'x','y', and 'z'
saveX = 0
saveY = 0
saveZ = 0
turf
var
saveX = 0 //saves for the doormatt's 'x','y', and 'z'
saveY = 0
saveZ = 0
list
owner = list() //A list with all the people allowed in the house



turf/Markers/ApartmentRent/New() // THIS WAS AN ATTEMPT TO MATCH 2 MARKERS TOGETHER AUTOMATICALLY
IDMatch()
..()

turf
Markers/ApartmentRent
var
Rented = 0

proc
IDMatch(turf/Markers/ApartmentRent/b)
while(1)
if (src.ID == b.ID) //THIS WAS THE CODE TO MATCH 2 MARKERS TOGETHER
b.Rented = src.Rented
b.owner = src.owner
b.WelcomeMessage = src.WelcomeMessage
else usr << "This wasn't linked."
sleep(rand(2,7))


Enter(mob/b) //IF YOU BUMP THE MARKER
if (src.Rented == 0)
switch(alert("Would you like to Rent Apartment #[Apartment] for [Price]?", "Apartment Options", "Yes", "No"))
if ("Yes")
usr << "You've Rented this Apartment #[Apartment] for [Price]"
usr.Money -= Price
src.owner = usr
src.Rented = 1
if( src.icon_state == "GreenNorth") // CHANGES FROM GREEN TO RED TO SHOW ITS BEEN RENTED
src.icon_state = "RedNorth" //It would be helpful to make this be adjusted automatically between North and South.
else src.icon_state = "RedSouth" //
else if ("No")
usr << "Thank You for your Interest, We Hope to see you again soon."

else if (src.Rented == 1 && src.owner == usr)
var/d = (input("Welcome Back, What Would you Like to Do?", "Apartment Options") in list("Enter", "Exit", "Lock/Unlock Door", "Change Welcome Message"))
if (d == "Enter")
usr.loc = locate(ELandX, ELandY, ELandZ)
usr << "Welcome!"
if (d == "Exit")
usr.loc = locate(ExLandX, ExLandY, ExLandZ)
usr << "You Open the Door and Leave your Home."
if (d =="Lock/Unlock Door")
usr << "You Lock/Unlock Door" // Need to add locking system.
if (d == "Change Welcome Message")
var/c = (input("What Would you like your Welcome Message to be?", "Welcome Message"))
src.WelcomeMessage = c

else if (src.Rented == 1 && src.owner != usr)
usr << "This is Apartment Number [Apartment]."
usr << "The Owner of this Apartment is [src.owner]."
alert("[WelcomeMessage]", "Welcome Message")




turf/ApartmentDoor
var
Locked
RoomNumber
Owner


turf
ApartmentDoor
name = "Apartment Door"
icon = 'Door.dmi'
icon_state = "Closed"
density = 1
Locked = 1


turf
ApartmentDoor
verb
Examine()
set src in view()
set category = "Housing"
usr << "This Apartment is Room #[RoomNumber] and is Owned by [src.Owner]"


Problem description: Trying to Link 2 Markers together so if you rent an apartment its rented in the exterior and interior.

Bump
I think what you want to do is centralize your apartment operations. An example of what I mean:

var/global/apartment_managers[] = list()

proc/get_apartment_manager(id)
return global.apartment_managers && global.apartment_managers[id]


// our object used to centralize apartment operations
apartment_manager
var/price = 0
var/tmp/mob/owner

New(id)
apartment_managers[id] = src


turf
apartment_door
var/id
var/tmp/apartment_manager/apartment_manager

New()
..()
apartment_manager = get_apartment_manager(id) || new(id)


In this way, you would use apartment_manager to store important information, and use your apartment-related turfs as action interfaces.
Thanks for helping, but the Apartment Door is more just for a visual of an apartment, its actually:

turf
Markers/ApartmentRent
/*Its actually this turf I want to fix, they are markers
that allow you to enter and exit a room, in the future
it would bring them to a different Z coordinate on the
map.

In order to enter the apartment you have to Bump into
the /turf/Markers/ApartmentRent, however when you buy
it from the outside the Marker on the inside is still available for rent.*/

Is there any way you can compare the last code with this scenerio?
You can apply the same concept to your apartment markers. That's a typo on my part, as I meant to put apartment_rent.