detecting if an actor is a merchant

Post » Thu Jun 21, 2012 3:46 pm

What's the best way to detect if an actor is a merchant and can buy and sell items?
I need to attach merchants to aliases and so need this check as a condition.
If there is no such condition that filters out merchants from non-merchants, what method can you think of?
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Thu Jun 21, 2012 7:02 am

Check whether they're in the JobMerchantFaction?
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Thu Jun 21, 2012 5:15 pm

Unfortunately, not all merchants are in that faction. E.g. Solaf in Falkreath. I even tried checking the Classes Vendor*. Again, not all merchants have that class. E.g. Solaf is a merchant but has a Lumberjack class.
User avatar
Joe Alvarado
 
Posts: 3467
Joined: Sat Nov 24, 2007 11:13 pm

Post » Thu Jun 21, 2012 4:16 pm

the thing that defines a vendor in skyrim is the vendor checkbox being ticked in their merchant faction (which links to a merchant container)

unfortunately i dont see an easy way of checking for that without using lengthy formlist checks
User avatar
Ezekiel Macallister
 
Posts: 3493
Joined: Fri Jun 22, 2007 12:08 pm

Post » Thu Jun 21, 2012 5:19 pm

Yeah. No easy way.

What I actually needed to do is detect when the player is bartering. I'm using this method:

When OnItemAdded () is triggered, I count the number of times Gold is increased and the number of times an inventory item is added.
Whan OnItemRemoved () is triggered, I count the number of times Gold is removed and the number of times an inventory item is removed.
Because bartering happens outside gamemode (i.e. in "menumode"), when OnUpdate () is next triggered, I check if transactions occured with this:
(gold added AND item removed) || (gold removed AND item added)
If no trasaction happend, I clear all the variables - allowing for dropping stuff, looting, quest rewards, etc... to be ignored.

It's not perfect, but it's better than trying to guess if those events happen while the player is conversing with a merchant.
And it seems to work with what I need it for.
User avatar
Peter lopez
 
Posts: 3383
Joined: Mon Sep 10, 2007 5:55 pm


Return to V - Skyrim