Page 1 of 1

[Command] setCurrentLocation

Posted: Sat Nov 13, 2021 10:37 am
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