Need suggestions about scripting housing "plots"

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
tao4mike

Need suggestions about scripting housing "plots"

Post by tao4mike »

hi all...sorry to intrude...I need advice on the best way to do something. We are trying to write our own scripts for a custom shard and, I am currently considering options for housing. I would like to create config files or datafiles or whatever I find more appropriate to define "plots" for houses so I can predefine their default names, prices, coords, etc. I want the "plots" to be pretty "tight" as in only the spaces that I define and not anything else. I have created an example below:

Code: Select all

..........oooooooo.....
..........oooooooo.....
..........ooo..........
..........ooo..........
..........ooo..........
..........ooooooooooooo
..........ooooooooooooo
..........ooooooooooooo
..........ooooooooooooo
..........ooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
ooooooooooooooooooooooo
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
oooooooooooooo.........
where there are "o" I want the owner to be able to execute "commands," where there are "." I do NOT want the owner to have the ability to execute any commands. I am new to all this and am not great with logic or anything so...I appreciate any suggestions. The only two solutions I have come up with are, create multiple "rectangles" encompasing the "o" areas, OR create one rectangle encompasing the whole area and smaller areas encompasing the "." areas that I would explicitly check to NOT allow commands. Any suggestions on which may work best or totally different solutions? Again I may be overlooking the best and most obvious solution :) A little explination of any suggestions is also greatly appreciated like how to define the coords best...like multiple...erm.."elements" defining each or a single "element" with many values defining all etc. Thanks for the help in advance!



Mike
Lagoon
Grandmaster Poster
Posts: 118
Joined: Sun Mar 05, 2006 7:25 am

Post by Lagoon »

I use a similar system for housing. Defining the building rectangles is good, defining the single tiles is bad, in 99% cases defining the rectagles you'll save on cycles or memory to check if character is in the house. Defining building rectangles or not-building rectangles is essentially the same, I'd go for building rectangles. You should have a global property (or text file or config file, but I prefere to work with global properties for this kind of stuff) which contains an array (or dictionary if needed) of buildings definitions, each made of a struct with an elements containing the array of rectangles. You may have rectangles overlapping, no problem with that. Consider using a series of boxes instead of rectangles, this will give you the power to have a two story villa with two different owners, one for each floor. That's what I did.
About commands... you should simply add at the beginning of each command related to house management a function which checks if the character is inside the building he owns. Keep in mind it's not sufficient that the character is inside, you should also check that what he's modifying is and remains inside the building.
Post Reply