event OnItemAdded and stolen items

Post » Tue Sep 22, 2015 4:08 pm

Hello.

I have the Player as alias for a quest and I've attached a script on it. The script contains the event OnItemAdded(). How can I know if the added item is stolen or not?

According to the "notes" row in creationkit.com page (http://www.creationkit.com/GetActorOwner_-_ObjectReference) it seems that the function is broken.

Is there another way to know if the item is stolen?

I'm trying to avoid to use the Story Manager (Player Acquire Item node).

Thank you.

User avatar
steve brewin
 
Posts: 3411
Joined: Thu Jun 21, 2007 7:17 am

Post » Tue Sep 22, 2015 6:05 am

Ok. I've reverted back to the Story Manager. Let me to explain something:
My Gray Cowl of Nocturnal mod have the SM Event Node "Player Add Item" that fires a preparation quest if the player stole or pickpocket an item.
Now, some users (3 or 4 moment) had reported that the quest won't start, even if you steal a whole city. So, I've investigated and I saw the "Known issues" at http://www.creationkit.com/SM_Event_Node

The yellow part is the new thing I had to keep in mind. So my situation is something like this: https://www.dropbox.com/s/w7brvhttfluobde/sm.jpg?dl=0

As you can see, my quest node is on top as suggested on the wiki. Also the vanilla WIAddItemNodes doesn't have the "share events" ticked. I thing this will solve the issue for that 3-4 users because I suspect they have other mods with the same SM event node but no "Share Events" enabled.

There is only a thing now: The WIAddItemNodes branch is now marked as *. It will be safe to work?

TES5Edit report this: https://www.dropbox.com/s/qe0d28l3a7917lx/tes5edit.jpg?dl=0

It seems to be an "override without conflict".

Thank you.

User avatar
Greg Swan
 
Posts: 3413
Joined: Tue Jun 05, 2007 12:49 am

Post » Tue Sep 22, 2015 7:55 pm

Hello. Any suggestion?!

User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Tue Sep 22, 2015 8:53 pm

Not sure if you are still interested in this problem considering your signature, but have you thought of calling http://www.creationkit.com/GetActorOwner_-_ObjectReference / http://www.creationkit.com/GetFactionOwner_-_ObjectReference on the items being added to the player's inventory? I haven't tested it out to see if it would work, but you could first check the OnItemAdded's akItemReference, and if that is None, you could check the owner of the container. And if the container is none, then you would check to see if the player owns the cell that the item is in.

Something like this (not tested or compiled):

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)    bool stolen = false    if (akItemReference != None)        if (akItemReference.GetActorOwner() != None && akItemReference.GetActorOwner() != Game.GetPlayer())            ; item is stolen!            stolen = true        endif        if (akItemReference.GetFactionOwner() != None && akItemReference.GetFactionOwner() != Game.GetPlayer())            ; item is stolen!            stolen = true        endif            elseif (akSourceContainer != None)        if (akSourceContainer.GetActorOwner() != None && akSourceContainer.GetActorOwner() != Game.GetPlayer())            ; item is stolen!            stolen = true        endif        if (akSourceContainer.GetFactionOwner() != None && akSourceContainer.GetFactionOwner() != Game.GetPlayer())            ; item is stolen!            stolen = true        endif        else        if (Game.GetPlayer().GetParentCell().GetFactionOwner() != Game.GetPlayer() && Game.GetPlayer().GetParentCell().GetActorOwner())            ; item is stolen!            stolen = true        endif    endif        if (stolen == true)        ; do your stuff here, perhaps    endif    endEvent
User avatar
Jessie Butterfield
 
Posts: 3453
Joined: Wed Jun 21, 2006 5:59 pm

Post » Tue Sep 22, 2015 11:13 am

Thank you. I have tried the GetActorOwner() but I can confirm that GetActorOwner() is buggy (just read the note section in the link at #1 post).

User avatar
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm

Post » Tue Sep 22, 2015 12:59 pm

So GetActorOwner() returns none and GetFactionOwner() also returns none?

Also, that note regarding GetActorOwner() being buggy was written in 2013. It could have been fixed by now?

User avatar
Skrapp Stephens
 
Posts: 3350
Joined: Mon Aug 06, 2007 5:04 am

Post » Tue Sep 22, 2015 5:55 pm

I have tested myself. GetActorOwner() returns always none.

User avatar
Marion Geneste
 
Posts: 3566
Joined: Fri Mar 30, 2007 9:21 pm


Return to V - Skyrim