Creating Populator Groups
In this section we'll create a populator group which is an excellent way of filling in large open areas with monsters without having to hand place spawnpoints.
STEP ONE: Getting Started
Currently, populator groups are only used in the online game, so in order to test it in single player we need to set up our files to do so. We'll revert this change later because it adds to the compile time of genesis.py.
1. Load Python editor. Open ~\my.mmorpg\genesis\.........******Lara: get instructions from Josh*******
STEP TWO: Spawns
We're going to create a new race of Wood Elves to populate The City of Jorfu.
1. Load Python editor. Create a new file and save it as: ~\my.mmorpg\genesis\spawn\spawngen.py. Add the following text to the file and save:
*****removed******
This is the spawn generator logic.
2. Next, we need to add spawninfo information. This defines the class, level, name, and texture set for the generated spawns. We are going to assign three classes to the Wood Elves: Warrior, Paladin, and Bard. Add the following text to this file and save:
SPAWNINFO = { #PALADIN "Paladin":( ("Avenger",5,TSET_EQUIP_BRASS), ("Defender",2,TSET_EQUIP_METAL), ("Dragoon",1,TSET_EQUIP_CHAINMAIL), ("Guardian",4,TSET_EQUIP_BRASS), ("Invader",3,TSET_EQUIP_IRON), ), #WARRIOR "Warrior":( ("Guard",4,TSET_EQUIP_GUARD), ("Tactician",3,TSET_EQUIP_GUARD), ("Watchman",2,TSET_EQUIP_IRON), ("Patroller",3,TSET_EQUIP_BRASS), ("Lookout",2,TSET_EQUIP_GUARD), ("Sentry",3,TSET_EQUIP_GUARD), ("Elite",4,TSET_EQUIP_PLATINUM), ("Grunt",1,TSET_EQUIP_CHAINMAIL), ("Warrior",1,TSET_EQUIP_CHAINMAIL), ), #BARD "Bard":( ("Courier",1,TSET_EQUIP_CHAINMAIL), ("Ardent",3,TSET_EQUIP_LEATHERSTUDDED), ("Cartographer",4,TSET_EQUIP_LEATHER), ("Composer",5,TSET_EQUIP_LEATHER), ("Jester",1,TSET_EQUIP_CHAINMAIL), ("Messenger",3,TSET_EQUIP_LEATHER), ("Runner",5,TSET_EQUIP_FUR), ), }
Before you can do this step, you will need to set up Texture Sets. See the Texture Sets? Tutorial on how to do this.
Note: We capped the levels at 5 for this example only, your spread can be significantly larger. Also, these names will be used for all races you create using the populator and are not specific to the Wood Elves.
3. Create a new file and save it as: ~\my.mmorpg\genesis\spawn\populator.py. Add the following text to the top of the file and save:
from genesis.dbdict import DBSpawn,DBLootProto,DBSpawnInfo,DBSpawnGroup from mud.world.defines import * from mud.world.spawn import SpawnSoundProfile from genesis.texturesets import * from spawngen import SpawnGenerator
Now, we need to create a new spawn generator prototype:
class WoodElfGenerator(SpawnGenerator):
Next, add the following:
def __init__(self): self.race = "Human" self.raceName = "Wood Elf" self.habitat = ["jorfu"] self.baseLevel = 20 self.maxLevel = 25 self.sndProfile = None self.models = None self.animations=None self.textureSets = None self.realm = RPG_REALM_LIGHT self.classes = ["Paladin", "Warrior", "Bard"] DGEN = WoodElfGenerator() DGEN.generateSpawns()
Notes:
- self.race - we have assigned 'Human' as that is the only playable race set up. (Unfortunately, this means our Wood Elves will look like Humans for now.)
- self.habitat - this is the zone(s) that these spawns will show up in.
- self.baseLevel and maxLevel have a 5 level spread...due to a max spread of 5 levels in step two.
- sndProfile, models, and animations are all set to None because this is a playable race and these parameters are already assigned.
4. Open ~\my.mmorpg\genesis\spawn\spawnmain.py. Add the following text and save:
import populator
5. Run genesis.py and check for errors. (Spawngroups are automatically generated.) Load your single player game and verify that your spawns are showing up.
Note: Each time you restart the server or reload your single player world, in this case, the spawns will be in different locations.
STEP THREE: Loot
Return to Tutorials

