Aller au contenu

Photo

New Custom Shop system:


  • Veuillez vous connecter pour répondre
41 réponses à ce sujet

#1
dethia

dethia
  • Members
  • 146 messages
I have created a custom shop system, it is pending on the vault:
http://nwvault.ign.c...s.Detail&id=370

Posted Image

Posted Image

Modifié par dethia, 27 février 2012 - 12:28 .


#2
Dann-J

Dann-J
  • Members
  • 3 161 messages
Looks awesome. If you really wanted to go nuts and expand on it further, then a 'haggle' button would be useful (perhaps combining appraise and diplomacy).

I've always thought that gold pieces were a strange base currency. In most mediaeval economies a peasant could have lived for a month (or indeed several months) on a single gold coin. And certainly no-one could have really afforded a high-end magical item that costs 200,000 gold pieces. If a gold Florin was around 3.5 grams, and gold is about $45 per gram at the moment, then a single gold piece is worth about $160 in modern terms. At 200,000 gp - that's 31.5 million dollars! And that's not taking into account five centuries of inflation. Yours is a much more sensible currency system.

#3
MokahTGS

MokahTGS
  • Members
  • 946 messages
 Ok, that is just cool.  I echo the desire for a haggle button as well.  Haggling with a dwarf merchant should be a requirment of these games.

A haggle button should check bluff/diplomacy, appraise, and any waukeen feats you might have.

I do have one UI suggestion, that the text on the "sell" button should be a more readable/thematic font.  The current one looks a bit wild westish to me.

Great job!

Modifié par MokahTGS, 22 mars 2011 - 05:00 .


#4
dethia

dethia
  • Members
  • 146 messages
well there is already an appraise check being done to determine a discount or a minor mark-up. I can remove the automatic appraise event and makeit a haggle instead but seems redundant.

#5
El Condoro

El Condoro
  • Members
  • 148 messages
Could it be made optional? e.g. a radio button option to haggle or accept automated/scripted results. Personally, I'd prefer an automated approach but I understand some may like the RP aspect of haggling.

#6
kamalpoe

kamalpoe
  • Members
  • 711 messages

MokahTGS wrote...
A haggle button should check bluff/diplomacy, appraise, and any waukeen feats you might have.

I have two custom feats in Crimmor, one lets you substitute Diplimacy for Appraise if your diplomacy is higher, the other lets you use Intimidate.

#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

dethia wrote...

well there is already an appraise check being done to determine a discount or a minor mark-up. I can remove the automatic appraise event and makeit a haggle instead but seems redundant.


I've always wondered how a merchant can determine your appraise ability just by looking at you. I'd have thought some sort of dialogue would have been required. Perhaps there is a hidden class called 'Merchant' that has a bunch of feats that grant them special psychic powers? Posted Image

A haggle button would introduce a new element of interactability. Every transaction would turn into a minigame of chance, with a once-per-conversation dice roll (incorporating a combination of skills) determining success or failure. Each merchant could have a DC check you need to beat for haggling success, with any bonuses above that DC determining the buy reduction / sell increase percentage. If you failed spectacularly, the merchant could become offended and close down the store interface.

Of course, it would be easy enough to incorporate such dialogue options into the merchant's conversation before opening the store. However having a plug-and-play store system that requires no additional conversation trickery would appeal to lazy people like me. Posted Image

Modifié par DannJ, 22 mars 2011 - 09:44 .


#8
The Fred

The Fred
  • Members
  • 2 516 messages
I think it is assumed that, by using the appraise skill, you are haggling. It's just all done behind the scene. Having a button would make it a bit more interactive (in so far as you have to do something)(, but unless you changed the actual system, it wouldn't actually make it any more involved - in fact, it'd probably just make it more annoying.

#9
kamalpoe

kamalpoe
  • Members
  • 711 messages

The Fred wrote...

I think it is assumed that, by using the appraise skill, you are haggling. It's just all done behind the scene.

That's exactly what it's supposed to represent.

#10
-Semper-

-Semper-
  • Members
  • 2 256 messages

The Fred wrote...

in fact, it'd probably just make it more annoying.


this. i don't wanna constantly click a button just for a dice to roll which is supposed to happen behind the scenes^^
and thx for the new curreny and trading system! ;)

Modifié par -Semper-, 22 mars 2011 - 11:04 .


#11
The Fred

The Fred
  • Members
  • 2 516 messages
Perhaps such a button could give options for using Intimidate etc instead of Apraise. However, you only get one go, and if Intimidate fails, you actually get *worse* prices. Maybe it also lowers your reputation, so the merchant doesn't give you a quest, etc. This would only work if there would be any reason *not* to take an action, though - if it's just the default haggling, it may as well happen automatically.

#12
Dann-J

Dann-J
  • Members
  • 3 161 messages
Do the markup/markdown options in ga_store_open still work with this new system? If so, then it should be easy enough to customise the script to plug in values automatically, rather than entering them via the conversation. By reverting the script to use plain old OpenStore() rather than N2_AppraiseOpenStore(), it should be possible to bypass the default appraise check entirely. Couple that with a more informative screen message (rather than just 'appraise check', or whatever it is now), and the haggling could still be automatic.

[Edit: found a copy of the N2_AppraiseOpenStore() function here:
http://nwn2forums.bi...59089&forum=114
Modifying it to include a more complex haggle fomula, and a more informative message output,  shouldn't be too difficult.]

Modifié par DannJ, 23 mars 2011 - 12:38 .


#13
Dann-J

Dann-J
  • Members
  • 3 161 messages
Here's an untested script I wrote at work in Notepad:
[Edit: now debugged and tested]

// ga_open_store2
#include "ginc_param_const"
int Haggle( object oPC )
{
int iAppraise = GetSkillRank(SKILL_APPRAISE, oPC, FALSE);
int iModifier = GetSkillRank(SKILL_BLUFF, oPC, FALSE);
if (iModifier < GetSkillRank(SKILL_DIPLOMACY, oPC, FALSE))
  iModifier = GetSkillRank(SKILL_DIPLOMACY, oPC, FALSE);
if (iModifier < GetSkillRank(SKILL_INTIMIDATE, oPC, FALSE))
  iModifier = GetSkillRank(SKILL_INTIMIDATE, oPC, FALSE);
int iCharismaMod = GetAbilityModifier(ABILITY_CHARISMA, oPC);
int iHaggle = iAppraise + (iModifier/2) + iCharismaMod + d10(1);
return iHaggle;
}
void HaggleOpenStore(object oStore, object oPC, int nBonusMarkUp = 0, int nBonusMarkDown = 0)
{
    int nPlayerSkillRank = Haggle(oPC);
    int nNPCSkillRank = Haggle(OBJECT_SELF);
    if (nNPCSkillRank < 1 )
        nNPCSkillRank = 1;
    //int nState = 0;
    int nAdjust = nNPCSkillRank - nPlayerSkillRank; // * determines the level of price modification
    // * Hard cap of 30% max up or down
    if (nAdjust > 30)
        nAdjust = 30;
    if (nAdjust < -30)
        nAdjust = -30;
 if (nNPCSkillRank > nPlayerSkillRank)
 {
     SendMessageToPC(oPC,"<color=red>Haggling Failed: "+IntToString(abs(nAdjust))+"% price rise");
 }
 else
 if (nNPCSkillRank < nPlayerSkillRank)
 {
     SendMessageToPC(oPC,"<color=green>Haggling Success: "+IntToString(abs(nAdjust))+"% price reduction");
 }
 else
 if (nNPCSkillRank == nPlayerSkillRank)
 {
     SendMessageToPC(oPC,"Haggling Tied: no price adjustments.");
 }
 // nBonusMarkUp is added to the stores default mark up percentage on items sold (-100 to 100)
 // (positive is good for player)
 // Effect on selling items is only half of effect on buying items.
    nBonusMarkUp = nBonusMarkUp + nAdjust/2;
 
 // nBonusMarkDown is added to the stores default mark down percentage on items bought (-100 to 100)
 // (negative is good for player)
 nBonusMarkDown = nBonusMarkDown - nAdjust;
    OpenStore(oStore, oPC, nBonusMarkUp, nBonusMarkDown);
}
void main(string sTag, int nMarkUp, int nMarkDown)
{
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
HaggleOpenStore(GetTarget(sTag), oPC, nMarkUp, nMarkDown);
}

Modifié par DannJ, 23 mars 2011 - 09:12 .


#14
dethia

dethia
  • Members
  • 146 messages
The mark up is affected by an appraise function. Each pw is free to modify how that mark up/down value works just go into the function and change its behaviour. The function name is DS_Appraise ;P.

Right now it uses the default appraise behaviour from one of the include files. Overall no additional script is necessary just a minor adjustment to said function so that it uses any skill/roll/ability modifier /feat/spell etc... you wish.

Edit:  I found a small oversight on my part where I forgot to adjust the blackmarket price properly, either download the latest scripts from the vault or if easier just change line 435 in dethia_shop_sys to the following:

{ fCostMod *= (iBlackMarket/100.0f); }

Modifié par dethia, 23 mars 2011 - 02:56 .


#15
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've tested the new Dethia Store interface, and it's very impressive. I particularly like the fact that you don't need to have the player's inventory open at the same time, and don't need to drag-and-drop items to sell them.

I've noticed two minor things though:

- You can sell 'plot' items for 1 copper piece. They spawn on the ground again, so they're not lost, but you can keep reselling them endlessly.

- If the appraise check is in the player's favour, then anything worth 1 copper piece (like a torch) has a selling price of zero. That means you can take it for free, and resell it for 1 copper, as many times as you like.You may want to limit the minimum buy/sell price to 1, or perhaps add 0.5 to the price calculation to ensure things round up instead of down.

I modified my new haggling script (see above) by adding the Dethia Store include file and changing OpenStore to DS_OpenStore. It works without a hitch, and provide much more feedback about the automatic haggling attempt.

My haggling system uses the appraise skill plus half of either bluff, diplomacy or intimidate (whichever is higher) plus the charisma bonus, plus a 1d10 roll to add a bit of chance to it. That way players with few appraise points (and who really wastes skill points on appraise anyway?) still have a chance to use other skills, or to just get lucky, while haggling.

#16
dethia

dethia
  • Members
  • 146 messages
Thanks for the test and feedback. I am not sure how you managed to sell plot items as I could not, I have a check for plot items and the npc should say something like "I cannot take that of your hands." I will double check to make sure that it is working properly and I'll go ahead and limit the selling price to 1 gold coin.

EDIT: All righty I've checked everything and indeed I have overlooked plot items ;P sorry about that.  I have rectified the problem and also set the minimum price for items being purchased to 1.

EDIT#2:  We finally got around to implementing the system on our server and found another bug that was fixed in the latest files available on the vault.  GetGoldPieceValue automatically multiplies the cost of an item by its stack size, so some items would cost a lot more than they should, that has been resolved and now item prices shown are per single item.

Modifié par dethia, 27 mars 2011 - 07:25 .


#17
MokahTGS

MokahTGS
  • Members
  • 946 messages
Hey how does coinage work with this system? Can I award the player a copper piece? Is there scripting included to support giving/taking different levels of coinage? For example, the player is talking to a beggar and gives the beggar a copper piece via conversation node.

#18
dethia

dethia
  • Members
  • 146 messages
By default the system uses the original NWN2 currency system and simply masks it giving the appearance of coins.

Having said that, if you want to give a beggar 1 coin, simply give the beggar 1 gold piece which is treated as copper.

If you wish to give a player/creature 1 silver you must give them a number of copper coins equal to silver and that depends on the conversion rates. By default 1 silver is 100 copper so you should give the player/creature 100 gold pieces (where gold is treated as copper or least valueable currency).

Similarly to give a player 1 gold you must give them 10,000 gold pieces which is how many copper coins there are in 1 gold coin by default. Hope that makes sense.

#19
Dann-J

Dann-J
  • Members
  • 3 161 messages
The updated version works like a dream.

I've noticed that if you sell something, you can buy it back immediately for the same price, yet if you close the store and re-open it the buying price changes. I assume this is by design, and allows you to change your mind if you sell something by accident and want it back immediately.

The one thing that would make the system even awesomer (if there was such a word) is if the items in the sell window were 'redded' out if the PC can't use that particular item. Those are usually the ones you want to sell first. But then, you could tinker with it forever and never manage to include every possible tweak (without making the code unwieldy and crash-prone).

#20
dethia

dethia
  • Members
  • 146 messages
Hmm that is not a bad idea but I guess will depend on whether there is such a function. It's a bit tricky since there is UMD which allowse use of items that one normally can't, I will look into it.

#21
Arvirago

Arvirago
  • Members
  • 9 messages
Dethia, great system, thanks. Did anyone have troubles with the price of items that are already stacked? (arrows, darts, etc).
SInce the minimum price is 1 copper, the shop askes for 99 coppers for 99 arrows!

#22
Dann-J

Dann-J
  • Members
  • 3 161 messages
I certainly found a bug with stacked items, but not the one you noticed.

If you sell a partial stack (rather than the whole thing), you get more money than you would selling the entire stack. For instance, if a stack of 99 arrows costs 1 copper, you can sell them individually for 1 copper each. Selling 50 at a time nets you 50 copper.

What is more, if you don't change the stack slider you can 'sell' your 50 arrows again immediately, get 50 copper, but the stack size isn't reduced. So you can continue selling your phantom stacked items over and over again, getting money for nothing.

I've made quite a bit of money selling 98 arrows from a stack of 99, getting 98 copper, then continuing to get 98 copper as I repeatedly hit the 'sell' button even though there aren't 98 left in the stack, always with the last one remaining.

So in other words - every else works fantastically, but stacked items are an issue (as they were, and often still are, in many of the official campaign scripts).

#23
dethia

dethia
  • Members
  • 146 messages

DannJ wrote...

I certainly found a bug with stacked items, but not the one you noticed.

If you sell a partial stack (rather than the whole thing), you get more money than you would selling the entire stack. For instance, if a stack of 99 arrows costs 1 copper, you can sell them individually for 1 copper each. Selling 50 at a time nets you 50 copper.

What is more, if you don't change the stack slider you can 'sell' your 50 arrows again immediately, get 50 copper, but the stack size isn't reduced. So you can continue selling your phantom stacked items over and over again, getting money for nothing.

I've made quite a bit of money selling 98 arrows from a stack of 99, getting 98 copper, then continuing to get 98 copper as I repeatedly hit the 'sell' button even though there aren't 98 left in the stack, always with the last one remaining.

So in other words - every else works fantastically, but stacked items are an issue (as they were, and often still are, in many of the official campaign scripts).


Thanks for letting me know, I don't check these forums that often heh but I will look into it, seems fixable.  Overall the issue seems to stem from a min price of 1.  For ammunition there are special rules in that pricing shouldn't change based on stack size, so in this case i will just add some exceptions for ammunition.
-----------------------
EDIT:

Ok all 3 issues are now fixed and the updated shop scripts are on the vault.  The following 3 issues were fixed:

1)  When selling a partial stack you could sell the same amount of the partially selected stack even if it exceeded the maximum remainder of the item.  As an example of what I mean:

If you had 99 items and sold 60, you now have 39 left.  With the bug you could sell 60 again if you hit the sell button, this is no longer possible and instead you will just sell 39 should you hit the button again.

2)  Update the remaining stack size for partial sales of stacked items.  As an example, if you had 99 items and sold 30, you could sell 99 again.

3) Ammunition can now only be sold in stacks of 99 (full quivers).  This obviously doesn't have to be that way, and it's no trouble for me to make it work some different way, just I will need input on how people would like it to work that's all.  Ammunition in general does not scale with stack size hence why the 99 requirement.  This I would say minor issue only revoles around ammunition and should have no impact on anything else.  Thanks to DannJ for finding these things ;P.

Modifié par dethia, 19 avril 2011 - 11:57 .


#24
Arvirago

Arvirago
  • Members
  • 9 messages
Hmm, the workaround I was doing was no stacked items at all. I mean, in your code, when you are filling the store with items, you put all infinite items as a stack of 99 (this gets rounded down to the correct value).

First I have to mention the maybe special use of shops we have in my module. All items in shops are infinite, and also the shop is created when you open it, and is destroyed when you close it.

My custom items (the blueprints I have created for my module) are mostly with a stack of 1, but for example some powerful arrows have a stack of 10 (normal arrows still have a stack of 99).

What I have done is commenting out the line where you put the item with a stack of 99. This way, a sword would still have a stack of 1, the powerful arrows a stack of 10, and normal arrows a stack of 99 (that is, the stack set in the blueprint). That way I should get correct prices when buying items.
The only drawback is if you want to buy two swords, you have to buy one, close the shop and then open it again to buy another.

I don't know if I explained it ok, sorry for my english.

#25
dethia

dethia
  • Members
  • 146 messages

Arvirago wrote...

Hmm, the workaround I was doing was no stacked items at all. I mean, in your code, when you are filling the store with items, you put all infinite items as a stack of 99 (this gets rounded down to the correct value).

First I have to mention the maybe special use of shops we have in my module. All items in shops are infinite, and also the shop is created when you open it, and is destroyed when you close it.

My custom items (the blueprints I have created for my module) are mostly with a stack of 1, but for example some powerful arrows have a stack of 10 (normal arrows still have a stack of 99).

What I have done is commenting out the line where you put the item with a stack of 99. This way, a sword would still have a stack of 1, the powerful arrows a stack of 10, and normal arrows a stack of 99 (that is, the stack set in the blueprint). That way I should get correct prices when buying items.
The only drawback is if you want to buy two swords, you have to buy one, close the shop and then open it again to buy another.

I don't know if I explained it ok, sorry for my english.


Hi, that can probably be fixed fairly easily, if a store has an infinite amount you would not need to close it agian.  I will do this fix tommorow as it's a bit late now will post here soon as it's up, it's a very easy fix and thanks for the feed-back.