How To Specify the Player Spawn Location

From Multiverse

Jump to: navigation, search

First, look at Sampleworld to see how it works. See multiverse/config/common/character_factory.py and multiverse/config/sampleworld/character_factory.py. First the server tries to load the world-specific character information (the one in sampelworld in this case), and then the script in /config/common.

The pertinent function is SampleFactory (comments removed for clarity):

class SampleFactory (CharacterFactory):
   def createCharacter(self, worldName, uid, properties):
      ...
       # get default instance oid
       instanceOid = InstanceClient.getInstanceOid("default")
       if not instanceOid:
           Log.error("SampleFactory: no 'default' instance")
           properties.put("errorMessage", "No default instance")
           return 0

       # set the spawn location
       spawnMarker = InstanceClient.getMarker(instanceOid, "spawn")
       spawnMarker.getPoint().setY(0)

IMPORTANT: If you have previously logged in to the world, then you must create a new character by specifying a new character. If you don't do this, then the avatar will continue to spawn where it did previously.

Personal tools