Accessing cloned non-avatar objects

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Accessing cloned non-avatar objects

Postby Zatiria » Wed Mar 13, 2013 1:47 pm

Hi. I have a simple question: How can I access cloned objects that aren't avatars (eg. "ArchOfKerath")?

I am using the Funhouse's Clone function for cloning such objects, the code of which is as follows:

Code: Select all
# World.Clone(string obj, string count, string age)
# Clones an object a specified number of times.
def Clone(obj="Beachball", count=5, age=None):

    if not age:
        age = PtGetAgeName()
    so = PtFindSceneobject(obj, age).getKey()
    me = PtGetLocalAvatar().getKey()
    for i in range(count):
        PtTransferParticlesToObject(so, me, 1)


This function does what's it's supposed to do but it has one problem: Once the object has been cloned I have no way of accessing the clone because I can't get its ptSceneobject or ptKey instance.

The default way of getting the ptSceneobject instance of an object by searching for it using it's name does not work here because both the original and the clone have the same name so I just end up getting the ptSceneobject of the original.

This problem would be solved very easily if the PtTransferParticlesToObject function actually returned the ptSceneobject or ptKey instance for the clone but unfortunately I don't that is the case.

Any input including a better way of cloning objects, if such exists, is welcome
Zatiria
 
Posts: 2
Joined: Mon Mar 11, 2013 1:18 pm

Re: Accessing cloned non-avatar objects

Postby Christopher » Wed Mar 13, 2013 1:56 pm

Well PtTransferParticlesToObject(...) is not really intended to clone objects I think... But AFAIK there is no other way of cloning Sceneobjects.

Christopher
User avatar
Christopher
 
Posts: 276
Joined: Mon Jul 19, 2010 3:25 am

Re: Accessing cloned non-avatar objects

Postby Mystler » Wed Mar 13, 2013 10:45 pm

I think transfering particles only works with particle systems.
User avatar
Mystler
 
Posts: 116
Joined: Sun Mar 22, 2009 4:55 am
Location: Germany


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron