SEVERANCE, BLADE OF DARKNESS

Prospero's pages

Updated July 21, 2005

HOME PAGEAUTHORS > PROSPERO > BOD PYTHON SCRIPTING (06)

 

Tut6. Enemies

Enemies are created in exactly the same way as objects, but they all have the entity class
"Person". They will always stay on the ground and will always remain upright (until you kill them). They don't have an Orientation attribute, instead they have an 'Angle'. An Angle of 0 will make them face North in the map, going counter-clockwise to 6,285308.

You should not alter their
Scale. I think you can make them smaller, but you cannot make them bigger.

I usually have them in a seperate
*.py file, enemies.py. Exec this file in cfg.py as with objs.py. Don't name your file 'Enemies.py' or 'enemies.py'. As with 'Objects', there is a BOD source file with this name.

I like to give each enemy their own variable, usually a lowercase version of the individual name:

ork1=Bladex.CreateEntity("Ork1",Ork,x, z, y,"Person")

When you have lots of baddies running about you will appreciate the value of this.

To enable the AI, enemies need a lot of data. Assign this with:

EnemyTypes.EnemyDefaultFuncs(ork1) # import EnemyTypes

Enemies need weapons. Apart from the ones that naturally fight with no weapons, (Golems, Demons, etc), they have no collision edges in the mesh for unarmed combat and no data to handle it anyway. If you don't arm them they will just run about in confusion. Also DO NOT try giving them Two-Handed stuff. It will crash the game when they try to move.

Create their weapons/shields in the usual manner Coords, don't matter here, just use
0,0,0,. Don't forget the ItemDefaultFuncs code on shields and bows/quivers. To make nice neat code I name the weapons of an enemy the same as the enemy but with WP on the end for weapons, SH for shields.

0nce you have their kit created you need to get them to take it. There is a handy function in file
Actions.py that handles this:

Actions.TakeObject("Ork1","Ork1WP")
Actions.TakeObject("Ork1","Ork1SH") # import Actions


Now they are all set to rock'n'roll.

If you want to use Player characters as enemies you need to create a data class and combat charts for them. I won't go into that at the mo.

One complication is
"DalGurak". He has two phases. He will start in phase1 where he will teleport about and throw stuff at you. This phase needs scripting to assign him teleportation coords. The answer is to start him in his melee phase:

dal1.Data.Phase=2

Same applies to the
"DarkLord". He needs loads of scripting with his existing data, coords for teleporting, meteorites, etc. His whole class data needs rewriting in order to use him simply. I won't dwell a that for now.

The '
Kind' names for enemies are:

Ork
Great_Ork
Knight_Traitor
Dark_Knight
Knight_Zombie
Lich # Mummy type guys
Cos # Little pink critters
Spidersmall
Skeleton
Little_Demon
Vamp
Minotaur
Troll_Dark
Troll_snow
Ragnar
Salamander
ChaosKnight
DalGurak
Golem_stone
Golem_clay
Golem_lava
Golem_metal
Great_Demon
DarkLord