Companion Merchant Won't Sell While Following

Post » Sat Feb 19, 2011 11:38 am

I've been trying to figure out this problem for a while now, and I think I've narrowed down my problem. I'm creating a mod that gives you a merchant companion basically so I can sell her all the stuff I pick up. It sort of works, but it's not getting the functionality I'm looking for. The problem is that she will not buy/sell if she has previously moved, but WILL buy/sell if you talk to her, exit. and then talk to her again (assuming you didn't walk away from her, forcing her to move, before talking to her the second time). All her packages have "Offers Services" and when I make her offer repairs and spells, as well, she offers them no matter what she's doing (which is what I want her to do). For some reason, she won't buy/sell like a normal merchant if she's moved since the last time you talked to her. This is also the same behavior with or without a merchant container, and occurs wherever I am in the world (also with or without a merchant container). As a side-note, I've noticed that she won't buy/sell when using the Travel package to return to her starting location, but she WILL buy/sell once she's arrived at that location and finishes turning around.

I don't get it. This seems like a bug in the game's engine more than it's a fault of mine, but maybe there's a way around this that I'm not seeing. Does anyone have a solution for this? Or does anyone know a good way to make a merchant companion?

On a related note, is there a script command to activate the merchant menu? I figure this could be a possible solution, as well as maybe allowing creature merchants. (And if I can get THAT to work, I'm going to make a mudcrab merchant follower! XD)

Thank you.
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm

Post » Sat Feb 19, 2011 4:34 am

You could check her AI Packages-- there's a tab called "Offers Services"-- make sure it is set to run on all her packages, and it may fix this. I've never heard of this particular problem, but I have made travelling Merchants before without issue by making sure of this. Hopefully it will help.
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Sat Feb 19, 2011 9:58 am

I had a feeling someone would suggest that. However, as I said, all of her packages have "Offers Services" checked, and she in fact DOES offer every other service when they are enabled (Repair, Recharge, Selling Spells). The one thing she doesn't do is sell stuff. The way this is happening, it almost seems like it's more of a bug in the game engine than anything else... I assume you have the unofficial patch and OBSE, etc.? I'm going to try installing all that stuff and then see if the "bug" still happens.
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm

Post » Sat Feb 19, 2011 2:19 am

Nope. I installed all of the unofficial patches and obse, and the "bug" still occurs. How did you make your traveling merchants before? If you don't mind, could I perhaps check out your mod and see how you put it together?
User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Fri Feb 18, 2011 9:45 pm

Unfortunately I don't still have it-- it was a private Mod which I lost :(

From what I recall, it just had the NPC set to Offers Services... Have you tried moving the Chest to the NPC before speaking to them? I don't know whether it would actually effect it, but I always used invisible Chests and locked them onto the NPCs position, just in case they de-loaded somehow...
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Sat Feb 19, 2011 4:06 am

Oblivion is picky about how packages are ordered. Her standard "Services" package should be listed first in her AI package list. I assume so it can take priority over all others.
If that doesn't help perhaps if you list her packages according to how they're set up it might help someone notice something.
User avatar
amhain
 
Posts: 3506
Joined: Sun Jan 07, 2007 12:31 pm

Post » Sat Feb 19, 2011 4:10 am

All of her packages have 'offers services' flagged. DarkDrai, a list of her packages and conditions would be helpful. It might be a bug but it could also be a problem with your conditions, package order, etc.
User avatar
Vickey Martinez
 
Posts: 3455
Joined: Thu Apr 19, 2007 5:58 am

Post » Sat Feb 19, 2011 5:45 am

Note: I realize that "z" is a very common prefix. However I made this only to test out the companion, so it won't matter. Once I get everything working, I'll probably change the prefix to something more unique--assuming I actually decide to release this mod...

zMerchant
Script: (none)
Combat Style: DefaultArcher
Death Item: (none)
Respawn
PlayerFaction Rank 0

Aggression: 20 Confidence: 100 Energy Level: 100 Responsibility: 0 (So I can steal stuff right in front of her and then fence it to her.)

Buys/Sells: All (Auto-Calc from her custom class, with "Playable" and "Guard" unchecked.)
Auto-Calc Other: Repair, only (Also from class.)
Barter Gold: 65000

Packages (In this order from top to bottom):

zMerchantReturn (This is for making her return to the tower where you find her.)
- Package Type: Travel
- Door Flags: (none)
- Schedule: Any, Duration 0
- Conditions: (No targets)
1) GetQuestVariable Quest: 'zMerchantFollow', MerchantFollow == 0.00 AND
2) GetIsID NPC: 'zMerchant' == 1.00 AND
- Location: Near Editor Location (Radius 0)
- Target: N/A
- Flags:
Must Reach Location
Offers Services
Must Complete
Always Run

zMerchantStay (This is for making her stay when ordered.)
- Package Type: Travel
- Door Flags: (none)
- Schedule: Any, Duration 0
- Conditions: (No targets)
1) GetQuestVariable Quest: 'zMerchantFollow', MerchantOrder == 0.00 AND
2) GetQuestVariable Quest: 'zMerchantFollow', MerchantFollow == 1.00 AND
3) GetIsID NPC: 'zMerchant' == 1.00 AND
- Location: Near Current Location (Radius 0)
- Target: N/A
- Flags:
Offers Services
Defensive Combat

zMerchantFollows (This is for making her follow you around.) (Also, I messed up when adding the name for the associated quest, which is why this has the "s".)
- Package Type: Follow
- Door Flags: (none)
- Schedule: Any, Duration 0
- Conditions: (No targets)
1) GetQuestVariable Quest: 'zMerchantFollow', MerchantOrder == 1.00 AND
3) GetIsID NPC: 'zMerchant' == 1.00 AND
- Location: (none)
- Target: Any Object, Object ID: Player, Count 0
- Flags:
Offers Services
Allow Swimming
Allow Falls
Defensive Combat


MerchantFollow is for whether or not she's coming with you at all. 1.00 is coming with you, 0.00 is return/stay home.
MerchantOrder is for whether she's literally following you or staying put. 1.00 for follow, 0.00 for stay.

I have a quest (zMerchantFollow) that handles the dialogue for her, which does nothing but change variables and "EvaluatePackage" afterwards for each order. When you talk to her, you have the option of giving an order, asking about rumors, and persuasion/trading/etc. Each order (zFollow, zStay, and zReturn) has the "Goodbye" flag. The quest is Start Game Enabled and Priority 95. The only condition is: GetIsPlayableRace == 1.00 AND

Here's the quest script:

ScriptName zMerchantScript

short MerchantFollow
short MerchantOrder


She has a merchant container (ChestVendorSmithAllI01 [sic]) in the same interior cell. The container is persistent, owned by her and has her reference as its parent. (I think I had to do that last part to get her to use it as a merchant container at all.) It never moves from its original place, but whenever I successfully trade with her, it still works no matter where we are.

If I've left anything else out, let me know and I'll add it. I will say, however, that the area I've created to put her in currently has no pathgrids. However, the same behavior occurs even in other (normal) areas.

It MIGHT be possible that it has to do with the merchant container, although the same thing happens even when she doesn't have one (and I give her a random leveled food item to sell). It seems more like it has to do with the AI checking its position, or something, and not allowing transactions when on the move. Once it thinks it's staying put, however, it allows them. Then once it thinks it's on the move, again (even if it's not technically moving), it disallows them until it thinks it's stopped, again. The part that bugs me the most is that she'll offer any other service I want at any time, except for the main one I want her to offer.

So frustrating... :brokencomputer:

Perhaps if I move the container, anyway, it might help. How did you do that before?
User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Post » Sat Feb 19, 2011 8:22 am

Try changing your zMerchantStay to a Wander package. From the CS Wiki in the part about Offers Services:
Note that the actor will not offer services until they reach the location specified in the package.

Might be that your merchant is still 'traveling'. Means you won't be able to buy stuff from her while she's in a Travel package back to her home location. You could script her to switch to a Wander package whenever you talk to her, but then you'll have to ask her to go home again when you're done selling stuff. If that doesn't work, you might have to look into the http://cs.elderscrolls.com/constwiki/index.php/GetCurrentAIProcedure that might be causing the conflict.
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Sat Feb 19, 2011 3:07 am

Yep ...
I wrote that in the wiki, I discovered this while working on my Hammer Blade mode last year with my SCA merchants. If I remember right, I switched her out of the travel package as you said when the player got near her.

The actor will still business with you as long as it is the right time of day for thier services..


Try changing your zMerchantStay to a Wander package. From the CS Wiki in the part about Offers Services.

Might be that your merchant is still 'traveling'. Means you won't be able to buy stuff from her while she's in a Travel package back to her home location. You could script her to switch to a Wander package whenever you talk to her, but then you'll have to ask her to go home again when you're done selling stuff. If that doesn't work, you might have to look into the http://cs.elderscrolls.com/constwiki/index.php/GetCurrentAIProcedure that might be causing the conflict.

User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Sat Feb 19, 2011 6:10 am

CDM_ checked out my .esp and gave me this script to put on the NPC:

Begin OnActivate
EVP
Activate
End

This fix works PERFECTLY! Now she functions exactly as I was intending her to! With this problem out of the way, I can finally move on to a more serious version of the mod that I can actually play. Thank you, so much, everyone!

Now if only I could find a good (lightweight) way to access NPC inventories...
User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Sat Feb 19, 2011 8:41 am

Well, what I do is:
Ref TargetShort DoInvBegin GameMode  If ( DoInv == 2 )    Set DoInv to 0    [ChestID].RemoveAllItems Target    Target.AddItem [UniqueClothingID] 1    Target.EquipItem [UniqueClothingID]    Target.RemoveItem [UniqueClothingID] 1  ElseIf ( DoInv == 1 )   Set DoInv to 2   Target.RemoveAllItems [ChestID]   [ChestID].Activate Player 1  EndIf


Then use a Dialogue Script:

[QuestID].Set Target to GetSelf[QuestID].Set DoInv to 1

User avatar
Tracey Duncan
 
Posts: 3299
Joined: Wed Apr 18, 2007 9:32 am

Post » Sat Feb 19, 2011 10:07 am

Nice. I'll try that in a minute. What's that UniqueClothingID for, though?

Also, whenever I accidentally hit the follower near a guard, they arrest me. How can I avoid this?
User avatar
Mélida Brunet
 
Posts: 3440
Joined: Thu Mar 29, 2007 2:45 am

Post » Sat Feb 19, 2011 1:37 am

Removing an Equipped Piece of clothing forces the actor to immediately re-evaluate their Inventory-- using a Unique Piece means there's no chance of you accidentally removing the item you've just given them :) It would work with anything, however.

You could try setting the PC and the Companion into a special faction with "Allow Special Combat" (I can't remember it's proper name-- but it's a check box in the Faction Menu, where you make Factions)-- I believe that stops it being counted as an assault.
User avatar
Ashley Clifft
 
Posts: 3468
Joined: Thu Jul 26, 2007 5:56 am

Post » Fri Feb 18, 2011 11:20 pm

Wow, I wish I knew about that sooner...

Okay, so after a lot of testing and revising, I think she's working how I want her to. One problem with overriding the normal activation is that you can't actually yield to her if combat starts. However, I added a script that forces her to yield when she starts combat with the player, and it seems to work whenever I test it out. (Other methods either don't do what they're supposed to or make her ignore other enemies when she's supposed to fight.) One final problem I'm having is that even though both she and the player are in a faction with "Special Combat" checked, the guards still sometimes attack her if I start attacking first. However, adding SetIgnoreFriendlyHits makes at least the first three attacks do nothing, and forcing her disposition to stay at 100 makes attacks in most places safe, as well. So basically, the guards only start attacking her if you're already trying to kill her (and even then, only sometimes). The inventory system also works great, as does a script I adapted from somewhere to make her sneak whenever you enter sneaking mode (although I do have to fiddle with this a bit more to make it look better).

Anyway, I just wanted to thank everyone for all their help. I always feel like I'm going to forget something, but for right now, everything seems to be working exactly as intended. If someone does think of something I need to consider, let me know. Otherwise, thank you, everyone. Especially CDM_. Seriously, you made this whole thing WORK! :celebration:
User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am


Return to IV - Oblivion