logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Help - economy system with NWNX

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
OckHAM



Joined: 22 Mar 2010
Posts: 2

PostPosted: Mon Mar 22, 2010 10:35    Post subject: Help - economy system with NWNX Reply with quote

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
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Mon Mar 22, 2010 12:27    Post subject: Reply with quote

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
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Mon Mar 22, 2010 16:27    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Mon Mar 22, 2010 16:30    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
OckHAM



Joined: 22 Mar 2010
Posts: 2

PostPosted: Tue Mar 23, 2010 9:48    Post subject: Reply with quote

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 Smile
_________________
OckHAM, admin of Arva Social Server
www.arva-nwn.net
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Mar 23, 2010 15:18    Post subject: Reply with quote

OckHAM wrote:
Basically I just need to know how to read and update an int in a nwnx database using the formula posted above Smile

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
View user's profile Send private message Visit poster's website
Squatting Monk



Joined: 28 Jun 2007
Posts: 76

PostPosted: Sat Mar 27, 2010 4:46    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group