Updated July 21, 2005
HOME PAGE > AUTHORS > PROSPERO > BOD PYTHON SCRIPTING (01)
I thought I would start this topic to answer
scripting questions and do mini tutorials on various Python stuff for the
benefit of mappers.
(This is just how I do things, and I don't know
everything by any means.
)
---------------------------------------------------------------------
Tut1.
Starting...
OK,
you have made a map, compiled and loaded it and your Player char is stood alone
wondering how to fill this new world with interesting stuff.
All the
gameplay flow is controlled from a file:
DefFuncs.py
Create a file
with this exact name and save it to your map folder in
BODLOader/Maps.
This file is one of the Key files that is executed again
when loading a saved game. For that reason it must always have this name. All
your other .py files that create objs, etc are only executed on first
load.
In a basic map you will have three essential
files:
cfg.py # initiates the map and loads all the files
pj.py #
creates the Player character
MyMap.lvl # loads all the texture files + dome
(sky) and .bw (compiled 'Blade World' file)
*I will use the term MyMap to
refer to the name of your map folder.(case sensitive)
The BODLoader will
create these files automatically if they don't exist in the BODLoader/Maps/MyMap
folder. NEVER edit your files in the main Maps folder. ALWAYS edit in the
BODLoader and unistall/install your map to test it. If you don't stick to this
practice you risk hours of work being overwritten by older files.
(Yes, I
have done this more than a few times.
)
Next, open the
cfg.py file and add this line at the
end:
execfile("DefFuncs.py")
All the files you create will be
executed from here, but keep DefFuncs.py
at the top of the list.
Now open
DefFuncs.py
There is nothing to add yet, but for a start you can add the
code to enable the savegame.
First add this:
import GameText
darfuncs.HideBadGuy("Ork1")
without importing the file darfuncs.py, you will cause an error. Python reads code from the top of a file
down, so put you imports before you use their code. (usually they are all at the top of the file.)
Underneath this import
add:
GameText.MapList["MYMAP"] = ["MyMap"]
First box is a
CAPITALIZED version of your map name.