OnSell(Actor akSeller) seems to not work

Post » Wed Jun 20, 2012 1:05 am

Hi, i attached a script with this event to a weapon. When i sell it to a merchant (or rebuy it) it doesn't notify "SOLD". So the event just doesn't start :(

Event OnSell(actor Seller)debug.notification("SOLD")if seller == game.getplayer()  do somethingendifendevent
User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am

Post » Wed Jun 20, 2012 7:59 am

edit: oops wrong thread
User avatar
ILy- Forver
 
Posts: 3459
Joined: Sun Feb 04, 2007 3:18 am

Post » Wed Jun 20, 2012 2:46 am

Try adding an OnInit event:

Event OnInit()    debug.notification("I'm working.")EndEventEvent OnSell(actor Seller)    debug.notification("SOLD")    if seller == game.getplayer()        do something    endifendevent
User avatar
Brooks Hardison
 
Posts: 3410
Joined: Fri Sep 07, 2007 3:14 am

Post » Tue Jun 19, 2012 9:56 pm

It notify "I'm working", but when i sell it, still nothing
User avatar
Jon O
 
Posts: 3270
Joined: Wed Nov 28, 2007 9:48 pm

Post » Tue Jun 19, 2012 9:17 pm

What happens if you check for changing containers?

Event OnInit()    debug.notification("I'm working.")EndEventEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)    debug.notification("I changed containers.")EndEventEvent OnSell(actor Seller)    debug.notification("SOLD")    if seller == game.getplayer()	    do something    endifendevent
User avatar
Christina Trayler
 
Posts: 3434
Joined: Tue Nov 07, 2006 3:27 am

Post » Tue Jun 19, 2012 11:06 pm

i tried this in the meantime. It notified me "None", so the event works, but you are not talking while in barter menu
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)debug.notification(game.getplayer().GetDialogueTarget())if akOldContainer == game.getplayer() && game.getplayer().GetDialogueTarget()  debug.notification("done")  endifendevent
User avatar
Juanita Hernandez
 
Posts: 3269
Joined: Sat Jan 06, 2007 10:36 am

Post » Wed Jun 20, 2012 5:06 am

So I guess there's something wrong with the OnSell event then.
User avatar
Honey Suckle
 
Posts: 3425
Joined: Wed Sep 27, 2006 4:22 pm

Post » Wed Jun 20, 2012 5:52 am

I found a working solution, don't know if bug free

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)if akOldContainer == game.getplayer() && akNewContainer && akOldContainer.getdistance(akNewContainer) > 200 && utility.isinMenuMode()	    do thingsendifEndevent
IF explanation:
akOldContainer == game.getplayer() --> In my script i needed to do it only if sold by player (to adjust sell price on script variable)
&& akNewContainer --> New container is not the world (not dropped)
&& akOldContainer.getdistance(akNewContainer) > 250 --> When you sell an item it is not transfered on the Vendor, but on his container placed in a unreachable place. So if the container is distant enought to not be reached by the player (max 200 circa), the object is not dropped by the player in a chest
&& utility.isinMenuMode() --> A menu (the barter menu) is opened. It's to exclude distant transfers by quest (hoping that no quest do this while a menu in open. here is the probable bug)
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am


Return to V - Skyrim