icecreamassassin Posted January 3, 2016 Share Posted January 3, 2016 revamping my automated sell chest script and trying to find a way to exclude stolen goods from being added to the chest, but I can't seem to find a bool function anywhere that would apply. Any help is appreciated. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 3, 2016 Share Posted January 3, 2016 Check and see if there is a keyword that you can sort by. After all fence merchants can buy stolen goods while regular merchants cannot and as you know merchants utilize keywords to determine what they can and cannot buy or sell. Link to comment Share on other sites More sharing options...
icecreamassassin Posted January 4, 2016 Author Share Posted January 4, 2016 That would make sense but nope, no keyword that I can see. Nothing with steal, stolen, stole, fence or anything like that in the KW. Also no Vendor keyword that looks like it would apply. I wonder if the stolen flag is set simply by an object retaining ownership by someone else and I could just check for ownership != player? EDIT: So you think something like this would work? Compiles but haven't had a chance to test it yet. I fear this only checks for explicit ownership, and doesn't cover inherited ownership from cells or owned containers. Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if GetActorOwner() != Game.GetPlayer().GetActorBase() || GetActorOwner() != NONE Debug.Notification("The sell cart cannot liquidate stolen goods") Self.Removeitem(akBaseItem, GetItemCount(akBaseItem), True, Game.GetPlayer()) Endif EndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 5, 2016 Share Posted January 5, 2016 Could work. Only way to know is to test it out. Link to comment Share on other sites More sharing options...
icecreamassassin Posted January 6, 2016 Author Share Posted January 6, 2016 yeah it seems that the way I entered it above regards all things as stolen. I'm having a hard time wrapping my head around the GetActorOwner() function because it's an objectreference function but can only be called by an actorbase??? any time I put the object reference property in to call the function it says the function doesn't exist (ex: akBaseItem.GetActorowner() != Game.GetPlayer()) which to me logically sounds like " If the item just put into the container does not belong to the player " but it doesn't compile, despite the CK wiki site seeming to have it set up just that way. Either way what I wrote above is not correct since the GetActorOwner() function in the if bool is not being called by anything. Gonna have to keep playing I guess, I know there has to be a way to condition based on stolen or not, but maybe that's hard coded? I dunno, seems like it should be something that is flagged on an off since you can easily set the ownership with script. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 6, 2016 Share Posted January 6, 2016 For the heck of it, try this variation of your above: Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If (akBaseItem as ObjectReference).GetActorOwner() != NONE If (akBaseItem as ObjectReference).GetActorOwner() != Game.GetPlayer().GetActorBase() Debug.Notification("The sell cart cannot liquidate stolen goods") Self.Removeitem(akBaseItem, GetItemCount(akBaseItem), True, Game.GetPlayer()) EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
icecreamassassin Posted January 7, 2016 Author Share Posted January 7, 2016 Nope, sadly that doesn't seem to yield anything. The most I can get out of it is to reject ALL items. Problem is that the command above only checks for declared objectreference ownership and doesn't check inherited ownership from a cell which is generally what defines ownership of most items. This is what I have that rejects all items: Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ActorBase actorOwner = akItemReference.GetParentCell().GetActorOwner() if ActorOwner != Game.GetPlayer().GetActorBase() || ActorOwner != NONE Debug.Notification("The sell cart cannot liquidate stolen goods") Self.Removeitem(akBaseItem, GetItemCount(akBaseItem), True, Game.GetPlayer()) Endif EndEvent I also dug up (and had to reformat because they just dumped it all on one line) but it seems to pretty much be a mess: Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) bool stolen = false if (akItemReference != None) if (akItemReference.GetActorOwner() != None && akItemReference.GetActorOwner() != Game.GetPlayer().GetActorBase()) ; item is stolen! stolen = true endif if (akItemReference.GetFactionOwner() != None && akItemReference.GetFactionOwner() != Game.GetPlayer().GetFaction()) ; item is stolen! stolen = true endif elseif (akSourceContainer != None) if (akSourceContainer.GetActorOwner() != None && akSourceContainer.GetActorOwner() != Game.GetPlayer().GetActorBase()) ; item is stolen! stolen = true endif if (akSourceContainer.GetFactionOwner() != None && akSourceContainer.GetFactionOwner() != Game.GetPlayer().GetActorBase()) ; 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) Debug.Notification("The sell cart cannot liquidate stolen goods") Self.Removeitem(akBaseItem, GetItemCount(akBaseItem), True, Game.GetPlayer()) Endif EndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 7, 2016 Share Posted January 7, 2016 I'm assuming this is for Legacy. Here is an idea, turn your selling cart into a talking activator that opens up an actual shop for the player to sell items to. You'd have the benefit of being able to restrict stolen items as well as allowing the player to obtain the correct value of the sold items. You can then take it a bit further and take back the fees from the player for using the convenience of the selling cart. Drawback then would be that the correct value would be there for enchanted items and you have "lore" that says the buyers don't purchase enchanted items. Link to comment Share on other sites More sharing options...
icecreamassassin Posted January 7, 2016 Author Share Posted January 7, 2016 It's ok I already have a rewrite done and submitted to will, I managed to get your enchantment gold value algorithm working on the sell cart so that's no longer an issue. Talking activator is a near idea but having a box that buys your stuff in real time is a little immersion breaking. I also just got the cart set up so it randomly sells between 2-10 items a day from it so I think I may just live without stolen filtering until I discover a method that works with it. Thanks for the help though, Link to comment Share on other sites More sharing options...
Recommended Posts