• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Merchant!!

Estharos

Landlubber
Storm Modder
I'm making a quest right now and I thought to use a character to introduce you a merchant but I want that merchant to sell rare stuff or better certain items.

Is it possible to created a merchant that sell specific items only?

If not can I set the merchant to sell rare stuff or High level stuff?



<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
You need a line <i>LaunchItemsTrade(NPChar);</i> in the dialog to open the item trading interface. Then I *think* giving him the items manually beforehand with a <i>GiveItem2Character(NPChar,"spyglass2");</i> line or <i>TakeNItems(NPChar,"spyglass2", 1);</i> would work. You can use the second function to give multipe of the same items. Actually making a new trader type selling rare stuff would be a lot harder.
 
thx Pieter, I try many times to make a merchant so he sell stuff that I give him but no success. The way I see it Merchant got a level restriction, avoiding the player to buy high level items. But even then I try to talk to the merchant at rank 60 to see if it will sell my stuff that I give him but no success.

For some reason they don't use the command that I wrote for it. I check the Item Trader_Dialog.c as a reference and saw the fix about the 'spyglass2' and decide to do an experiment. My result come to this, most of the time when you talk to the first merchant they will give you the 'spyglass2' 70% chance it those. Sometime you get that 'spyglass2' only after talking to the 3rd merchant, so merchant #1 and #2 don't have it. At least the result is at 100% prior leaving Oxbay Town, you got 4 merchants in town and regardless the odds are, you will leave the Town with the 'spyglass2' at 100% success.

I thing you were right about making a merchant selling rare stuff to be hard, if we can at least remove the level restriction it will prolly work but then again I try to add simple things(stuff that you get at rank5-7) and they don't show up at all.

I'm gonna put the script I modify maybe I did something wrong:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void ProcessDialogEvent()
{
    ref NPChar, PChar, d;
    PChar = GetMainCharacter();
    aref Link, Diag;
    string NPC_Meeting;
    
    DeleteAttribute(&Dialog,"Links");

    makeref(NPChar,CharacterRef);
    makearef(Link, Dialog.Links);
    makeref(d, Dialog);
    makearef(Diag, NPChar.Dialog);
    
    string iDay, iMonth;
    iDay = environment.date.day;
    iMonth = environment.date.month;
    string lastspeak_date = iday + " " + iMonth;
    if(!CheckAttribute(NPChar, "quest.item_date")) NPChar.quest.item_date = NPChar.quest.meeting;
    
    switch(Dialog.CurrentNode)
    {
        case "exit":
            Diag.CurrentNode = Diag.TempNode;
            NPChar.quest.meeting = NPC_Meeting;
            DialogExit();
        break;

        case "Items":
            if (NPChar.Quest.Meeting != LastSpeak_Date)
                {
                    GiveItemToTrader(NPChar);
                    TakeNItems(Npchar,"blade10", Rand(4)+1);
                    TakeNItems(Npchar,"blade13", Rand(4)+1);
                    TakeNItems(Npchar,"blade16", Rand(4)+1);
                    TakeNItems(Npchar,"blade17", Rand(4)+1);
                    TakeNItems(Npchar,"blade19", Rand(4)+1);
                    TakeNItems(Npchar,"spyglass2", Rand(1)+1));
                    TakeNItems(Npchar,"spyglass3", Rand(1)+1));
                    TakeNItems(Npchar,"spyglass4", Rand(1)+1));
                    TakeNItems(Npchar,"pistol2", Rand(4)+1);
                    TakeNItems(Npchar,"pistol4", Rand(4)+1);
                    TakeNItems(Npchar,"pistol5", Rand(4)+1);
                    TakeNItems(Npchar,"pistol7", Rand(4)+1);
                    TakeNItems(Npchar,"pistol8", Rand(4)+1);
                    NPChar.Quest.Meeting = LastSpeak_Date;
                }
            Diag.CurrentNode = Diag.TempNode;
            DialogExit();
            LaunchItemsTrade(NPChar);
        break;

        case "First time":
            Dialog.defAni = "dialog_stay2";
            Dialog.defCam = "2";
            Dialog.defLinkAni = "dialog_1";
            Dialog.defLinkCam = "1";
            Dialog.ani = "dialog_stay2";
            Dialog.cam = "1";

            d.Text = DLG_TEXT[0];
            Link.l1 = DLG_TEXT[1];
            Link.l1.go = "Items";                        
            Link.l2 = DLG_TEXT[2];
            Link.l2.go = "exit";                        

        break;
    }
}<!--c2--></div><!--ec2-->

I'll do more testing later to see if I can come up with something.


<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
They only have the spyglass2 every now and then? That is rather odd; I am sure all merchants always have the spyglass2 when I tested during the tutorial. <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
What if you replace <i>NPChar.Quest.Meeting != LastSpeak_Date</i> with <i>CheckAttribute(NPChar,"items")</i>? Perhaps that works. <img src="style_emoticons/<#EMO_DIR#>/icon_confused.gif" style="vertical-align:middle" emoid=":?" border="0" alt="icon_confused.gif" />

Of course there is also the <i>IT_WEAP_RARITY_CUTOFF</i> InternalSettings.h value that makes sure too rare items ar never sold. Not sure if that is plaguing you here, but it'sa possibility. Solution: Set the items' rarity of the items you want to have the trader sell to higher than that value in initItems.c. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

I am not entirely sure what the <i>GiveItemToTrader(NPChar);</i> function does. I think it might give the trader a bunch of random items. You can try removing this line (or commenting it out) and see what happens then. Might work better without that line if you only want him (her?) to sell only those items you gave him (her?).
 
Ok! I'll try once I got a chance. thanks


Cheers, <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Can anyone tell me what this mean?

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->NPChar.itemtrade.tradetype = IT_TYPE_SNEAKY; // TIH properly set the trader type<!--c2--></div><!--ec2-->


<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
I think that is for Catalina the Pirate's unreleased and never-finished Sneaky Trader mod. You would encounter him at random and he would sell you the weirdest things.
 
<!--quoteo(post=246611:date=Mar 22 2008, 06:01 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Mar 22 2008, 06:01 AM) <a href="index.php?act=findpost&pid=246611"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I think that is for Catalina the Pirate's unreleased and never-finished Sneaky Trader mod. You would encounter him at random and he would sell you the weirdest things.<!--QuoteEnd--></div><!--QuoteEEnd-->

Ok! Gonna try to see what she had in mind.

By the way I manage to make the Merchant work, he first sell normal stuff like everyone else, then after completing the mission he start to sell the stuff I gave him.

I'll explain later how to do it, it's quite tricky.


<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Sounds interesting. Nice! <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
Alright everyone, after receiving a few PM, asking me to explain how I manage to make a merchant sell specific stuff I decide to let you guys know about it. <img src="style_emoticons/<#EMO_DIR#>/cool.gif" style="vertical-align:middle" emoid="8)" border="0" alt="cool.gif" /> I didn't finish testing yet but the script I made for my merchant so far work fine.

First let's create a merchant:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->                                            // Arthur Wellington
    
    makeref(ch,Characters[n]);
    ch.old.name             = "Arthur";
    ch.old.lastname         = "Wellington";
    ch.name                 = LanguageConvertString(tmpLangFileID,"Arthur");
    ch.lastname             = LanguageConvertString(tmpLangFileID,"Wellington");
    ch.id                     = "Arthur Wellington";
    ch.model                 = "50M5";
    ch.sex                     = "man";
    ch.location                = "Greenford_Town";
    ch.location.group         = "merchant";
    ch.location.locator     = "merchant1";
    ch.Dialog.Filename         = "00_Arthur_Wellington_Dialog.c";
    ch.greeting             = "Gr_Arthur_Wellington";
    ch.quest.area             = "Greenford";
    ch.nation                 = ENGLAND;
    ch.rank                 = 30;
    ch.reputation             = "70";
    ch.experience             = "900000";
    ch.skill.Leadership     = "6";
    ch.skill.Fencing         = "3";
    ch.skill.Sailing         = "4";
    ch.skill.Accuracy         = "9";
    ch.skill.Cannons         = "5";
    ch.skill.Grappling         = "5";
    ch.skill.Repair         = "6";
    ch.skill.Defence         = "8";
    ch.skill.Commerce         = "7";
    ch.skill.Sneak             = "8";
    ch.perks.list.BasicDefense             = true;
    ch.perks.list.AdvancedDefense         = true;
    ch.perks.list.Toughness             = true;
    ch.perks.list.CriticalHit             = true;
    ch.perks.list.FastReload             = true;
    ch.perks.list.BasicBattleState         = true;
    ch.perks.list.AdvancedBattleState    = true;
    ch.perks.list.ShipSpeedUp            = true;
    ch.perks.list.ShipTurnRateUp        = true;
    ch.perks.list.StormProfessional        = true;
    ch.perks.list.SharedExperience         = true;
    ch.perks.list.BasicCommerce            = true;
    ch.perks.list.AdvancedCommerce        = true;
    ch.perks.list.Trustworthy            = true;
    ch.perks.list.BasicLandOwner        = true;
    TakenItems(ch, "blade23+3", 1);
    TakenItems(ch, "pistol9+3", 1);
    TakenItems(ch, "ammopouch", 1);
    TakenItems(ch, "powderflask", 1);
    TakenItems(ch, "GoldArmor", 1);
    TakenItems(ch, "potion2", 5);
    TakenItems(ch, "potion3", 5);
            
    if (ENABLE_AMMOMOD)
    {
        TakenItems(ch, "gunpowder", 12);
        TakenItems(ch, "pistolbullets", 12);
    }
    
    LAi_SetMerchantType(ch);
    LAi_SetHP(ch, 330.0, 330.0);
    ch.HPBonus = 220;
    LAi_group_MoveCharacter(ch, "ENGLAND_CITIZENS");
    n = n + 1;<!--c2--></div><!--ec2-->

The way you create your character is not really important, what's important is those 2 line but I will explain it more later:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->ch.Dialog.Filename         = "00_Arthur_Wellington_Dialog.c";
LAi_SetMerchantType(ch);<!--c2--></div><!--ec2-->
To be able to set a merchant so it sell specific items you got to specify those items, so that they always show in the trade. To do so you got to open the quests_reaction.c file and open a case and in that case specify witch items need to be always there, like this:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->case "Arthur_Wellington_Shop":
            PChar.AlwaysShowItems.SpyGlass3 = true;
            PChar.AlwaysShowItems.AmmoPouch = true;
            PChar.AlwaysShowItems.PowderFlask = true;
            PChar.AlwaysShowItems.CommonArmor = true;
            PChar.AlwaysShowItems.Blade14 = true;
            PChar.AlwaysShowItems.Blade16 = true;
            PChar.AlwaysShowItems.Blade17 = true;
            PChar.AlwaysShowItems.Blade19 = true;
            PChar.AlwaysShowItems.Blade20 = true;
            PChar.AlwaysShowItems.Blade22 = true;
            PChar.AlwaysShowItems.Blade25 = true;
            PChar.AlwaysShowItems.Pistol1 = true;
            PChar.AlwaysShowItems.Pistol2 = true;
            PChar.AlwaysShowItems.Pistol3 = true;
            PChar.AlwaysShowItems.Pistol4 = true;
            PChar.AlwaysShowItems.Pistol5 = true;
            PChar.AlwaysShowItems.Pistol6 = true;
            PChar.AlwaysShowItems.Pistol7 = true;
            PChar.AlwaysShowItems.Pistol8 = true;
            PChar.AlwaysShowItems.Pistol9 = true;
            PChar.AlwaysShowItems.PistolMtoon = true;
            PChar.AlwaysShowItems.PistolMket = true;
        break;<!--c2--></div><!--ec2-->

<-- This tell the game to always show that specific item. This will not add the item to the merchant, to do so you must specify in the Dialog.c file of the merchant witch item he will be selling like this:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->//#include "DIALOGS\Item Trader_dialog.h"
void ProcessDialogEvent()
{
    ref NPChar, PChar, d;
    PChar = GetMainCharacter();
    aref Link, Diag;
    string NPC_Meeting;
    
    DeleteAttribute(&Dialog,"Links");

    makeref(NPChar,CharacterRef);
    makearef(Link, Dialog.Links);
    makeref(d, Dialog);
    makearef(Diag, NPChar.Dialog);
    
    string iDay, iMonth;
    iDay = environment.date.day;
    iMonth = environment.date.month;
    string lastspeak_date = iday + " " + iMonth;
    if(!CheckAttribute(NPChar, "quest.item_date")) NPChar.quest.item_date = NPChar.quest.meeting;
    
    switch(Dialog.CurrentNode)
    {
        // -----------------------------------Äèàëîã ïåðâûé - ïåðâàÿ âñòðå÷à
        case "exit":
            Diag.CurrentNode = Diag.TempNode;
            NPChar.quest.meeting = NPC_Meeting;
            DialogExit();
        break;
        
        case "Trading":
            NPChar.ItemTrade.TradeType = IT_TYPE_SNEAKY;
            if (!CheckAttribute(npchar, "quest.item_date") || NPChar.Quest.Item_Date != LastSpeak_Date)
                {
                    GiveItemToTrader(NPChar);
                    TakeNItems(NPChar,"spyglass3", Rand(1)+1));
                    TakeNItems(NPChar,"ammopouch", Rand(1)+1));
                    TakeNItems(NPChar,"powderflask", Rand(1)+1));
                    TakeNItems(NPChar,"commonarmor", Rand(6)+1));
                    TakeNItems(NPChar,"gunpowder", Rand(12)+4));
                    TakeNItems(NPChar,"pistolbullets", Rand(12)+4));
                    TakeNItems(NPChar,"pistolgrapes", Rand(12)+4));
                    TakeNItems(NPChar,"blade14", Rand(4)+1);
                    TakeNItems(NPChar,"blade16", Rand(4)+1);
                    TakeNItems(NPChar,"blade17", Rand(4)+1);
                    TakeNItems(NPChar,"blade19", Rand(4)+1);
                    TakeNItems(NPChar,"blade20", Rand(4)+1);
                    TakeNItems(NPChar,"blade22", Rand(4)+1);
                    TakeNItems(NPChar,"blade25", Rand(4)+1);
                    TakeNItems(NPChar,"pistol1", Rand(4)+1);
                    TakeNItems(NPChar,"pistol2", Rand(4)+1);
                    TakeNItems(NPChar,"pistol3", Rand(4)+1);
                    TakeNItems(NPChar,"pistol4", Rand(4)+1);
                    TakeNItems(NPChar,"pistol5", Rand(4)+1);
                    TakeNItems(NPChar,"pistol6", Rand(4)+1);
                    TakeNItems(NPChar,"pistol7", Rand(4)+1);
                    TakeNItems(NPChar,"pistol8", Rand(4)+1);
                    TakeNItems(NPChar,"pistol9", Rand(4)+1);
                    TakeNItems(NPChar,"pistolmtoon", Rand(2)+1);
                    TakeNItems(NPChar,"pistolmket", Rand(2)+1);
                    NPChar.Quest.Item_Date = LastSpeak_Date;
                }
            Diag.CurrentNode = Diag.TempNode;
            DialogExit();
            LaunchItemsTrade(NPChar);
        break;
        
        case "First time":
            Dialog.defAni = "dialog_stay2";
            Dialog.defCam = "2";
            Dialog.defLinkAni = "dialog_1";
            Dialog.defLinkCam = "1";
            Dialog.ani = "dialog_stay2";
            Dialog.cam = "1";

            d.Text = DLG_TEXT[0];
            Link.l1 = DLG_TEXT[1];
            Link.l1.go = "Trading";                        
            Link.l2 = DLG_TEXT[2];
            Link.l2.go = "exit";                        

        break;
    }
}<!--c2--></div><!--ec2-->

If you look at the <i>case "Trading":</i> it is where I specify witch item I want the merchant to sell. As you notice both files(quests_reaction.c and 00_Item_Trader_Dialog.c)got the same items except the gunpowder and bullets they are not specify as always show in the quests_reaction.c file, I'll explain it later why.

Now let me explain the:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->TakeNItems(NPChar,"pistol9", Rand(4)+1);<!--c2--></div><!--ec2-->
This give the merchant the pistol9 and tell the merchant to sell up to 4 of them +1. So the merchant will sell the amount of pistol9 from 0 to 4 and will add 1 more so 0-4+1.


Now that the items are set so they always show and that we specify the merchant witch item to sell we are ready to go right, <b>WRONG</b>. We got to use a command to tell the game to start the case in the quests_reaction.c so they actually always show those items that we give to the merchant.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->AddDialogExitQuest("Arthur_Wellington_Shop");<!--c2--></div><!--ec2-->
To do so you got to use another character and put that command to him, I use Rys Bloom for my merchant since he his the one that introduce the merchant to you, so in Rys Bloom_dialog.c file I put the code in:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->case "Exit_Hire":
            SetQuestHeader("Bloom");
            AddQuestRecord("Bloom", "1");
            AddDialogExitQuest("Arthur_Wellington_Shop");
            NPChar.Quest.Help = "Told_About_Arthur_Wellington";
            Diag.CurrentNode = "Node_1";
            DialogExit();
        break;<!--c2--></div><!--ec2-->

As soon you exit the dialog with Rys, the game will execute the case "Arthur_Wellington_Shop": in the quests_reaction.c file. Then when you go and see the merchant he will sell what you give him. I try to put that command to the merchant directly but for some reason it doesn't work, maybe because the merchant has to open the trading window avoiding to exit the dialog correctly, if you want to command to work correctly you must make sure that you exit the dialog correctly that's the reason i use Rys for the command.

Remember the:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->ch.Dialog.Filename         = "00_Arthur_Wellington_Dialog.c";
LAi_SetMerchantType(ch);<!--c2--></div><!--ec2-->
Well the ch.Dialog.Filename is the file that the character will use for it's dialog, so once you create your character make sure the dialog.c file you create for your merchant match this one.
For the LAi_SetMerchantType(ch); it tell the merchant how to act, merchant never move so it won't move, when you get close to the character you will hear him yelling to the public, so they see what it sale. A common phrase will be: <i>Please come around, we got it all.</i>

If you want your merchant to sell only those items remove the <i>GiveItemToTrader(NPChar);</i> this command give random items to the merchant according to your rank(level), for me, I leave it there because I wanted my merchant to sell regular stuff, then later he sell regular stuff + the one I specify.

For the gunpowder and bullets, I don't see the reason to set them as always show since your main character most of the time always have them.

I think I cover pretty much everything, if you guys got question please feel free to ask.

P.S: Also I'm still testing and this is not the perfect script yet for now it work fine but I didn't extend the testing on it.


<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
You can also have the quest case executed in a different way, such as having it executed when you first enter the location:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        //Arthur Wellington Shop
        PChar.quest.Arthur_Wellington_Shop.win_condition.l1 = "location";
        PChar.quest.Arthur_Wellington_Shop.win_condition.l1.character = PChar.id;
        PChar.quest.Arthur_Wellington_Shop.win_condition.l1.location = "Redmond_Port";
        PChar.quest.Arthur_Wellington_Shop.win_condition = "Arthur_Wellington_Shop";
        //Bartolomeu<!--c2--></div><!--ec2-->
Or you can just add the <i>PChar.AlwaysShowItems</i> lines into the trader's dialog itself right before the <i>GiveItemToTrader(NPChar);</i> line.
One problem you would have with this code is that the <i>AlwaysShowItems</i> will now apply to <i>all</i> traders, so perhaps you should also add some code to remove those lines again after the trade and reinstate them next time.
 
Good work here! I have a few comments though :

- you don't need to add a new case in quest reaction.c, you can add your code directly in the dialog file, like this :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> case "Trading":
            NPChar.ItemTrade.TradeType = IT_TYPE_SNEAKY;
            if (!CheckAttribute(npchar, "quest.item_date") || NPChar.Quest.Item_Date != LastSpeak_Date)
                {
                    GiveItemToTrader(NPChar);
                    TakeNItems(NPChar,"spyglass3", Rand(1)+1));
                    TakeNItems(NPChar,"ammopouch", Rand(1)+1));
                    TakeNItems(NPChar,"powderflask", Rand(1)+1));
                    TakeNItems(NPChar,"gunpowder", Rand(12)+4));
                    TakeNItems(NPChar,"pistolbullets", Rand(12)+4));
                    TakeNItems(NPChar,"pistolgrapes", Rand(12)+4));
                    TakeNItems(NPChar,"pistolmtoon", Rand(2)+1);
                    TakeNItems(NPChar,"pistolmket", Rand(2)+1);
                    PChar.Quest.Item_Date = LastSpeak_Date;
                    PChar.AlwaysShowItems.SpyGlass3 = true;
                    PChar.AlwaysShowItems.AmmoPouch = true;
                    PChar.AlwaysShowItems.PowderFlask = true;
                    PChar.AlwaysShowItems.PistolMtoon = true;
                    PChar.AlwaysShowItems.PistolMket = true;
                }
            Diag.CurrentNode = Diag.TempNode;
            DialogExit();
            LaunchItemsTrade(NPChar);
            break;<!--c2--></div><!--ec2-->

- In case of the buy-a-spyglass2 tutorial quest, after that event this sentence is used :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->DeleteAttribute(PChar,"alwaysshowitems.SpyGlass2");<!--c2--></div><!--ec2-->Shouldn't this be used at some moment in your code as well?...


EDIT : woops, apparently Pieter was faster than me... and said exactly the same thing
 
Thanks, a simple virtual sailor. You said it clearer than I did. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
Thx both of you, when I get a chance I will check those thing and let you guy know about it later. <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />



<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<!--quoteo(post=246727:date=Mar 24 2008, 05:52 AM:name=a simple virtual sailor)--><div class='quotetop'>QUOTE (a simple virtual sailor @ Mar 24 2008, 05:52 AM) <a href="index.php?act=findpost&pid=246727"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Good work here! I have a few comments though :

- you don't need to add a new case in quest reaction.c, you can add your code directly in the dialog file, like this :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> case "Trading":
            NPChar.ItemTrade.TradeType = IT_TYPE_SNEAKY;
            if (!CheckAttribute(npchar, "quest.item_date") || NPChar.Quest.Item_Date != LastSpeak_Date)
                {
                    GiveItemToTrader(NPChar);
                    TakeNItems(NPChar,"spyglass3", Rand(1)+1));
                    TakeNItems(NPChar,"ammopouch", Rand(1)+1));
                    TakeNItems(NPChar,"powderflask", Rand(1)+1));
                    TakeNItems(NPChar,"gunpowder", Rand(12)+4));
                    TakeNItems(NPChar,"pistolbullets", Rand(12)+4));
                    TakeNItems(NPChar,"pistolgrapes", Rand(12)+4));
                    TakeNItems(NPChar,"pistolmtoon", Rand(2)+1);
                    TakeNItems(NPChar,"pistolmket", Rand(2)+1);
                    PChar.Quest.Item_Date = LastSpeak_Date;
                    PChar.AlwaysShowItems.SpyGlass3 = true;
                    PChar.AlwaysShowItems.AmmoPouch = true;
                    PChar.AlwaysShowItems.PowderFlask = true;
                    PChar.AlwaysShowItems.PistolMtoon = true;
                    PChar.AlwaysShowItems.PistolMket = true;
                }
            Diag.CurrentNode = Diag.TempNode;
            DialogExit();
            LaunchItemsTrade(NPChar);
            break;<!--c2--></div><!--ec2-->

- In case of the buy-a-spyglass2 tutorial quest, after that event this sentence is used :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->DeleteAttribute(PChar,"alwaysshowitems.SpyGlass2");<!--c2--></div><!--ec2-->Shouldn't this be used at some moment in your code as well?...


EDIT : woops, apparently Pieter was faster than me... and said exactly the same thing<!--QuoteEnd--></div><!--QuoteEEnd-->

1 question, if I put it in the dialog file as you mention, will the other merchant be affected as well as they were in the quests_reaction.c file?


<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Yes, because all you do is add the attribute to the player. Doesn't matter WHERE you do that; it'll be used by all merchants. So you should remove it again when closing the interface somehow. <img src="style_emoticons/<#EMO_DIR#>/icon_confused.gif" style="vertical-align:middle" emoid=":?" border="0" alt="icon_confused.gif" />
 
Is posible to make somethink like this in .c???
1. Add Items for trade
2. Always show = true
3. Open Shop
4. wait 30 sec....
5. Always show = false...

I did some thinks in other games and programing with wait function ... But I don't know is this posible in PotC...
 
It IS posisble. You need a quest delay kind of thing for that. I'd personally try to just put the <i>Always show = false</i> in the item trade interface's exit code though. Might be simpler.
 
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->case "Trading":
            NPChar.ItemTrade.TradeType = IT_TYPE_SNEAKY;
            if (!CheckAttribute(npchar, "quest.item_date") || NPChar.Quest.Item_Date != LastSpeak_Date)
                {
                    GiveItemToTrader(NPChar);
                    TakeNItems(NPChar,"spyglass3", Rand(1)+1));
                    TakeNItems(NPChar,"ammopouch", Rand(1)+1));
                    TakeNItems(NPChar,"powderflask", Rand(1)+1));
                    TakeNItems(NPChar,"gunpowder", Rand(12)+4));
                    TakeNItems(NPChar,"pistolbullets", Rand(12)+4));
                    TakeNItems(NPChar,"pistolgrapes", Rand(12)+4));
                    TakeNItems(NPChar,"pistolmtoon", Rand(2)+1);
                    TakeNItems(NPChar,"pistolmket", Rand(2)+1);
                    PChar.Quest.Item_Date = LastSpeak_Date;
                    PChar.AlwaysShowItems.SpyGlass3 = true;
                    PChar.AlwaysShowItems.AmmoPouch = true;
                    PChar.AlwaysShowItems.PowderFlask = true;
                    PChar.AlwaysShowItems.PistolMtoon = true;
                    PChar.AlwaysShowItems.PistolMket = true;
                }
            Diag.CurrentNode = Diag.TempNode;
            DialogExit();
            LaunchItemsTrade(NPChar);
            break;<!--c2--></div><!--ec2-->
I tried this one, and it works... and there is now problem with always show if that will be only merchant who will sell those items... I think... <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
<!--quoteo(post=246763:date=Mar 24 2008, 08:56 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Mar 24 2008, 08:56 AM) <a href="index.php?act=findpost&pid=246763"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Yes, because all you do is add the attribute to the player. Doesn't matter WHERE you do that; it'll be used by all merchants. So you should remove it again when closing the interface somehow. <img src="style_emoticons/<#EMO_DIR#>/icon_confused.gif" style="vertical-align:middle" emoid=":?" border="0" alt="icon_confused.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

And me I want the merchant to sell those items for the rest of the game, that doesn't help it. <img src="style_emoticons/<#EMO_DIR#>/icon_confused.gif" style="vertical-align:middle" emoid=":?" border="0" alt="icon_confused.gif" />

I look at the other merchant in Build 13 and none except the Item Trader_dialog.c, that as any given items. The
Item Trader_dialog.c however, contain 1 item that as been given to the merchant, the SpyGlass2. Then shortly after the command <i>DeleteAttribute(PChar,"alwaysshowitems.SpyGlass2");</i> to remove it.

What effect, that <i>case</i> do, to the other merchant exactly? <img src="style_emoticons/<#EMO_DIR#>/glare.gif" style="vertical-align:middle" emoid=":glare:" border="0" alt="glare.gif" />

As for me I don't see what could cause problem. I know that the command <i>GiveItemToTrader(NPChar);</i> give random items to the merchant and maybe it will cause problem if the merchant receive one of the item that I put in my <i>case</i>, then the item will probably be <i>AlwaysShow</i> from that point. <img src="style_emoticons/<#EMO_DIR#>/thumbsdown.gif" style="vertical-align:middle" emoid=":2dn" border="0" alt="thumbsdown.gif" /> Anyone can clarify this please?



<b>Cheers,</b> <img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Back
Top