Would you like to react to this message? Create an account in a few clicks or log in to continue.

Official Community Forums
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  The Wiki  Website  github Project  

 

 Character Creation Options

Go down 
3 posters
Go to page : Previous  1, 2
AuthorMessage
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 EmptyTue 28 Feb - 6:32

# Add clothing meshes for the client - on the server this should be done with
# the inventory system, but that is not available here.
Code:

meshInfo["human_male_fantasy.mesh"].extend([[ "cloth_a_bootsShape-lib.0", "human_male.cloth_a_material" ],
                                    [ "cloth_a_shirtShape-lib.0", "human_male.cloth_a_material" ],
                                    [ "cloth_a_pantsShape-lib.0", "human_male.cloth_a_material" ]])
meshInfo["human_female_fantasy.mesh"].extend([[ "leather_a_beltShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ]])

This is using the wrong format
if you wanted to use it you would have to do something like
Code:

meshInfo["male_1"].extend([["human_female_fantasy.mesh"],[[ "leather_a_beltShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ]])


But I dont think you need it at all since you are making individual body types
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 EmptyTue 28 Feb - 6:58

delurin wrote:
# Add clothing meshes for the client - on the server this should be done with
# the inventory system, but that is not available here.
Code:

meshInfo["human_male_fantasy.mesh"].extend([[ "cloth_a_bootsShape-lib.0", "human_male.cloth_a_material" ],
                                    [ "cloth_a_shirtShape-lib.0", "human_male.cloth_a_material" ],
                                    [ "cloth_a_pantsShape-lib.0", "human_male.cloth_a_material" ]])
meshInfo["human_female_fantasy.mesh"].extend([[ "leather_a_beltShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ]])

This is using the wrong format
if you wanted to use it you would have to do something like
Code:

meshInfo["male_1"].extend([["human_female_fantasy.mesh"],[[ "leather_a_beltShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ]])


But I dont think you need it at all since you are making individual body types

Why would I not need to specify what they're wearing? Surely, if I don't specify anything here, they'll just be wearing nothing?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 EmptyTue 28 Feb - 7:06

In a previous version you were defining it as part of the male_2
Code:
"male_2" : [ "human_male_fantasy.mesh" ,
                          [ [ "human_male_body-mesh.0", "human_male_fantasy.human_male_body_02" ],
                            [ "human_male_head_02-mesh.0", "human_male_fantasy.human_male_head_02" ],
                            [ "human_male_02_hair_01-mesh.0", "human_male_fantasy.human_male_head_02_hair_01" ],
                            [ "male_leather_b_chest-mesh.0", "human_male_fantasy.human_male_armor_leather_b" ],
                            [ "male_leather_b_legs-mesh.0", "human_male_fantasy.human_male_armor_leather_b" ]
                            ]
                          ]

I thought you were still doing that my mistake.
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 EmptyTue 28 Feb - 17:26

Ok, so I made the changes you suggested, by changing around the format.

Problem is, I'm still getting a Script Error at startup.

character_factory.py
Code:


from multiverse.mars import *
from multiverse.mars.objects import *
from multiverse.mars.core import *
from multiverse.mars.events import *
from multiverse.mars.util import *
from multiverse.mars.plugins import *
from multiverse.server.plugins import *
from multiverse.server.math import *
from multiverse.server.events import *
from multiverse.server.objects import *
from multiverse.server.engine import *
from java.lang import *
from java.util import LinkedList

meshInfo = { "female_1" : [ "human_female_fantasy.mesh" ,
                            [ [ "human_female_body-mesh.0", "human_female_fantasy.body_01_clothed_mat" ],
                              [ "human_female_head_01-mesh.0", "human_female_fantasy.head_01_mat" ],
                              [ "human_female_head_01_hair-mesh.0", "human_female_fantasy.head_01_hair_01_mat" ],
                              ]
                            ],
            "female_2" : [ "human_female_fantasy.mesh" ,
                            [ [ "human_female_body-mesh.0", "human_female_fantasy.body_02_clothed_mat" ],
                              [ "human_female_head_02-mesh.0", "human_female_fantasy.head_02_mat" ],
                              [ "human_female_head_02_hair_01-mesh.0", "human_female_fantasy.head_02_hair_01_mat" ],
                              ]
                            ],
            "male_1" : [ "human_male_fantasy.mesh" ,
                          [ [ "human_male_body-mesh.0", "human_male_fantasy.human_male_body_01" ],
                            [ "human_male_head_01-mesh.0", "human_male_fantasy.human_male_head_01" ],
                            [ "male_head_01_hair_01-mesh.0", "human_male_fantasy.human_male_head_01_hair_01" ],
                            ]
                          ],
            "male_2" : [ "human_male_fantasy.mesh" ,
                          [ [ "human_male_body-mesh.0", "human_male_fantasy.human_male_body_02" ],
                            [ "human_male_head_02-mesh.0", "human_male_fantasy.human_male_head_02" ],
                            [ "human_male_02_hair_01-mesh.0", "human_male_fantasy.human_male_head_02_hair_01" ],
                            ]
                          ]
            }
# Add clothing meshes.  These should really be done as inventory items,
# but as a quick fix, we put it in the base display context of the object.
meshInfo["male_1", "male_2"].extend([["human_male_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_male.leather_a_material" ] ]
                                      ]
                                      )

meshInfo["female_1", "female_2"].extend([["human_female_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ] ]
                                      ]
                                      )
# set up the default display context
displayContext = DisplayContext("human_female.mesh", True)
for entry in meshInfo["human_female.mesh"]:
    displayContext.addSubmesh(DisplayContext.Submesh(entry[0], entry[1]))

# default player template
player = Template("DefaultPlayer")

player.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, displayContext)
player.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_OBJECT_TYPE, ObjectTypes.player)
player.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_RUN_THRESHOLD, Float(5000))

player.put(CombatClient.NAMESPACE, "combat.userflag", Boolean(True))
player.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_DEADSTATE, Boolean(False))
player.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_REGEN_EFFECT, "regen effect")
player.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS, "Leather Tunic; Leather Pants; Leather Boots")
player.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", 100))
player.put(CombatClient.NAMESPACE, "health", MarsStat("health", 100))
player.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", 100))
player.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", 100))
player.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_AUTOATTACK_ABILITY, "player attack ability")

ObjectManagerClient.registerTemplate(player)

# character factory
class SampleFactory (CharacterFactory):
    def createCharacter(self, worldName, uid, properties):
        ot = Template()

        name = properties.get("characterName")
        # check to see that the name is valid
        # we may also want to check for uniqueness and reject bad words here
        if not name or name == "":
            properties.put("errorMessage", "Invalid name")
            return 0
       
        modelName = properties.get("model")
        meshName = meshInfo[modelName][0]
        submeshes = meshInfo[modelName][1]
        override = Template()
        if meshName:
            displayContext = DisplayContext(meshName, True)
            for entry in submeshes:
                displayContext.addSubmesh(DisplayContext.Submesh(entry[0],
                                                                entry[1]))
            override.put(WorldManagerClient.NAMESPACE,
                        WorldManagerClient.TEMPL_DISPLAY_CONTEXT, displayContext)
                       

   statProperties = ["strength","dexterity","wisdom","intelligence",
      "class"]
   for statProp in statProperties:
       if (not properties.get(statProp)):
      properties.put("errorMessage", "Missing property "+statProp)
      return 0

        # get combat settings
        strength = int(properties.get("strength"))
        dexterity = int(properties.get("dexterity"))
        wisdom = int(properties.get("wisdom"))
        intelligence = int(properties.get("intelligence"))
        player_class = str(properties.get("class"))

   # 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)

        # override template
        ot.put(WorldManagerClient.NAMESPACE,
              WorldManagerClient.TEMPL_NAME, name)
        ot.put(WorldManagerClient.NAMESPACE,
              WorldManagerClient.TEMPL_INSTANCE, Long(instanceOid))
        ot.put(WorldManagerClient.NAMESPACE,
              WorldManagerClient.TEMPL_LOC, spawnMarker.getPoint())
        ot.put(WorldManagerClient.NAMESPACE,
              WorldManagerClient.TEMPL_ORIENT, spawnMarker.getOrientation())

   restorePoint = InstanceRestorePoint("default", spawnMarker.getPoint())
   restorePoint.setFallbackFlag(True)
   restoreStack = LinkedList()
   restoreStack.add(restorePoint)
        ot.put(Namespace.OBJECT_MANAGER,
              ObjectManagerClient.TEMPL_INSTANCE_RESTORE_STACK, restoreStack)
        ot.put(Namespace.OBJECT_MANAGER,
              ObjectManagerClient.TEMPL_CURRENT_INSTANCE_NAME, "default")

        ot.put(Namespace.OBJECT_MANAGER,
                ObjectManagerClient.TEMPL_PERSISTENT, Boolean(True))

        ot.put(ClassAbilityClient.NAMESPACE, "class", player_class)       
        ot.put(CombatClient.NAMESPACE, "strength", MarsStat("strength", strength))
        ot.put(CombatClient.NAMESPACE, "dexterity", MarsStat("dexterity", dexterity))
        ot.put(CombatClient.NAMESPACE, "wisdom", MarsStat("wisdom", wisdom))
        ot.put(CombatClient.NAMESPACE, "intelligence", MarsStat("intelligence", intelligence))
        ot.put(CombatClient.NAMESPACE, "stamina", MarsStat("stamina", int(int(strength)*1.5)))
        ot.put(CombatClient.NAMESPACE, "stamina-max", MarsStat("stamina-max", int(int(strength)*1.5)))
        ot.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", int(intelligence)*2))
        ot.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", int(intelligence)* 2))
        ot.put(CombatClient.NAMESPACE, "health", MarsStat("health", int(strength) * 2))
        ot.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", int(strength)*2))
        ot.put(CombatClient.NAMESPACE, "experience", MarsStat("experience", 0, 100))
        ot.put(CombatClient.NAMESPACE, "level", MarsStat("level", 1, 100))

        # generate the object
        objOid = ObjectManagerClient.generateObject("DefaultPlayer", ot)
        Log.debug("SampleFactory: generated obj oid=" + str(objOid))
        return objOid

sampleFactory = SampleFactory()
LoginPlugin.getCharacterGenerator().setCharacterFactory(sampleFactory)

SampleCharacterCreation.py

Code:


from System.Math import PI
from Axiom.Core import ColorEx
from Axiom.Graphics import LightType
from Axiom.MathLib import *
from Multiverse.Base import Client

import ClientAPI
import CharacterCreation
import Input
import WorldObject
import Animation
import Light

meshInfo = { "female_1" : [ "human_female_fantasy.mesh" ,
                            [ [ "human_female_body-mesh.0", "human_female_fantasy.body_01_clothed_mat" ],
                              [ "human_female_head_01-mesh.0", "human_female_fantasy.head_01_mat" ],
                              [ "human_female_head_01_hair-mesh.0", "human_female_fantasy.head_01_hair_01_mat" ],
                              ]
                            ],
            "female_2" : [ "human_female_fantasy.mesh" ,
                            [ [ "human_female_body-mesh.0", "human_female_fantasy.body_02_clothed_mat" ],
                              [ "human_female_head_02-mesh.0", "human_female_fantasy.head_02_mat" ],
                              [ "human_female_head_02_hair_01-mesh.0", "human_female_fantasy.head_02_hair_01_mat" ],
                              ]
                            ],
            "male_1" : [ "human_male_fantasy.mesh" ,
                          [ [ "human_male_body-mesh.0", "human_male_fantasy.human_male_body_01" ],
                            [ "human_male_head_01-mesh.0", "human_male_fantasy.human_male_head_01" ],
                            [ "male_head_01_hair_01-mesh.0", "human_male_fantasy.human_male_head_01_hair_01" ],
                            ]
                          ],
            "male_2" : [ "human_male_fantasy.mesh" ,
                          [ [ "human_male_body-mesh.0", "human_male_fantasy.human_male_body_02" ],
                            [ "human_male_head_02-mesh.0", "human_male_fantasy.human_male_head_02" ],
                            [ "human_male_02_hair_01-mesh.0", "human_male_fantasy.human_male_head_02_hair_01" ],
                            ]
                          ]
            }

# Add clothing meshes for the client - on the server this should be done with
# the inventory system, but that is not available here.
meshInfo["male_1", "male_2"].extend([["human_male_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_male.leather_a_material" ] ]
                                      ]
                                      )

meshInfo["female_1", "female_2"].extend([["human_female_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_female.leather_a_material" ],
                                      [ "leather_a_tunicShape-lib.0", "human_female.leather_a_material" ] ]
                                      ]
                                      )                                     

class SampleCharacterCreationContext(CharacterCreation.CharacterCreationContext):
    #
    # Constructor
    #
    def __init__(self):
        CharacterCreation.CharacterCreationContext.__init__(self)
        # set up some fields for convenience in later methods
        self._male_models = [ 'male_1', 'male_2' ]
        self._female_models = [ 'female_1', 'female_2' ]
        # put some initial data in the create context, so that when we change attributes, we have a valid starting point
        self.SetAttributes("characterName", {"characterName":"", "model":"male_1", "sex":"male"})
    #
    # Methods
    #
    def GetValidAttributeValues(self, attr):
        """Get the possible attribute values for attr, given the state of the
          other attributes in the _attrs dictionary"""
        print "In GetValidAttributeValues('%s')" % attr
        if attr == 'sex':
            rv = []
            if self._listContains(self._male_models, self._attrs['model']):
                rv.append('male')
            if self._listContains(self._female_models, self._attrs['model']):
                rv.append('female')
            return rv
        elif attr == 'model':
            rv = []
            if self._attrs['sex'] == 'male':
                rv.extend(self._male_models)
            elif self._attrs['sex'] == 'female':
                rv.extend(self._female_models)
            return rv
        else:
            raise "Invalid attribute %s" % attr
        return None

    def _setAttributes(self, primaryAttr, attrs):
        """This method requires primaryAttr to be a valid attribute name,
          and requires the entry for primaryAttr in the attrs dictionary to be valid.
          There must be a legitimate value for each other attribute.
          There must be an entry for each attribute in the attrs dictionary."""

        # we can always copy the name, since there are no real limitations on that
        if attrs.has_key('characterName'):
            self._attrs['characterName'] = attrs['characterName']

        if primaryAttr == 'sex':
            # setting the sex requires us to check the model
            self._attrs['sex'] = attrs['sex']
            possibleVals = self.GetValidAttributeValues('model')
            if attrs.has_key('model') and self._listContains(possibleVals, attrs['model']):
                self._attrs['model'] = attrs['model']
                # the combination of attributes is legal
                return True
            # the combination of attributes is illegal
            # if we don't have any possible values, throwing is fine
            self._attrs['model'] = possibleVals[0]
            return False
        else:
            # either the model was the primary attribute, or
            # some other non-sex attribute was.  Treat both
            # cases the same
            self._attrs['model'] = attrs['model']
            self._attrs['strength'] = attrs['strength']
            self._attrs['dexterity'] = attrs['dexterity']
            self._attrs['wisdom'] = attrs['wisdom']
            self._attrs['intelligence'] = attrs['intelligence']
            self._attrs['level'] = attrs['level']
            self._attrs['class'] = attrs['class']
            possibleVals = self.GetValidAttributeValues('sex')
            if attrs.has_key('sex') and self._listContains(possibleVals, attrs['sex']):
                self._attrs['sex'] = attrs['sex']
                # the combination of attributes is legal
                return True
            # the combination of attributes is illegal
            # if we don't have any possible values, throwing is fine
            self._attrs['sex'] = possibleVals[0]
            return False

    def OnAttributesUpdated(self):
        # Destroy the old model
        avatar = ClientAPI.World.GetObjectByName("avatar")
        if not avatar is None:
            avatar.Dispose()
        # Set up the new avatar model
        meshName = self._attrs['model']
        global meshInfo
        meshName = meshInfo[modelName][0]
        submeshInfo = meshInfo[modelName][1]
        avatar = WorldObject.WorldObject(-10, "avatar", meshName, Vector3(0, 23000, 0), False)
        for submeshName in avatar.Model.SubMeshNames:
            avatar.Model.HideSubMesh(submeshName)
        for i in range(0, len(submeshInfo)):
            ClientAPI.Log('Submesh name and material: %s, %s' % (submeshInfo[i][0], submeshInfo[i][1]))
            avatar.Model.SetSubMeshMaterial(submeshInfo[i][0], submeshInfo[i][1])
            avatar.Model.ShowSubMesh(submeshInfo[i][0])
        avatar.QueueAnimation("idle")
       

class SampleCharacterSelectionContext(CharacterCreation.CharacterSelectionContext):
    def __init__(self):
        self.selectedCharacterId = None

    def SetAvatarDisplayContext(self, displayContextString):
        meshEntries = displayContextString.split('')
        submeshEntries = meshEntries[0].split('')
        ClientAPI.Log('Display Context contains %s submesh entries' % len(submeshEntries))
        meshName = submeshEntries[0]
        submeshNames = []
        materialNames = []
        submeshEntries = submeshEntries[1:]
        for j in range(0, len(submeshEntries) / 2):
            submeshNames.append(submeshEntries[2 * j])
            materialNames.append(submeshEntries[2 * j + 1])

        attachedEntries = meshEntries[1:]
        for i in range(0, len(attachedEntries)):
            submeshEntries = attachedEntries[i].split('')
            attachPoint = submeshEntries[0]
            attachedMeshName = submeshEntries[1]
            print '  Attachment Point: %s' % attachPoint
            print '    Mesh: %s' % attachedMeshName
            submeshEntries = submeshEntries[2:]
            for j in range(0, len(submeshEntries) / 2):
                print '      Submesh: %s' % submeshEntries[2 * j]
                print '      Material: %s' % submeshEntries[2 * j + 1]

        # Destroy the old model
        avatar = ClientAPI.World.GetObjectByName("avatar")
        if not avatar is None:
            avatar.Dispose()
        # Set up the new avatar model
        avatar = WorldObject.WorldObject(-10, "avatar", meshName, Vector3(0, 23000, 0), False)
        # Special handling for the case where we don't have any submesh info
        # This will just show all the meshes
        if len(submeshNames) == 0:
            avatar.QueueAnimation("idle")
            return
        for submeshName in avatar.Model.SubMeshNames:
            avatar.Model.HideSubMesh(submeshName)
        for i in range(0, len(submeshNames)):
            ClientAPI.Log('Submesh name and material: %s, %s' % (submeshNames[i], materialNames[i]))
            avatar.Model.SetSubMeshMaterial(submeshNames[i], materialNames[i])
            avatar.Model.ShowSubMesh(submeshNames[i])
        avatar.QueueAnimation("idle")

    def OnSelectionUpdated(self, characterId):
        displayContext = self.GetCharacterAttribute(characterId, 'displayContext')
        self.SetAvatarDisplayContext(displayContext)
        self.selectedCharacterId = characterId
   
    def DeleteSelectedCharacter(self):
        self.Delete(self.selectedCharacterId)

def CreateSpinAnimation(obj):
    """This is a utility method that produce a one second animation on the
      given object to rotate it."""
    animation = Animation.Animation("spinning", 1.0)
    animation_nodetrack = animation.CreateNodeTrack(obj.SceneNode)
    animation_nodetrack_kf0 = animation_nodetrack.CreateKeyFrame(0)
    animation_nodetrack_kf0.Translate = obj.Position
    animation_nodetrack_kf0.Orientation = obj.Orientation
    animation_nodetrack_kf1 = animation_nodetrack.CreateKeyFrame(.25)
    animation_nodetrack_kf1.Translate = obj.Position
    animation_nodetrack_kf1.Orientation = Quaternion.FromAngleAxis(.5 * PI, Vector3.UnitY) * obj.Orientation
    animation_nodetrack_kf2 = animation_nodetrack.CreateKeyFrame(.5)
    animation_nodetrack_kf2.Translate = obj.Position
    animation_nodetrack_kf2.Orientation = Quaternion.FromAngleAxis(PI, Vector3.UnitY) * obj.Orientation
    animation_nodetrack_kf3 = animation_nodetrack.CreateKeyFrame(.75)
    animation_nodetrack_kf3.Translate = obj.Position
    animation_nodetrack_kf3.Orientation = Quaternion.FromAngleAxis(1.5 * PI, Vector3.UnitY) * obj.Orientation
    animation_nodetrack_kf4 = animation_nodetrack.CreateKeyFrame(1)
    animation_nodetrack_kf4.Translate = obj.Position
    animation_nodetrack_kf4.Orientation = Quaternion.FromAngleAxis(2 * PI, Vector3.UnitY) * obj.Orientation
    return animation


def BuildInitialScene():
    """This method sets up the world objects for the character creation and
      character selection interface.  We aren't talking to the world server
      yet, so we can't get the information from there."""
    # Set up the ambient light color
    ClientAPI.AmbientLight.Color = ColorEx(0.2156863, 0.2588235, 0.2588235)
    # Throw in a directional light as well
    dirlight = Light.Light("dirlight")
    dirlight.Type = LightType.Directional
    dirlight.Direction = Vector3(.9100, 0, .4147)
    dirlight.Diffuse = ColorEx(0.7098039, 0.3568628, 0.654902)
    dirlight.Specular = ColorEx(0.6745098, 0.2431373, 0.6352941)
    # Put in a point light
    pointlight = Light.Light("pointlight")
    pointlight.Type = LightType.Point
    pointlight.Position = Vector3(100, 25300, 2200)
    pointlight.Diffuse = ColorEx(0.8117647, 0.7882353, 0.8705882)
    pointlight.Specular = ColorEx(0.8431373, 0.9058824, 0.9254902)
    pointlight.AttenuationRange = 5500
    # Set up the Gazebo
    platform = WorldObject.WorldObject(-1, "creation_gazebo_platform", "creation_gazebo.mesh", Vector3(0, 23000, 0), False)
    # Set up the sky cylinder
    skycyl = WorldObject.WorldObject(-2, "creation_skycyl", "creation_gazebo_skycyl.mesh", Vector3(0, 23000, 0), False)
    skycyl_anim = CreateSpinAnimation(skycyl)
    skycyl_anim.Play(.003, True)
    # For our startup world, we want to set the camera in a specific spot
    camera = ClientAPI.GetPlayerCamera()
    camera.Position = Vector3(0, 24500, 3000)
    camera.Orientation = Quaternion.FromAngleAxis(-.15, Vector3.UnitX)
    # Now set up the avatar model
    avatar = WorldObject.WorldObject(-10, "avatar", "tiny_cube.mesh", Vector3(0, 23000, 0), False)

 

# This function is an event handler that runs when the world has been initialized.
def WorldInitHandler(sender, args):
    """This method is intended to be called when the world is initialized.
      At that point, the world is fully prepared, and has the player object
      and terrain initialized."""
    if ClientAPI.World.IsWorldLocal:
        BuildInitialScene()

def WorldConnectHandler(sender, args):
    """This is intended to be called when we connect to a world.  This
      happens before the world is initialized."""
    if ClientAPI.World.IsWorldLocal:
        ClientAPI.Log("Connected to character selection world")
        # We skipped the rdp world connection, so inject the messages
        # we need to create the world
        CharacterCreation.InitializeStartupWorld()
        # Use our custom input handler that will handle gui events,
        # but doesn't control the camera or character.
        ClientAPI.InputHandler = ClientAPI.Input.GuiInputHandler()
    else:
        # This time we are really connected to the world
        ClientAPI.Log("Connected to real world")
        # Use the standard game input handler that will handle gui events,
        # as well as move the camera and character.
        ClientAPI.InputHandler = ClientAPI.Input.DefaultInputHandler()
   
# Register an event handler that will run when the world has been initialized.
ClientAPI.RegisterEventHandler('WorldConnect', WorldConnectHandler)

# Register an event handler that will run when the world has been initialized.
ClientAPI.World.RegisterEventHandler('WorldInitialized', WorldInitHandler)

# When the client connects to the world, skip the rdp world connection.
# When they click on the login widget, I will set this flag back to
# false, and send a portal message, which will initiate this connection
# again.
if ClientAPI.World.WorldName != "standalone":
    ClientAPI.World.IsWorldLocal = True


I found this in the login_manager.out, but for the life of me, I can't work out what's wrong with the line. The lib's and materials are correct, it has the right amount of brackets, and my text editor (Sublime Text) confirms that everything is opened and closed correctly.

EDIT: like 45 is in made a bit more obvious below (can't make code bold, apparently):
Code:

meshInfo["male_1", "male_2"].extend([["human_male_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_male.leather_a_material" ],
                              ------[ "leather_a_tunicShape-lib.0", "human_male.leather_a_material" ] ]------
                                      ]
                                      )


Here's the login_manager.out

Code:

ERROR [2012-02-28 06:09:23,308] main                ScriptManager.runPYFile: file=..\config\earth2.0\character_factory.py Traceback (innermost last):
  File "..\config\earth2.0\character_factory.py", line 45, in ?
KeyError: ('male_1', 'male_2')
 Traceback (innermost last):
  File "..\config\earth2.0\character_factory.py", line 45, in ?
KeyError: ('male_1', 'male_2')

      at org.python.core.Py.KeyError(Unknown Source)
      at org.python.core.PyObject.__getitem__(Unknown Source)
      at org.python.pycode._pyx5.f$0(..\config\earth2.0\character_factory.py:45)
      at org.python.pycode._pyx5.call_function(..\config\earth2.0\character_factory.py)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyCode.call(Unknown Source)
      at org.python.core.Py.runCode(Unknown Source)
      at multiverse.server.engine.ScriptManager.runPYFile(ScriptManager.java:181)
      at multiverse.server.engine.ScriptManager.runFile(ScriptManager.java:94)
      at multiverse.server.engine.Engine.processPostScripts(Engine.java:541)
      at multiverse.server.engine.Engine.main(Engine.java:396)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at multiverse.server.marshalling.Trampoline.main(Trampoline.java:150)

Cheers again...
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 EmptyTue 28 Feb - 23:51

Code:
Code:

meshInfo["male_1", "male_2"].extend([["human_male_fantasy.mesh"],
                                    [ [ "leather_a_pantsShape-lib.0", "human_male.leather_a_material" ],
                                      [ "leather_a_bootsShape-lib.0", "human_male.leather_a_material" ],
                              ------[ "leather_a_tunicShape-lib.0", "human_male.leather_a_material" ] ]------
                                      ]
                                      )


I believe python considers this all one line even though it is on multiple lines but the problem is with meshInfo["male_1","male_2"]
maps only take a single variable as an index so you would only be able to do meshInfo["male_1"].extend
and then have a second meshInfo["male_2"].extend
Back to top Go down
Sponsored content





Character Creation Options - Page 2 Empty
PostSubject: Re: Character Creation Options   Character Creation Options - Page 2 Empty

Back to top Go down
 
Character Creation Options
Back to top 
Page 2 of 2Go to page : Previous  1, 2
 Similar topics
-
» Character Creation - Select name from list
» new account character creation failed{resolved}
» No Default Instance at Character Creation Screen
» Demo World Available - New York Times Square
» Character selection screen world?

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Client Scripting and Development-
Jump to: