Announcement

Collapse
No announcement yet.

Retrieve the referenced path of an instanced Actor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Retrieve the referenced path of an instanced Actor

    Actors are spawned into the World. These Actors are referenced by an absolute path.
    This path could look like this:
    Code:
    vCTF-Sanstorm.TheWorld:PersistentLevel.MyActor_0
    I know that the Outer of an Actor is the parent object who's holding that object. If I iterate over the Outers is see every value of the full path.

    Code:
    vCTF-Sanstorm
    TheWorld
    PersistentLevel
    But how to figure out the delimiters. Is every Actor referenced in the same way? Is it safe, to assume a colon between TheWorld and PersistentLevel? Is PersistentLevel always there?

    My current method to retrieve the full path is the following:
    Code:
    /** @return the full path of the Spawned Actor or the created object */
    static final function string GetFullPath(Object O)
    {
        local string ret;
    
        while (O != none)
        {
            ret = O.Name $ ret;
            if (O.Outer != none) ret = (O.Name == 'PersistentLevel' ? ":" : ".") $ ret;
            O = O.Outer;
        }
        return ret;
    }
    Does anyone know a better and secure method (and less hacky way) to retrieve this full path?

    Are these paths valid?
    Code:
    vCTF-Sanstorm.TheWorld:PersistentLevel.MyActor_0
    vCTF-Sanstorm.TheWorld:MyActor_0
    vCTF-Sanstorm.TheWorld:AnyNameOfAStreamedLevel.MyActor_0
    ---------------------------

    Before you ask, I need to have a absolute reference to any object/actor to be able to use the FindObject() method.
    Code:
    local Object obj;
    
    // For Actor or Object
    obj = FindObject(fullname, class'Object);
Working...
X