avatar out of water

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

avatar out of water

Postby lyllus » Thu Jun 21, 2012 3:00 am

I could, with plasma plugins to swim the avatar, but now I have a problem: how do you make avatar out of the water? obviously on a surface like a pier, as in ahnonay :) :D
lyllus
 
Posts: 28
Joined: Sun Sep 20, 2009 1:18 pm

Re: avatar out of water

Postby Deledrius » Thu Jun 21, 2012 6:21 am

Your question is a bit hard to understand. Do you mean to have the avatar resume walking when leaving a swimming area, or are you asking for something else like climbing out of the water (for which no animation currently exists in the game)?


Edit: Or I'm stupid and forgot about the ladders in the Ahnonay Maintenance areas... Someone know how to set those regions up?
User avatar
Deledrius
Gehn Shard Admin
 
Posts: 1377
Joined: Mon Oct 01, 2007 1:21 pm

Re: avatar out of water

Postby GPNMilano » Thu Jun 21, 2012 4:56 pm

Ah this is a simple enough thing to do. There's simply a region around the ladder object. That region triggers a region sensor type of logic modifier. Only an enter value. The logic mod triggers a responder, and the responder activates a oneshotmod for the animation. However you'll need to make sure to set up the region and the oneshot mod correctly in order for the animation to land you safely on the dock. Also you'll need to page in the animations as they are part of the Ahnonay age and not global animations.

Just throw this into your python script for your age. (IE "YourAgeName".py) so that your py file looks something like:



Code: Select all

from Plasma import *
from PlasmaTypes import *

animPages = ['FemaleSwimDockExit', 'MaleSwimDockExit']

class "YourAgeName".py(ptResponder):

    def __init__(self):
        global animPages
        ptResponder.__init__(self)
        self.id = "YourAgeSequencePrefix and a 1 after it"
        self.version = 1
        PtPageInNode(animPages)


    def OnFirstUpdate(self):
        pass


    def OnServerInitComplete(self):
        pass



    def OnNotify(self, state, id, events):
        pass


    def OnSDLNotify(self, VARname, SDLname, playerID, tag):
        pass


    def __del__(self):
        global animPages
        for page in animPages:
            PtPageOutNode(page)


glue_cl = None
glue_inst = None
glue_params = None
glue_paramKeys = None
try:
    x = glue_verbose
except NameError:
    glue_verbose = 0

def glue_getClass():
    global glue_cl
    if (glue_cl == None):
        try:
            cl = eval(glue_name)
            if issubclass(cl, ptModifier):
                glue_cl = cl
            elif glue_verbose:
                print ('Class %s is not derived from modifier' % cl.__name__)
        except NameError:
            if glue_verbose:
                try:
                    print ('Could not find class %s' % glue_name)
                except NameError:
                    print 'Filename/classname not set!'
    return glue_cl



def glue_getInst():
    global glue_inst
    if (type(glue_inst) == type(None)):
        cl = glue_getClass()
        if (cl != None):
            glue_inst = cl()
    return glue_inst



def glue_delInst():
    global glue_inst
    global glue_cl
    global glue_paramKeys
    global glue_params
    if (type(glue_inst) != type(None)):
        del glue_inst
    glue_cl = None
    glue_params = None
    glue_paramKeys = None



def glue_getVersion():
    inst = glue_getInst()
    ver = inst.version
    glue_delInst()
    return ver



def glue_findAndAddAttribs(obj, glue_params):
    if isinstance(obj, ptAttribute):
        if glue_params.has_key(obj.id):
            if glue_verbose:
                print 'WARNING: Duplicate attribute ids!'
                print ('%s has id %d which is already defined in %s' % (obj.name,
                 obj.id,
                 glue_params[obj.id].name))
        else:
            glue_params[obj.id] = obj
    elif (type(obj) == type([])):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type({})):
        for o in obj.values():
            glue_findAndAddAttribs(o, glue_params)

    elif (type(obj) == type(())):
        for o in obj:
            glue_findAndAddAttribs(o, glue_params)




def glue_getParamDict():
    global glue_paramKeys
    global glue_params
    if (type(glue_params) == type(None)):
        glue_params = {}
        gd = globals()
        for obj in gd.values():
            glue_findAndAddAttribs(obj, glue_params)

        glue_paramKeys = glue_params.keys()
        glue_paramKeys.sort()
        glue_paramKeys.reverse()
    return glue_params



def glue_getClassName():
    cl = glue_getClass()
    if (cl != None):
        return cl.__name__
    if glue_verbose:
        print ('Class not found in %s.py' % glue_name)
    return None



def glue_getBlockID():
    inst = glue_getInst()
    if (inst != None):
        return inst.id
    if glue_verbose:
        print ('Instance could not be created in %s.py' % glue_name)
    return None



def glue_getNumParams():
    pd = glue_getParamDict()
    if (pd != None):
        return len(pd)
    if glue_verbose:
        print ('No attributes found in %s.py' % glue_name)
    return 0



def glue_getParam(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getdef()
            else:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getdef()
            elif glue_verbose:
                print ('glue_getParam: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None



def glue_setParam(id, value):
    pd = glue_getParamDict()
    if (pd != None):
        if pd.has_key(id):
            try:
                pd[id].__setvalue__(value)
            except AttributeError:
                if isinstance(pd[id], ptAttributeList):
                    try:
                        if (type(pd[id].value) != type([])):
                            pd[id].value = []
                    except AttributeError:
                        pd[id].value = []
                    pd[id].value.append(value)
                else:
                    pd[id].value = value
        elif glue_verbose:
            print "setParam: can't find id=",
            print id
    else:
        print 'setParma: Something terribly has gone wrong. Head for the cover.'



def glue_isNamedAttribute(id):
    pd = glue_getParamDict()
    if (pd != None):
        try:
            if isinstance(pd[id], ptAttribNamedActivator):
                return 1
            if isinstance(pd[id], ptAttribNamedResponder):
                return 2
        except KeyError:
            if glue_verbose:
                print ('Could not find id=%d attribute' % id)
    return 0



def glue_isMultiModifier():
    inst = glue_getInst()
    if isinstance(inst, ptMultiModifier):
        return 1
    return 0



def glue_getVisInfo(number):
    pd = glue_getParamDict()
    if (pd != None):
        if (type(glue_paramKeys) == type([])):
            if ((number >= 0) and (number < len(glue_paramKeys))):
                return pd[glue_paramKeys[number]].getVisInfo()
            else:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
        else:
            pl = pd.values()
            if ((number >= 0) and (number < len(pl))):
                return pl[number].getVisInfo()
            elif glue_verbose:
                print ('glue_getVisInfo: Error! %d out of range of attribute list' % number)
    if glue_verbose:
        print 'GLUE: Attribute list error'
    return None


You can use the above just make sure to switch out the "YourAgeName" and the "YourAgeSequencePrefix" with the appropriate values and save. The self.id doesn't HAVE to be the sequence prefix it can be any string of numbers but to keep things sane I choose to use my sequence prefix plus 1. So for instance if my sequence was 3532 i'd use 35321. And if I have more than one python script in an age the second's id would be 35322 and so on.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: avatar out of water

Postby lyllus » Thu Jun 21, 2012 11:26 pm

Thanks! :) :) :) :) :)
lyllus
 
Posts: 28
Joined: Sun Sep 20, 2009 1:18 pm


Return to Building

Who is online

Users browsing this forum: No registered users and 2 guests

cron