Accessing cloned non-avatar objects

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.
Post Reply
Zatiria
Posts: 2
Joined: Mon Mar 11, 2013 1:18 pm

Accessing cloned non-avatar objects

Post by Zatiria »

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
User avatar
Christopher
Posts: 276
Joined: Mon Jul 19, 2010 3:25 am
MOULa KI#: 0

Re: Accessing cloned non-avatar objects

Post by Christopher »

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

Christopher
User avatar
Mystler
Posts: 116
Joined: Sun Mar 22, 2009 4:55 am
Location: Germany
Contact:

Re: Accessing cloned non-avatar objects

Post by Mystler »

I think transfering particles only works with particle systems.
Post Reply

Return to “Scripting”