- DAXON'S PAGE
- PERSO'S PAGE
- SGI'S PAGE
- SLADER'S PAGE
- VASJA'S PAGE
- TPTPT'S PAGE
- 01 - Get the good size
- 02 - Prepare the structure
- 03 - Textures
- 04 - Build the Skeleton
- 05 - Create new members
- 06 - Used Chiliskiner for rebuild skeleton
- 07 - Link skeleton
- 08 - Orientation of menbers
- 09 - Create Anchor
- 10 - Orientation of Anchor
- 11 - Link Anchor
- 12 - Finalise the character
- 13 - Add Edge for natural weapon
- PROSPERO'S PAGE
- 01 - Starting
- 02 - Stopping 'Ice Skating'
- 03 - A bit of boring theory
- 04 - Adding objects
- 05 - Weapons
- 06 - Enemies
- 07 - Controling enemies
- 08 - Trigger Sectors
- 09 - Cutscenes and camera stuff
- 10 - Sounds
- 11 - Doors
- 12 - De-bugging
- 13 - Sun, Water, Footsteps
- 14 - Gates
- 15 - Death of Enemies
- 16 - Classes
- 17 - Traps
- 18 - Torches
- 19 - New Races
- 20 - A Painless Way to Install New Objects
- 01 - BOD and 3DSMAX 2.5
- 02 - BOD and 3DSMAX 2.5
-
NEW CHARACTER TUTORIAL
-
BOD PYTHON SCRIPTING
BOD Python Scripting
03 - A bit of boring theory
This is a variable:
aso is this:
iamavariableA variable can be (almost) any combination of Letters,Numbers or under_scores, up to 256 characters long. The only exception is that they must not be Python Keywords such as:
and / assert / break / class / continue / def / del / elif / else / except / exec / finally / for / from / global / if / import / in / is / lambda / not / or / pass / print / raise / return / try / whileVariables 'store' values about things. Assign a value by:
var1 = 1 var2 = 2The values can be changed during the course of a program. Which is why they are called variables. They can store all the info about certain things in the game. e.g. When the Player is created, all the infos (or 'attributes') about he/she is usually assigned to the variable.
char as in char= Bladex.Create Entity("Player1",..........etc)This calls a function in the Blade engine which creates the Player and returns all the default values to the variable char.
the attributes can be reset by:
char.Life = 2000 char.Level = 10and can be acessed and assigned to other variables by:
charlevel = char.Level charlife = char.Life charpos = char.PositionWhen objects are created they are usually assigned the much used variable o. As in
o=Bladex.CreateEntity("Rock1",........etc)Once the object is created the o variable is used by the next object to be created. Only the last o used will retain the values of the last object to be created. In practice you very rarely need to access an objects attributes during the course of a map, so it is safe to reuse the o.
If you do need to do this, any object/enemy can be re-assigned to a variable by:
rock1=Bladex.GetEntity("Rock1")and altered:
rock1.Scale=2.0It is nice to make the var names descriptive (orc1, box34, boss1, etc) as it makes code easier to follow.
Functions.
Functions drive the whole gamplay flow. They all must be put in the special file DefFuncs.py, but can be called from everywhere. This is a function:
def Function1(): *block of code here*The code within the function is not executed when the file DefFuncs.py is loaded. You have to invoke or 'call' the function to execute it. This is done by a number of events in the game: operating a lever, trigger sector, death of enemy, etc
Function1()When the function is called, the code within it is executed. Functions are reuseable and can be called as many times as you like.
Values can be passed to a function. e.g.
def HowHealthyAmI(entity): pers=Bladex.GetEntity(entity) lifeleft=pers.Life return lifeleftThis function caller 'asks' the function the current life points of the charcter specified (Player1 in this case).
health=HowHealthyAmI("Player1")The 'answer' is returned to the caller and assigned to the var health. Get the picture?
Clever bit is, it also works for any character:
orc1health=HowHealthyAmI("Orc1") orc2health=HowHealthyAmI("Orc2")If you try this on something that doesn't have the attribute 'Life', you will get an error.
Functions can pass any number of values (or 'arguments' as they are more correctly known. If a number of arguments are listed in the function, it will expect that many from the caller. You can use default arguments:
def WhatLevelAmI(entity="Player1"): pers=Bladex.GetEntity(entity) perslvl=pers.Level return perslvlCalling this function without arguments returns the Player1 current Level to var charlvl.
charlvl=WhatLevelAmI()However if you do this:
enlvl=WhatLevelAmI("Zombie1")it will return the Level of Zombie1. See what I mean?
* One small but important point here. Python counts from 0, not 1.
The level returned by the above function will be one less than the actual level of the character. If you need to know the actual Level put:
enlvl=WhatLevelAmI("Zombie1")+1If you assign
char.Level=2they will actually be at Level 3 in the game
This rule does not always apply, but is worth bearing in mind.
Ok, that's enough boring stuff. I don't intend to go into all the Python theory. This was just to clarify how things work on a basic level.
More practical stuff next.......