Jump to content

Getting the cell the player is in and doing stuff based on this.


antstubell

Recommended Posts

So I'm writing quite a long script and thought it could be easily shortened if I could just get the cell the player is in and base conditions based on that. Did a bit of research and basically I know how to 'call' the cell but comparing and using conditions is not clear to me. This is what I think is the right approach but as I said comparing and conditioning is what I need to know. Thanks.

 

Cell Property MyCell Auto

Event OnActivate(ObjectReference akActionRef)

Cell ThisCell = PlayerREF.GetParentCell()

If ThisCell == MyCell
Debug.Notification ("You’re in "); how would I display cell name?
; do stuff
EndIf
EndEvent

 

Link to comment
Share on other sites

That all looks fine. If you're using the script on multiple activators, you can use a string property and set it in the creation kit.

 

Cell Property MyCell Auto
String Property CellName Auto

Event OnActivate(ObjectReference akActionRef)

    Cell ThisCell = PlayerREF.GetParentCell()

    If ThisCell == MyCell
        Debug.Notification ("You’re in " + CellName); 
    ; do stuff
    EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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