ID:1957003
 
(See the best response by Lummox JR.)
In my game, I'm going to have plots of land for players to claim as their own for customization. I'm stuck as to how to approach this. I'm thinking an area proc would be the best way to handle this.

The ideal behavior would be as follows:
1. Player enters the plot of land which has the area proc laid upon it.
2. Plot is checked to see if it is already owned by another player and also if the current player already owns a plot of land. If both cases are a negative, dialog pops up asking the player if they want to claim the land.
3. Assuming player claims land, player's c.key is tied to that specific plot.
4. Upon entering the plot they own, the sandbox building tools appear in the commands tab, and disappear when they walk off the plot or teleport away from the plot.

This is pretty much the last big thing I need to wrap up my little project (besides getting off my butt and fleshing out more of the basic maps and putting down more plots.)


Best response
Your basic setup sounds pretty well thought-out, so I think it's just a matter of fleshing out the individual concepts and UI, and of course saving the info about the claimed areas and what's built on each.

For claiming land, I would recommend not popping up a dialog, but rather making an icon appear onscreen or a command in your commands tab for claiming the land. It would probably be nice also to add an /image to the area, and show it to the prospective buyer(s), that highlights it. (Be sure you handle the case where two buyers may be on the land at once; once it's purchased, the option to buy it should go away.)
In response to Lummox JR
Lummox JR wrote:
Your basic setup sounds pretty well thought-out, so I think it's just a matter of fleshing out the individual concepts and UI, and of course saving the info about the claimed areas and what's built on each.

For claiming land, I would recommend not popping up a dialog, but rather making an icon appear onscreen or a command in your commands tab for claiming the land. It would probably be nice also to add an /image to the area, and show it to the prospective buyer(s), that highlights it. (Be sure you handle the case where two buyers may be on the land at once; once it's purchased, the option to buy it should go away.)

I kinda have a demarcation for available land plots so that it is known that they are there (gravel lots surrounded by grass.) As far as saving info about the claimed areas goes - part of that got taken care of with your own object save/load code example (though I had to modify it to handle players as well upon invocation as the primary function for save/load is for when the world needs to shutdown/upgrade/reboot RIGHT THEN) so thanks for getting half the problem already solved!

Still not sure how to code this out. Been tossing it about in my head for a couple of hours and still unable to make any progress.