Jump to content

Need function to check if object REF is in a certain cell


icecreamassassin

Recommended Posts

Closest thing I have found is GetParentCell but I can't seem to make it work in a quest stage fragment as it returns as not a function (not quite sure how to call the ObjectReference script into the quest script so it can use the function)

 

basically I'm trying to set up a condition check to see if the item is still in it's original cell or not so that when the book which starts the quest is read it will set you on the quest if it's still there, and if it's not there say that you have already found it.

 

Any help is appreciated

Link to comment
Share on other sites

So you have a book that starts a quest. This quest would direct you to obtain an object somewhere. You want the quest to work only if the object is in its original location?

 

If it is something that the player would retrieve at some point, the easiest might be to have a "controller" quest which runs start game enabled and has a small script on the player alias that checks for the item when it is retrieved by the player (use an inventory event filter so you aren't checking everything needlessly). You can set a global variable when it is picked up. So that when the player reads the book to start your quest that global variable is checked. Depending upon its value the quest starts or does not.

Link to comment
Share on other sites

"as it returns as not a function." This occurs when you don't call something on the correct type.

The function must be called on an object reference.

 

Set up a property for the book and in the creation kit set the property to point at the book.

Then set up a location property for the original cell.

 

ObjectReference Property OrgBook Auto

Location Property OrgCell Auto

 

Bool Function IsBookInOrginalCell()

If OrgBook.GetParentCell() == OrgCell

Return True

Else

Return False

EndIf

EndFunction

 

Would it not be easier to just check if the player has the book?

Link to comment
Share on other sites

  On 7/15/2014 at 3:29 AM, icecreamassassin said:

Yeah I had considered just setting a global variable on acquiring the item. They are all for custom items I've added so I can just add a simple script and have the quest check for the variable instead. Thanks

Since they are your custom items, a small script on each object that uses the OnContainerChanged event and checks for the player inventory to be the new container would suffice for setting the GV. Only reason to go the other route I mentioned would be if the items you were dealing with were stock objects.

Link to comment
Share on other sites

Yeah I also managed to dynamically apply scripts to base game items I am using via the quest alias system.

 

The reason I don't do a check on player inventory is because the item could be on display, in a chest, sold already, etc so I need to check for if the item was ever picked up before, setting a global via on container change will work nicely to set the gv and then the quest can easily check the status and set stages accordingly

 

Thanks for the help

Link to comment
Share on other sites

  • Recently Browsing   0 members

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