Jump to content

.IsInLocation Papyrus Problem


Recommended Posts

Scriptname THJackMoveToInsideBalconyScript extends ObjectReference  

ObjectReference Property TargetLocation Auto
Actor Property Jack Auto
Actor Property PlayerRef Auto
Quest Property MyQuest Auto
Location Property TyburnHall Auto

Event OnTriggerEnter(ObjectReference akActionRef)

If PlayerRef.IsInLocation(TyburnHall)
If akActionRef==Jack
Jack.MoveTo(TargetLocation)
MyQuest.SetStage(10)

EndIf
EndIf
EndEvent

Would someone please be kind enough to advise as to why this simple script won't fire when the playerref is IN the interior location specified? Obviously if the Player isn't in the Loc nothing is supposed to happen. If I remove the location property, player ref property and .IsInLocation line it fires as I'd expect. The interior cell the script points to has a valid cell location under cells/commondata. Many Thanks.

 

Edit* For reference .IsInInterior is not firing either or GetParentCell - basically any other 'If' I put into the script renders the script unfirable.

Edited by TyburnKetch
Link to comment
Share on other sites

The trigger maybe has to check who's the trigger first.

if akActionRef == Jack
    if PlayerRef.IsInLocation(...)
       ..stuff
    endif
endif

If this is a custom location, the cell must be assigned to it, otherwise the game wont know the location exists.

Edited by Rasikko
Link to comment
Share on other sites

Thank you for replying. I first thought it maybe an order issue but Iâve tried multiple orders and functions. It has really got me stumped. The location has the interior cell attached to it.

 

But seeing as all the location functions Iâve tried in the script have all come up with nothing Iâm thinking it must have something to do with how Iâve set the location up. It has a name, obviously an ID, the cell is attached, itâs got a couple of keywords attached to it, a bed and a few npcs. Itâs got a parent location but I removed that and it didnât make a difference.

Edited by TyburnKetch
Link to comment
Share on other sites

*confused* If the trigger volume box that the script is attached to is located inside the location in question, why have that as a condition? It won't change. Not unless you are moving the trigger volume box via script and that shouldn't really be done at least not for trigger volume boxes as they are typically carefully sized for the specific area that they are in.

Link to comment
Share on other sites

The triggerbox holding the script is not in the location in question. Itâs in an ext cell.

 

Basically I have a giant window in my player home and when my npc walks past the window, if the player is inside the interior (looking out of the window) I want my npc to move to the interior cell but outside the window. To look as though heâs walking past on the outside.

 

I can get my npc to move to the interior, his package works as it should, he walks past and then rejoins the ext cell he started at (at the other side of the window) all fine. But not with any of the if playerref.isinlocation commands attached to the script. Which is sort of the whole point. I donât want him vanishing from the ext cell unless the player is actually inside the interior cell.

 

Thereâs got to be something wrong with how Iâve set my location up, but I have no idea what. What are the fundamentals that isinlocation needs? How should I have set up my location? It has a cell attached to it ... what else does it need?

Edited by TyburnKetch
Link to comment
Share on other sites

Have a trigger volume box inside the home for the player to enter. Set a global variable to a specific value, use that global variable at that specific value as a condition in the NPCs trigger volume box. When the player leaves the trigger volume box inside the home, change the global variable's value again. Doesn't resolve the IsInLocation thing but might work around it.

Link to comment
Share on other sites

Thatâs a good idea. Thank you. I already have a trigger box around my entire interior for a few other things. Could just add this to it.

 

Would very much like to try and understand what is blocking isinlocation though. OCD type thing :)

Edited by TyburnKetch
Link to comment
Share on other sites

Oh.. IsInLocation is that wrapper function. I'll break this down for you so maybe you can see why it's not working.

 

1.. if the location is none (meaning there is no location assigned to the cell) it will return false.

2...if the above is true, it will check if the location is a child of another, and if not, it will check if the current location is that location.

 

I'm concerned about 2 personally... I know you can have condition statements as return values but hmm...

 

Let's keep it simple and just go the basic route:

if akActionRef == Jack
    if PlayerRef.GetCurrentLocation() == TyburnHall
        ..stuff
    endif
endif
Edited by Rasikko
Link to comment
Share on other sites

This is very interesting. Thank you.

 

The location (and attached cell) are a child of an exterior location. But from memory, and this is due to when I literally just started the mod (and modding in general) I do not think I attached a cell to that location. The cell with the triggerbox (and script) has a location but also does not have a cell attached to it, from memory. Will need to check when I am next on.

 

If the working through the conditions of IsInLocation is correct perhaps it is looking for the parent location and coming back without the right information due to the location not actually having a cell attached to it.

 

I will try adding cells to these exterior locations and see what happens. If nothing I will give your above suggestion a go.

 

Thank you very much for this.

 

Edit* Rather, I will add locations to the ext cells!

Edited by TyburnKetch
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...