[Command] setCurrentLocation

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 »

Actor.setCurrentLocation(BuildingVariable)


USE:
Change an actor's current location.
Used with findNearbyBuilding or getBuilding(Home) or getBuildingType(), mostly in lpai files.


TYPE: Command, Ref
RETURNS:
THEME: Location
COMPARE: getBuilding, getBuildingType


EXAMPLE:

Code: Select all

Home = CurrentCompanion.getBuilding(home)
CurrentCompanion.setCurrentLocation(Home)

or inside lpai files:

Code: Select all

    If AI:attractiveness > 50 && [WHEN > 9 || WHEN < 19] 
        ThisWeek = AI.getActorVar(beauty_thisweek)
        Treats = AI.getActorVar(treats_thisweek)        
        If ThisWeek < 2 && Random(0, 500)*Treats < AI:attractiveness
            Current = AI.getBuilding(current)
            Dest = Current.findNearbyBuilding(beauty, hairdresser, dentist)
            Until = HoursElapsed + Random(1, 4)                     
            AI.setCurrentLocation(Dest)
            AI.setUntil(Until)
            ThisWeek += 1
            AI.setActorVar(beauty_thisweek, ThisWeek)
            Treats += 1
            AI.setActorVar(treats_thisweek, Treats)
        Endif
    Endif
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