View previous topic :: View next topic |
Author |
Message |
OckHAM
Joined: 22 Mar 2010 Posts: 2
|
Posted: Mon Mar 22, 2010 10:35 Post subject: Help - economy system with NWNX |
|
|
I would like to create with the help of nwnx functions, an economical mini-system for my PW. Basically it should work this way:
The price of Tradestuff1 is an int stored in the mysql db, i.e. int price1; the pc can sell Tradestuff1 in two markets, these markets have a % modification of the price1: int market1 and market2, that are defined in the module with an inc script; when the pc sells (through a container for example, or by conversation, this doesn't matter) the Tradestuff1 he obtains the price1 +/- market1 or market2 (depends on where he sells Tradestuff1) and price1 is modified as follows:
new price1 = price1 - (price1/100)
if the pc buy Tradestuff1 the prices1 is modified:
new price1 = price1 + (price1/100)
As I'm not very experienced in scripting with nwnx, could someone help me setting this dynamic in nwnx?
Thanks in advance and sorry for my english _________________ OckHAM, admin of Arva Social Server
www.arva-nwn.net |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Mon Mar 22, 2010 12:27 Post subject: |
|
|
Why do you want a database?
MarkUp and MarkDown are already options available when you open a 'store' object.
These values 'adjust' the gold-piece-value to make it more (or less) expensive for the player to buy/sell. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Mon Mar 22, 2010 16:27 Post subject: |
|
|
MarkUp/MarkDown don't allow changing the price of individual items, though. The SetGoldPieceValue function in nwnx_functions might do what you want, but I've never used it. If it works like I think it does, you would first set the price of the object to the current price1 using SetGoldPieceValue(), then update the value in the DB.
Edit: I'm not sure you can use it on objects in a merchant, though. You might be better off using a conversation-based merchant. _________________ Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/
<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for? |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Mon Mar 22, 2010 16:30 Post subject: |
|
|
SetGoldPieceValue works, but it needs to be reset when the item re-enters the module. It doesnt stick over resets/relogs. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
OckHAM
Joined: 22 Mar 2010 Posts: 2
|
Posted: Tue Mar 23, 2010 9:48 Post subject: |
|
|
Well I need this system being nwnx-based because:
1. Each stock has its price, that can floats based on the interaction of the pcs with the markets.
2. I can control the prices with a php web panel.
3. I need it to be persitent.
Basically I just need to know how to read and update an int in a nwnx database using the formula posted above _________________ OckHAM, admin of Arva Social Server
www.arva-nwn.net |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Tue Mar 23, 2010 15:18 Post subject: |
|
|
OckHAM wrote: | Basically I just need to know how to read and update an int in a nwnx database using the formula posted above |
That's the easy part -- I described how to do that in my last post. Actually changing the item's price is harder, so we were talking about the best way to do that. _________________ Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/
<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for? |
|
Back to top |
|
|
Squatting Monk
Joined: 28 Jun 2007 Posts: 76
|
Posted: Sat Mar 27, 2010 4:46 Post subject: |
|
|
I wonder... if SetGoldPieceValue() does work with items in a merchant, does it act normally when the item in question is set as infinite? |
|
Back to top |
|
|
|