View previous topic :: View next topic |
Author |
Message |
Moonunit921
Joined: 10 Sep 2005 Posts: 11 Location: The Yawning Portal Tavern, Waterdeep
|
Posted: Wed Oct 19, 2005 12:01 Post subject: Persistent Merchants |
|
|
Has anyone developed a way to use APS to persistently track a merchant's inventory yet? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Timear
Joined: 23 Aug 2005 Posts: 31
|
Posted: Thu Oct 20, 2005 13:10 Post subject: |
|
|
we have a persistent merchant on our PW, herzlande.de
it nearly works the same way as persistent chests do, but you'll have to use the item_aquire and item_unaquire events (as we do also for chest, because of tracking stackable items).
e.g.:
Code: |
// OnAquire: buy items from shop
void main()
{
object oItem = GetModuleItemAcquired();
int iStack = GetModuleItemAcquiredStackSize();
object oPC = GetItemPossessor(oItem);
object oLostBy = GetModuleItemAcquiredFrom();
if (GetObjectType(oLostBy) == OBJECT_TYPE_STORE && GetLocalInt (oLostBy, "Persistent"))
{
// Player oPC bought oItem from persistent shop oLostBy
if (!GetIsItemStackable(oItem))
DB_DeleteItemFromShop (oItem, oLostBy);
else
DB_DeleteItemFromShop (oItem, oLostBy, iStack);
}
}
|
Code: |
// OnUnaquire: sell items to shop
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
object oPossessor = GetItemPossessor(oItem);
if (GetObjectType(oPossessor) == OBJECT_TYPE_STORE && GetLocalInt (oPossessor, "Persistent"))
{
// Player oPC sold oItem to persistent shop oPossessor
DB_StoreItemInShop (oItem, oPossessor);
}
}
|
Code: |
// OnOpenStore: if not already initialized after last reboot, initialize shop and fill inventory with all the stored items...
void main()
{
object oPC = GetLastOpenedBy();
FloatingTextStringOnCreature("Dieser Händler speichert dauerhaft", oPC, FALSE);
if (GetLocalInt(OBJECT_SELF, "INIT") > 0)
return;
SetLocalInt (OBJECT_SELF, "INIT", 1);
SetLocalInt (OBJECT_SELF, "Persistent", 1);
string sTag = GetLocalString(OBJECT_SELF, "StorageTag");
if (sTag == "") sTag = GetTag(OBJECT_SELF);
DB_RetrieveShopItems(OBJECT_SELF);
} |
remember that the store must not have any items in his inventory by default (clear his inventory in the aurora-editor).
maybe there will be a complete script-set posted on the vault soon (don't know whether i'll find the time to do so or not).
but as long, i hope this helps you.
Timear |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Thu Oct 20, 2005 23:48 Post subject: |
|
|
Gryphyn's Vendor System
You'll find the full set of scripts...
Some features that you may not find elsewhere
- The Vendors can be mobile (walkwaypoints or DM relocated)
- Burghers allow you to collect 'earnings' from every Vendor (you don't need to revisit each one to collect your GP)
- Venders can be assigned Classes (these let you refine Buy/Sell options down to the TAG level.)
- Toolset Ease - Drop a copy of the Vendor template, assign unique TAG, (optionally assign class, add waypoints) done
- Reporting - All Sales are recorded, if anyone queries their earnings (Not In Game)
- Support - I'll do my best, but it will be focused on our PW needs
Cheers
Gryphyn |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fgetce
Joined: 04 Jun 2006 Posts: 23
|
Posted: Sat Oct 14, 2006 6:18 Post subject: |
|
|
Gryphyn wrote: | Gryphyn's Vendor System
You'll find the full set of scripts...
Some features that you may not find elsewhere
- The Vendors can be mobile (walkwaypoints or DM relocated)
- Burghers allow you to collect 'earnings' from every Vendor (you don't need to revisit each one to collect your GP)
- Venders can be assigned Classes (these let you refine Buy/Sell options down to the TAG level.)
- Toolset Ease - Drop a copy of the Vendor template, assign unique TAG, (optionally assign class, add waypoints) done
- Reporting - All Sales are recorded, if anyone queries their earnings (Not In Game)
- Support - I'll do my best, but it will be focused on our PW needs
Cheers
Gryphyn |
I can't get this system work in my module, but the demo works fine. Could I get a little assistance please...pretty please? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sat Oct 14, 2006 12:55 Post subject: |
|
|
fgetce wrote: | Gryphyn wrote: | Gryphyn's Vendor System
You'll find the full set of scripts...
Some features that you may not find elsewhere
- The Vendors can be mobile (walkwaypoints or DM relocated)
- Burghers allow you to collect 'earnings' from every Vendor (you don't need to revisit each one to collect your GP)
- Venders can be assigned Classes (these let you refine Buy/Sell options down to the TAG level.)
- Toolset Ease - Drop a copy of the Vendor template, assign unique TAG, (optionally assign class, add waypoints) done
- Reporting - All Sales are recorded, if anyone queries their earnings (Not In Game)
- Support - I'll do my best, but it will be focused on our PW needs
Cheers
Gryphyn |
I can't get this system work in my module, but the demo works fine. Could I get a little assistance please...pretty please? |
Have you been to ... [url=http://www.thefold.org/nexus/index.php?f=146&sid=444d2cb5364f0e3ee16a591ab2de1693]GVS Forums[url]?
This has some of the 'hints' available.
There are the three access points.
Module: OnLoad --> vendor_onload
Module: OnAcquireItem --> vendor_aquire
Module: OnUnacquireItem --> vendor_unaquire
Calls to the vendor versions need incorporated into your existing 'Module' scripts.
You'll need to export the vendor & burgher blueprints from the demo, and import them into your module. (you'll need associated scripts & conversations)
--You can also look in your server log for the [Script] that's talking to your database (I've only provided MySQL support)
Cheers
Gryphyn |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fgetce
Joined: 04 Jun 2006 Posts: 23
|
Posted: Sat Oct 14, 2006 20:10 Post subject: Thank you Grypghyn |
|
|
Actually I just signed up to use your forums to ask you there for some help, before I remembered you also visit here too.
I finally got it just 2 minutes ago working I am so happy now. I had miss-spelled the vendor_acquire and vendor_unacquire script names and forgot the 'c' in both of them.
Otherwise it now works beautifully. I can now move on to the last part and that is the fishing and camping content.
Thank you for this great persistent vendor scripts, they reall do show off the power of NWNX2. Will you be doing the same thing for NWN2? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sun Oct 15, 2006 8:38 Post subject: Re: Thank you Grypghyn |
|
|
fgetce wrote: | Actually I just signed up to use your forums to ask you there for some help, before I remembered you also visit here too.
I finally got it just 2 minutes ago working I am so happy now. I had miss-spelled the vendor_acquire and vendor_unacquire script names and forgot the 'c' in both of them.
Otherwise it now works beautifully. I can now move on to the last part and that is the fishing and camping content.
Thank you for this great persistent vendor scripts, they reall do show off the power of NWNX2. Will you be doing the same thing for NWN2? |
Yep, there will be an update...
I'm going to refit the system for SQLExpress.
I can get more code into the database - and minimize the number of database accesses that I need. My prototype merges several of the currently available plugs and it now runs with near 2DA performance.
(You can access your result set by direct calls to a Row/Column)
The update adds "Guild" vendors (Quatermasters), "Hire" vendors (PC controlled).
The scripts are being put in place... waiting on NWN2 to be released (ain't we all) and NWNX4 - at the moment I can't debug anything
Cheers
Gryphyn |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fgetce
Joined: 04 Jun 2006 Posts: 23
|
Posted: Wed Dec 27, 2006 21:05 Post subject: Interesting problem or bug |
|
|
Twice now my vendors have been down. Players were playing and walked up to a vendor and started to buy or sell, but when the vendor store opened all the categories were blank. I had to clear out the vendors and restock them with basic gear. They did have an obscene amount of loot on them from players selling them.
Has anyone had this problem? Vendor stores loading with nothing in them? The DB table shows them full of stuff. Is there a limit to something in the game system that could prevent them from successfully loading? Like a page limit?
Thanks. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
chaoslink
Joined: 23 Aug 2006 Posts: 37
|
Posted: Thu Dec 28, 2006 19:55 Post subject: |
|
|
I created a system for The Land of Nordock (and Nordock: A Dawn of Heroes) over at Richterm's Retreat (www.nordock.net).
It uses invisible, unclickable (sunk below the floor) chests to represent the merchant's inventory. There is one for "buying" which has items populated from the database and one for "selling" that players drop items into. The values in the database are updated upon completion of the transaction.
It works fairly well, using ondisturb events on the placeables, but does not work for stackables (because a stackable item can be dragged onto and merged with a non-full stack without triggering an ondisturb event).
Before this we had a conversation-based method of buying and selling crafted items (gah!) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fgetce
Joined: 04 Jun 2006 Posts: 23
|
Posted: Thu Dec 28, 2006 20:20 Post subject: Nevermind |
|
|
Figured out what the problem was last night. If the game starts up before MySQL loads, than the NWNX does not load the ODBC plugin correctly and there is no communication between it and my DB. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|