Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Logged In: YES
File Added: buildteleport.py
File Added: buildsale.py
Logged In: NO
Please explain/detail what those scripts do, how they work, and such. At least the basic idea.
I've worked on them more. Here's a tarball.
build.py builds the building (you'll need to edit the paths at the top of the file for your server, I tried wresting the top level path from cf but it didn't give me the exact folder)
buildteleport.py teleports you into the building when you apply the (unique 1) building without activating the unique 1 teleport code)
buildsale.py sells the building scrolls
If your in navar it takes the money from your navar bank account (cf-extended thing)
if in anywhere else it's from your imperial bank account.
You will need some arches from cf-ext, look over the build.py script for more info.
I did it :)
I wanted this for 2 years, no one would make it. So I finally did it :)
Thanks Red for showing me some python stuff, also thanks to Ryo and others for python help.
File Added: buildablebuildings.tar.gz
Now I've added player-built shops (not in tarball yet, on cfextended cvs though).
Has anyone tried these scripts? Do you like them? Want to help make more templates?
I'm thinking of making (for each of the allready included regions that I've made diff templates for): small castle/fort, large (4x4) castle.
Now the large castle I'll have to find another way of inserting things onto the map, as you can't drop a multi tile arch, or even get it in your inventory).
What do people think about this (relevant to the scripts/goal, not "oh well I'm not interested, who cares / crossfire doesn't need this" comments).
It works like this:
You go to an Imperial Archtecutal Services building
inside you ask the clerk (which is a monster with the /python/misc/buildsale.py script hooked in via event_say).
the buildsale.py script (based off the banksay script) shows you options and the prices
of what to buy (buy a house scroll, temple scroll etc)
You then say which one you want to buy it deducts the amount from your bank account and gives you a scroll which has an event_apply object that has, say, "house" as it's name (python script options) which calls the /python/misc/build.py script.
You go to a spot you want to build (you have to clear it of debris (weather effects etc))
(and it won't build on no_spell, exits, teleporters, or paths (flagstone etc)) and apply the scroll. The scroll calls the script and then it builds the house (unique1) putting an event_apply object inside that has the target map as it's script options. It also copies the house template from /maps/templates/buildable/house_scorn /world_build/world/world_X_Y_x_y_username and gives you 5 keys for the door on the inside (who's slaying field is /mappath/world_X_Y_x_y_username).
You have to edit the first 2 lines or so in build.py for your server dirs.
How do you handle map resets?
In the build script there isn't anything saving the built houses position, as far as i can see.
Read closer :). The house exits are unique 1. Entering the house is handled by a script on apply rather then the normal exit code (as no exit is set). Works like a charm :).
(Note: dl from cf-extended cvs for latest template maps and code).
Ryo had the apply script idea. Thanks Ryo :).
Hum, but what about the map where the built house is dropped? This map isn't necessarily unique, so the building will disappear at next reset :)
Wrong. The building IS unique. Don't make assumptions :).
This thing works, check it out on the cat2 server if you doubt (you'll need alot of money on there though :) ) I have a player built temple just outside of scorn if you want to see.
I don't make broke things :P
The script writes in the maps directory, which can lead to issues for certain hardened configurations.
The script should write in a subdirectory of var / datafiles instead. Also it shouldn't use hardcoded paths.
Sorry, CFPython doesn't support non-hard coded paths, I tried. The things that were supposidly the non-hardcoded things for the map dir etc did not give the full pathname of the directory just "maps".
Secondly... well you can rewrite it if you wish (you won't because you don't care about having buildable buildings in CF) and make it work the way you want. I'm doing other things right now (made a music album for one).
But... you have rejected all my patches so I am no longer going to submit them to crossfire.
The script does need work, but it shows it can be done.
Now, CFpython does not return the full path name of the map, var, bin, etc paths used for crossfire. We need a funtion that does so this can be made non-hard coded. Currently it only have functions to give the folder name, not the path (IE: if you ask for the maps dir it will tell you "maps").
Yes, it can be done, and it needs some tweaking for reasons stated below :)
For the path, you need to os.join Crossfire.LocalDirectory() with for instance 'builded_maps' or something like that, and create the path if it doesn't exist.
The various directories are for some related to this LocalDirectory.