Dantioch01 Posted June 24, 2023 Share Posted June 24, 2023 Greetings - I'm having trouble checking the players current location for keywords - I thought it would be straight forward enough using LocationHasKeyword, however it fails to complie with error "no viable alternative at input 'LocationHasKeyword'". Event code is below - LocTypeCity is a filled Keyword property, as is PlayerRef. I'm trying to check the player's location periodically to avoid spawning hostile NPCs in civilized areas - I could probably find a work around with another quest using an alias to check but it seemed like I should be able to do it with the script below... Event OnUpdateGameTime();LocationRef Location = PlayerRef.GetLocation()If PlayerRef.LocationHasKeyword LocTypeCity == 1; || PlayerRef.LocationHasKeyword LocTypeTown == 1 || PlayerRef.LocationHasKeyword LocTypeHabitation == 1RegisterForSingleUpdateGameTime(1)ElseSpawnPoint=Game.FindRandomReferenceOfAnyTypeInListFromRef(CotARefsToSpawnNear, PlayerRef, 10000)CotAInvisibleActor.Enable()CotAInvisibleActor.MoveTo(SpawnPoint)RegisterForSingleLoSLost(CotAInvisibleActor, PlayerRef)endIfendEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 24, 2023 Share Posted June 24, 2023 Instead of LocationHasKeyword which is a condition function rather than a papyrus function, try using GetCurrentLocation coupled with HasKeyword instead. For example: If PlayerRef.GetCurrentLocation().HasKeyword(LocTypeCity) ;do something EndIf Link to comment Share on other sites More sharing options...
Dantioch01 Posted June 24, 2023 Author Share Posted June 24, 2023 Yup that seems to be it - thanks! Link to comment Share on other sites More sharing options...
Recommended Posts