It is currently Wed Nov 19, 2008 3:51 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Need suggestions about scripting housing "plots"
PostPosted: Tue Mar 07, 2006 11:15 am 
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:
..........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


Top
  
 
 Post subject:
PostPosted: Fri Mar 17, 2006 8:14 am 
Offline

Joined: Sun Mar 05, 2006 7:25 am
Posts: 118
Location: Italy
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl