[Command] getPerson

Post Reply
User avatar
Raddeck
LP Manager
Reactions: 1
Posts: 508
Joined: Sat Oct 16, 2021 6:22 pm
Location: LpWorld
Contact:

Post by Raddeck »

getPerson(optional bool/tag)


USE:
Get a random person in your current game (i.e. could be anyone that has been created with GeneratePerson() or GeneratePersonTemporary() then MakePermanent() ).


Optional parameters:
Boolean (true/false): to filter for whether their contact has been exchanged to you or not.

Tag (any): to filter for persons that have the given tag assigned.
The tag command was introduced with LifePlay 2.18 and can be used to iterate over all persons with a certain tag.

getPerson() will only return a specific person once for a scene. So you can use it to iterate though all persons in the game (omit the parameter), all you have in your contacts (set parameter to true), all persons you don't have exchanged contacts with (set to false) or all persons with a specific tag.


TYPE: Command, Non-Ref
RETURNS: Actor
THEME: Actor Loading
COMPARE: getSpecific


EXAMPLE:

Code: Select all

    Actor = getPerson()  // get anyone
    Actor = getPerson(true) // get someone who has exchanged contacts with me
    Actor = getPerson(false)  // get someone who is not in my contacts
    Actor = getPerson(SomeTag) // get only persons with 'SomeTag' (in contacts or not)
    
    Actor = getPerson(TagModel)
    While Actor.isValid()
        // Do something with the model
        
        // Get the next one or an invalid actor if no more persons with this tag.
        Actor = getPerson(TagModel)
    EndWhile
Like my work? Buy me a coffee or support me on Patreon to keep it coming. :ugeek:
-Don't PM me for support-
Top
Post Reply