OnContainerChanged won't trigger

Post » Tue Nov 20, 2012 7:12 am

why doesn't this trigger:

 Event OnContainerChanged (ObjectReference akOldContainer, ObjectReference akNewContainer)    if ( akNewContainer == PlayerRef )        if QuestAntipathy.IsObjectiveDisplayed (210)            QuestAntipathy.SetObjectiveCompleted (210, true)            QuestAntipathy.SetObjectiveDisplayed (210, false)            QuestAntipathy.SetObjectiveDisplayed (211, true)        endif    endifendEvent 

the script is on a book,
properties for playerRef as well as the quest are ok (an OnRead block also using them works fine too),
using game.getplayer () doesn't work either. from all i could test it doesn't get past the if aknewcontainer-part (and the objective asked for is most def displayed at the time)
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Tue Nov 20, 2012 12:12 pm

Why have you got spaces between your function call and the parenthesis??

Should be

Event OnContainerChanged(ObjectReference akOldContainer, ObjectReference akNewContainer)    if akNewContainer == PlayerRef        if QuestAntipathy.IsObjectiveDisplayed(210)            QuestAntipathy.SetObjectiveCompleted(210, true)            QuestAntipathy.SetObjectiveDisplayed(210, false)            QuestAntipathy.SetObjectiveDisplayed(211, true)        endif    endifendEvent 
User avatar
Haley Merkley
 
Posts: 3356
Joined: Sat Jan 13, 2007 12:53 pm

Post » Tue Nov 20, 2012 1:05 pm

Why have you got spaces between your function call and the parenthesis??
basically because i'm as shortsighted as a bat and find it easier to read this way :-)

Should be (...) QuestAntipathy.SetObjectiveCompleted(210, true) (...)
thanks, but unluckily, this didn't change anything, still won't trigger.

and, does a space like that really make any difference? thought i understood from the papyrus primer spaces mostly don't matter (been a while since i read that though), and i did set a lot of other objectives with this syntax and they all work as they should, except for this one, or was that just dumb luck with those? :-)


edit: other stuff i've tried so far:
.) making the script on the book a "book" instead of an "object reference" type script -> no difference
.) adding the book to the actor it's taken from via quest alias (instead of having it in his inventory right from the start) -> no difference (could this have anything to do with the containing actor?)
.) making the objective target the book / the containing actor / none -> no difference
looks like all i'm achieving here is higher states of confusion :-)
User avatar
Crystal Birch
 
Posts: 3416
Joined: Sat Mar 03, 2007 3:34 pm

Post » Tue Nov 20, 2012 4:44 am

had the script display notifications after every "if" for testing:
the onContainerChanged itself definitely triggers (and for some reason, it also triggers on death of the containing actor) -
it definitely is the "if akNewContainer == PlayerRef"-part where it's stuck (never getting to the objectives-part at all) - how can that be?
game.getplayer() doesn't do anything either.

and as for the stuff i've tried like in above posting, it now is an object reference script again, and be object is added to it's original containing actor as a reference alias (which is the objective target)
any ideas please?
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Tue Nov 20, 2012 1:02 pm

finally found out why this didn't work - this must be the most stupid mistake in papyrus history (ancient egyptian included):
instead of opening the event "Event OnContainerChanged (ObjectReference akNewContainer, ObjectReference akOldContainer)"
i accidentially wrote it the wrong way around: "Event OnContainerChanged (ObjectReference akOldContainer, ObjectReference akNewContainer)"
having corrected this, all works fine now, sorry for bothering :-))
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm


Return to V - Skyrim