Home > Tutorials > Creating a Custom Merchant for The Player’s Camp – Part 1

Creating a Custom Merchant for The Player’s Camp – Part 1

I thought it would be fun to take a look at something a bit more complex and useful.  This is going to actually be a multi-part tutorial, and will be lots of fun!

In this tutorial series we are going to add a new NPC merchant to the player’s camp, and then populate that merchant with items including custom items.  As with other tutorials, this module is designed to extend the Single Player campaign, and shows you some more ways you can hook into that campaign.

This tutorial is a bit more advanced from the basics and does involve creating a 2da file.  If you have done A Start: Creating a Module to Give Your Player an Item then I firmly believe you can do this tutorial, but it will be important to follow along closely. If you have not followed that first tutorial, then please start there.

So where do we start?  This is going to require a bit more work to do than just plopping a new item into our inventory so let’s get started.  In this first part, we will:

  1. Create a new module that extends single player.  You should already know how to do this.
  2. Create a new Creature which will be the NPC that will serve as our merchant
  3. Write a small script that will spawn the NPC into the player’s camp
  4. Create a small 2da file, known as a PRCSCR file, that will allow us to “hook into” the single player campaign

If you’ve followed that first tutorial mentioned earlier, then you already know how to create a module that extends single player.  Remember that there are two steps to the process.  First, when you create the module you need to set the property “Extended Module” to Single Player, then OPEN the module.  Once it is open you need to go BACK to the Manage Modules window and use the HIERARCHY button and check off Single Player.

Also, in reference to this article, we want to remove our module’s “core script” to prevent problems.  To do this, simply open the module properties and for the Script property, click the 3 dots to open the file chooser then select “(none)”.

Create a New Creature to Serve as our NPC Merchant

Creating a merchant actually involves several pieces, and the first is we need an NPC to interact with.  To do that we will create a new Creature resource.  Click Creatures on the palette, then down below right click and create a new creature.  Or you can do File -> New -> Creature.  Give the resource a proper tag, put it in whatever folder you want, and like when we did items, you want the Module to be Core Game Resources, and Owner Module to be your module.  The image below is from when we made the item, but its exactly the same, so i’m putting it here as a refresher.

84740a28b022ec3a7570334918337883

Creatures have a lot of properties, but for this we won’t need to worry about many of them.  You can skip right down to Gender and choose whichever you want.  In my case, its Female.  Right below that is Group and we want to make sure this is set to _Neutral.  This is important, and by setting it to _Neutral we make sure our merchant won’t attack us, OR help in any fights.

9de9aa5c1c4099307725d0ffe55e455c

Next is Inventory.  Right now you’ve probably noticed that our creature is naked.  You probably don’t want to leave it this way, so click the 3 dots on Inventory to open a window that lets us place items into the creatures inventory.  First you are going to want to resize this window to make it wider.  This will make it a lot easier to work with.  On the left open up _Global and you will find clothing and armor in here.  Choose whatever you want.  I went into _Global -> Clothing -> Noble -> Human Female and gave her a nice robe.  Click to select the item you want to add, then click the ADD button.  Now over on the right, if you have expanded the window, you will see “Slot” which is currently set to “Not Equipped”.  Click on this and you can change it to the appropriate slot for the item.  In my case, “Chest”.  This will equip the item on your creature.  Once you’ve equipped everything you want, click OK and your creature should now be wearing the items.

21bd4e9a71e49242a3ea43d82b639527

Continuing on down, give your creature a Name and then skip down to the Appearance section.  In this section you can set the Race, though I left it as Human.  If you change this you might have to go back and choose new clothes.  The next thing you want is to give your new creature a more please Head Morph.  Click the 3 dots to open a file browser and try a few until you find one you like.

The very last thing we need to worry about is all the way at the bottom called Plot.  We want to set this to be “True”.  This means the creature is important to the plot and can’t be harmed or killed.  So we’ll always know our merchant is around.

That does it for the creature, so go ahead and save and check in.

Writing a Script to Spawn our NPC

Now that we have our NPC created, we need a way to get him or her into the world.  In order to do this, we need to create a script that will spawn the NPC at a specific location, after checking to see if the NPC is already there.  So go ahead and create a new script.  For this one both module properties should be your module.

#include “wrappers_h”
void main()
{
// The first thing we want to do, before anything, is look around and see
// if we have already spawned this merchant
object oPlayer = GetMainControlled();
DisplayFloatyMessage(oPlayer, “tut_merchant_spawn”, FLOATY_MESSAGE, 16777215, 20.0);
object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jwv_t_creature1”);
if (!IsObjectValid(oMerchant))
{
// If we get to this code, it means the merchant has not been placed yet
// So let’s do that
// get an object pointer to the party camp area
object oArea = GetObjectByTag(“cam100ar_camp_plains”);
// create a location for where our merchant NPC will be placed
location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
// Spawn the NPC
CreateObject(OBJECT_TYPE_CREATURE, R”jwv_t_creature1.utc”, lMerchantLocation);
}
}

What this script will do is first search the area around the player to see if the NPC has already been spawned. If the function returns an invalid object, then we know that nothing was found, so we then create a location object which stores the x,y,z position and angle of where we want the npc, and then spawn the npc. The call to “GetObjectByTag(“cam100ar_camp_plains”)” is to get an object handle to the player camp.

Now you might ask, “John? How did you know what numbers to punch in there for the location?” and it would be a fair question.  I didn’t just pull them out of The Fade.  Let’s take an aside on talk about how I did that.

I knew I needed to provide a location to spawn the NPC but I had know way of loading the player camp up into the editor to find coordinates.  So what I did was write myself a small debug script.  I named this script “ShowLocation” and you can see it below:

#include “utility_h”
void main()
{
object oPC = GetHero();

location lLoc = GetLocation(oPC);
vector vPos = GetPositionFromLocation(lLoc);
vector vOrientation = GetOrientationFromLocation(lLoc);
float fAngle = GetFacing(oPC);

DisplayFloatyMessage(oPC, VectorToString(vPos), FLOATY_MESSAGE, 16777215, 20.0);
DisplayFloatyMessage(oPC, “————–“, FLOATY_MESSAGE, 16777215, 20.0);
DisplayFloatyMessage(oPC, FloatToString(fAngle), FLOATY_MESSAGE, 16777215, 20.0);
}

Create the script, save it, check it in, then export it. It is small and to the point.  It just grabs an object pointer to the player, then gets his position and angle, then prints it out.  To use it you need to enable the developer console.  If you haven’t done this yet you should.  Create yourself a new shortcut to the game, make the shortcut to the daorigins.exe file, then right click that file and open the Properties.  In the target field, go to th every end of whats there, past the quotes, then insert ” -enabledeveloperconsole” (without the quotes, see screenshot).  This enables the developer console.

567b61a702ef2c802769ec32303926b8

Then run the game with that shortcut, and when in the game press the tilde (~/`) key on your keyboard to open the console.  NOTE: for some reason on my game the console is invisible!  So I have to just type blindly.  I don’t know what causes this or if it will do the same to you.

Once you have the console open just type “runscript showlocation” to run the debug script.  So go stand where you want the NPC to be, face the direction you want, then run that  and then copy down the numbers it gives you.  Once you have the numbers, plug them into the script above for the location and angle.

Creating the PRCSCR File

Now we have the creature, and we have a script to spawn it, but currently there is nothing telling that script to actually run.  You can’t just make a script and expect it to do anything unless that script is tied into the game in some way.  When we created the item, we assigned our script to be the “module_core” script, so the game new to run the script for module events.  In this case though, how does the game know to run it?  This is where the PRCSCR file comes in.  I have no idea what that is supposed to stand for, but essentially this is a 2DA file that allows us to tell the game to run a certain script when a certain area is loaded.

Since this is a 2da file, we start by creating an Excel spreadsheet, so fire up Excel.  NOTE: This did not work for me in OpenOffice for some reason, so use Excel.  OpenOffice apparently doesn’t save .xls files quite right and some 2da files will work and some won’t.

If you are not familiar with creating 2DA files, then please take a moment and first read the tutorial I wrote on them: 2DA or not 2DA – Overriding 2DA Files. That tutorial contains important information on how 2DA files work, how to make them and how to export them.

The file is very simple, and we only need three pieces of information.  An ID, an AreaListName, and a Script.  You want to make the ID something that will hopefully be UNIQUE to you.  This is technically impossible, but if you use some sort of pattern you can make it more likely.  What I do is convert the first three letters of my nickname into numbers, then add two 0’s, then start with 01.  So for me my ID is 1710001.  Here is my worksheet:

bc731569c7c0bcbdfd02e726d3a6e64c

What this says is essentially “Whenever the area cam100ar_camp_plains is loaded, run the script tut_merchant_spawn”.  You will need to make the script name match yours.  Once you have created the file, compile it into a .GDA file and place it in: Documents\Bioware\Dragon Age\AddIns\<your add in name>\core\override

The placement of the file is important.

Exporting Everything and Testing

At this point we’re done!  Make sure everything is saved, checked in, and exported without dependent resources.  Then generate your module and manifest xml files.  Lastly as mentioned in this article, go into your Dragon Age\Core\Override\Toolsetexport directory and delete everything. all the exports we need are in our module’s addin directory.

Now load up the game, and head to your camp.  Note that there are actually a few versions of your party camp.  This will only spawn at the “basic” camp.  What I mean by that is it won’t spawn in any camp that includes cutscenes or combat or anything.  For example, the very first time you visit your camp it starts with a cutscene.  The merchant will not appear there, as the script won’t run.  Just exit the camp, travel somewhere, then come back to the camp.

Included in our spawn script is a DisplayFloatyMessage which is a good way of debugging.  This will cause text to float up above your character when the script runs.

Advertisements
Categories: Tutorials
  1. dan_upright
    November 15, 2009 at 11:00 pm

    Nice one, I was just about to start trying to work this out myself =]

    I’d noticed that openoffice xls files are sometimes iffy, though you can compile one of the toolset xls files and then edit the gda in the toolset – that’s what I’ve been doing anyway, since I don’t have excel.

    Thanks again for the tutorials and keep up the good work.

  2. Happy-i-am
    November 15, 2009 at 11:06 pm

    I can’t get the show location to work. Debug mode is enabled, I copyed the script and have it named the same as yours.

    • John Vanderbeck
      November 15, 2009 at 11:16 pm

      Are you having the same problem I had, with the console being invisible? If so, just type slowly to make sure you don’t mistype. Also make sure you’ve exported the script.

  3. Happy-i-am
    November 15, 2009 at 11:22 pm

    Yeah its invisible. i’m typeing it pretty slow and correct, just doesnt seem to work. could it be that the script wont work with an steam version?

    I have the same script name as yours.
    Same script.
    Exported.

    typeing runscript showlocation

    Tryed checked in and out

    can’t think of anything else to try, unless you did an builder to builder build for me? lol.

  4. Sinistral
    November 16, 2009 at 12:42 am

    Are you sure it is enabled? Generally when you activate it (default is grave key) this onscreen worthless keyboard pops up out of nowhere when you type the letter r.

    Do you see that?

    • John Vanderbeck
      November 16, 2009 at 12:47 am

      I’m sure its enabled because if I blindly enter the commands it works 🙂 But no, I see absolutely no change when I enable it, or when I type.

  5. Sinistral
    November 16, 2009 at 12:58 am

    Maybe it’s just me then. The console itself is invisible but anytime I press the letter R this creepy debug keyboard pops on my screen like OHAI U DEV?

    >.>

  6. ExplosiveCoot
    November 16, 2009 at 5:05 am

    I also have the invisible console issue, where a phantom keyboard pops up when you press r, it’s very frustrating.

    Even more frustrating is the fact that OpenOffice doesn’t seem to work to create valid 2DAs. I was able to spawn the merchant using runscript from the console, but the PRCSCR.2DA failed. I tried to create it from scratch, in which case ExcelProcessor reports success but doesn’t seem to actually do anything, and also tried editing another 2DA.xls file in which case it seems to get turned into a valid .GDA file, but the script doesn’t execute.

    I have been able to use OpenOffice to alter and then process some of the 2DA.xls files (CLA_base.xls in particular), but I’m wondering if the problem comes with changing the column headings, since every time I’ve tried this I haven’t been able to get the .GDA to work. Going to install Excel tomorrow and see if I have better luck with that.

    Excellent work again on another fine tutorial, keep up the good work!

    • ExplosiveCoot
      November 16, 2009 at 6:49 pm

      A follow-up note just in case anyone doesn’t have Excel, you CAN use OpenOffice to create a PRCSCR.2da that works properly, however for it to work you have to copy an existing 2DA file and then edit it as appropriate.

      Step-by-step, here’s how to make this work for this tutorial:

      1: Make a copy of 2DA_base.xls
      2: Delete the second spreadsheet page (the tabs along the bottom of the window)
      3: Rename the first spreadsheet page to PRCSCR_merchtutorial
      4: Delete column “D”
      5: Delete all rows after row 2 (not including row 2)
      6: Change rows 1 and 2 to match the information in the tutorial (don’t delete, just edit them.)
      7: Add the information from row 3 in the tutorial to your row 3, changing tut_merchant_spawn to the name of your script if necessary.
      8: Save the file as PRCSCR_merchtutorial.xls and make sure to save it in Excel 97/2000/XP format.
      9: Now you’re ready to process this file with ExcelProcessor and put it in the directory as shown in the tutorial.

      Hope this helps someone out; thanks a lot for the excellent tutorials!

      • Yite
        December 19, 2009 at 10:23 am

        google docs and file download as excel does the trick as well

        =Yite

  7. BeheretiK
    November 16, 2009 at 8:15 am

    To all the people having the keyboard pop up when they start typing after opening the console – the way around it is:

    1) Open console (grave key by default)
    2) Instead of starting to type runscript, do a space first
    3) Now do the runscript {command}

  8. Slayn
    November 16, 2009 at 8:30 am

    ShowLocation script don’t work. Console is working, I tried some cheats and worked.

    How to export? Export–> Export without dependence resources?

    • Slayn
      November 16, 2009 at 12:06 pm

      aw… don’t work 😦
      What name you gave to your .gda file?

      Script name = tut_merchant_spawn, right?
      NPC name = jwv_t_creature1.utc ?
      GDA filename = ????
      Module name = ????
      —-
      I tried this:

      Module name = merchant
      NPC name = palove.utc
      Script name = merchantscript.nss

      I put the .gda file in the folder \Documents\BioWare\Dragon Age\AddIns\merchant\core\override

      My script:

      #include “wrappers_h”
      void main()
      {
      // The first thing we want to do, before anything, is look around and see
      // if we have already spawned this merchant
      object oPlayer = GetMainControlled();
      DisplayFloatyMessage(oPlayer, “merchant”, FLOATY_MESSAGE, 16777215, 20.0);
      object oMerchant = UT_GetNearestObjectByTag(oPlayer, “palove″);
      if (!IsObjectValid(oMerchant))
      {
      // If we get to this code, it means the merchant has not been placed yet
      // So let’s do that
      // get an object pointer to the party camp area
      object oArea = GetObjectByTag(“cam100ar_camp_plains”);
      // create a location for where our merchant NPC will be placed
      location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
      // Spawn the NPC
      CreateObject(OBJECT_TYPE_CREATURE, R”palove.utc”, lMerchantLocation);
      }
      }

      Help me pls.

  9. John Vanderbeck
    November 16, 2009 at 12:08 pm

    The GDA filename can be anything as long as it starts with “PRCSCR_”

  10. John Vanderbeck
    November 16, 2009 at 12:11 pm

    For those having a problem running the showlocation debug script, I really don’t know what to say, other than double check everything make sure you’re not spelling something wrong. Also in general if a script isn’t working right, try typing it out by hand rather than copy/paste. When you compile the script always look at the console for any errors.

    • william
      October 17, 2010 at 8:23 am

      Hey John I love your tutorials but I’ve tried copying and pasting, typing it all out by had to death. The debug script for showing location keeps on getting the same error for me.E: 08:07:26 – odinmerch_mod.nss – odinmerch_mod.nss(6): Parsing variable list

      I would to keep going with the making a merchant thanks for any help you can provide.

  11. zpeterson1
    November 16, 2009 at 1:09 pm

    Does the Create New Merchant function not work for this. Couldn’t we follow all the instructions laid out in this tutorial except instead of creating a new creature we created a new mercahnt. All of the other instructions sound great. The create merchant function makes it incredibly easy to setup exactly what inventory you want them to sell even including any custom items you had made. You can even restrict what items they can and cannot sell as well as mess around with the mark up and mark down percentages. Of course maybe I am just getting ahead of myself and Create New Merchant is used after you have created the Merchant Creature. Once again your help with the C++ scripting involved is much appreciated

    • John Vanderbeck
      November 16, 2009 at 1:34 pm

      Yeah you’re getting ahead 🙂 MERCHANT resources aren’t physical items you can interact with, so we need the NPC CREATURE first, then we’ll be creating a MERCHANT later and tying it into the CREATURE

  12. Slayn
    November 16, 2009 at 1:55 pm

    yay!!! Work now!!!
    Waiting for part 2.
    Thanks.

  13. Sinistral
    November 16, 2009 at 2:10 pm

    I don’t know if it is just me, but copy pasting quotation marks causes the script to not compile because it treats it as a value rather than an identifier. To fix it, simply overwrite it with a new quotation mark.

  14. NewYears1978
    November 16, 2009 at 3:23 pm

    All was fine until I got to making the .xls file. When I try to use ExcelProcessor I keep getting this error:

    ERROR: Cannot process the file D:\XLS\James the Hoarder.xlsx

    Im using Excel to create my file..it keeps saving as xlsx instead of xls..could this be the problem? I don’t see any other valid options to save as though in Excel.

    • John Vanderbeck
      November 16, 2009 at 3:28 pm

      It does sound like its being saved in an incompatible format. You should have some different options if you do Save-As. Not sure what version of Excel you are using, but in mine there is an option for “Excel 97-2003 Workbook” and that works correctly.

      • NewYears1978
        November 16, 2009 at 3:45 pm

        You were right, it worked. Continuing on! Thanks!

  15. NewYears1978
    November 16, 2009 at 3:53 pm

    Can someone explain exporting to me? For instance I just followed this tutorial and now I am ready to export. I previously checked in my script and creature and saved and closed them..Im now on a blank window but have my Mod open..but when I click Export there are no options there..(with or without dependents etc)
    Do I have to export each thing seperately or do I need to have one of the files open to export..etc..

    Does this question make sense?

    • John Vanderbeck
      November 16, 2009 at 4:46 pm

      Exporting was explained in the first tutorial mentioned at the start of this one.

  16. NewYears1978
    November 16, 2009 at 4:28 pm

    Also, it is giving me a script error when I export it says

    “jlp_script_hoarder.nss – jlp_script_hoarder.nss(1):After compound statement at end”

    • SylvrWynd
      February 21, 2010 at 1:03 pm

      You need to replace the ” throughout the script if you copied and pasted. I ran into the same problem and the website uses a different format quotation mark than the compiler can understand. Hope this helps.

  17. NewYears1978
    November 16, 2009 at 4:38 pm

    Bah..manually retyping two of the lines fixed the problem. On to the next steps again.

    • NewYears1978
      November 16, 2009 at 4:43 pm

      Sorry to spam with comments..having many issues. I got the ShowLocation script to work right..but on my spawn script I keep getting the error that on line 18 there is an Unknown state in compiler.

      [quote]
      #include “wrappers_h”
      void main()
      {
      // The first thing we want to do, before anything, is look around and see
      // if we have already spawned this merchant
      object oPlayer = GetMainControlled();
      DisplayFloatyMessage(oPlayer, “tut_merchant_spawn”, FLOATY_MESSAGE, 16777215, 20.0);
      object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jlp_npc_hoarder”);
      if (!IsObjectValid(oMerchant))
      {
      // If we get to this code, it means the merchant has not been placed yet
      // So let’s do that
      // get an object pointer to the party camp area
      object oArea = GetObjectByTag(“cam100ar_camp_plains”);
      // create a location for where our merchant NPC will be placed
      location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
      // Spawn the NPC
      CreateObject(OBJECT_TYPE_CREATURE, R”jlp_npc_hoarder.utc”, 1MerchantLocation);
      }
      }
      [/quote]

      • John Vanderbeck
        November 16, 2009 at 4:45 pm

        CreateObject(OBJECT_TYPE_CREATURE, R”jlp_npc_hoarder.utc”, 1MerchantLocation);

        That should be lMerchantLocation (as in lowercase L) not 1MerchantLocation.

      • NewYears1978
        November 16, 2009 at 5:02 pm

        Oh boy..what a stupid mistake..course that just led to another error.

        Variable defined without type (for line 7)

        Coding is so fun..this is why I am trying to learn..but doesn’t help that I only know HTML and CSS and no C++ or anything similar 🙂

  18. NewYears1978
    November 16, 2009 at 5:53 pm

    Finally got it all working..but NPC is not there.. 😦

  19. Newyears1978
    November 16, 2009 at 6:37 pm

    If anyone would be willing to help me I would appreciate it..I went over the process two times and everything seems correct..but the NPC doesn’t appear..even if I try to force spawn it with runscript..

    ShowLocation works fine.

    Also never could solve this error: Variable defined without type (for line 7)
    which was this line: “DisplayFloatyMessage(oPlayer, “tut_merchant_spawn”, FLOATY_MESSAGE, 16777215, 20.0);”

    • Slayn
      November 16, 2009 at 7:31 pm
      • newyears1978
        November 16, 2009 at 8:58 pm

        I don’t know why but I retyped the whole thing and then it worked…using your image..thanks Slayn. Lets see if it’s actually in game now though 🙂

  20. Caladon
    November 16, 2009 at 6:45 pm

    It Worked Awesome!!! can’t wait for Part 2!!!!!

  21. newyears1978
    November 16, 2009 at 9:01 pm

    It worked, thanks Slayn and thanks John. This tutorial is great, can’t wait for part two.

    I’ve just learned that C++ is very uh…..well I’m sure you know.

    I’ve decided to try to learn it.

  22. John Vanderbeck
    November 16, 2009 at 9:02 pm

    Most likely the problem was bad quotes.

  23. newyears1978
    November 16, 2009 at 9:12 pm

    That, and also I hadn’t exported each file, I missed that part of the other tutorial even though I did read it…woops =) Gotta learn some how.

  24. Lieutenant
    November 16, 2009 at 10:11 pm

    Hmm… how do you add items into the merchant for resale? Also, how do you add permanent items so he never runs out?

    • John Vanderbeck
      November 16, 2009 at 10:16 pm

      We haven’t gotten there yet. Patience grasshopper!

    • Moondog
      November 17, 2009 at 7:27 pm

      Once you place the Merchant object and link it to the Merchant NPC, then access the Merchant inventory there will be a checkbox to set the item’s quantity to “infinite”.

      The Merchant Object is linked to the Merchant NPC through the use of a Conversation object. So for example you have an an NPC with a Tag = I_Sell_Stuff then you would create the Merchant Object and name it store_I_Sell_Stuff.

      But I seem to be getting ahead of the tutorial ;).

      • John Vanderbeck
        November 17, 2009 at 7:31 pm

        Part 3 will cover the merchant part. I promise 🙂

  25. Moondog
    November 16, 2009 at 10:12 pm

    I recently started using the DAO Toolset, and after breaking my game a few times, now am forging ahead and creating a module from scratch. I had, a few years back, done a lot of NWN modding. I had created the Doomchurch module that I had hosted for a while. This site looks like it is a great resource! I have a problem with a merchant I created – he buys everything for 0 coins and sells everthing for 0 coins… I set the markup/markdown to reasonable levels . I must be missing something very obvious. Any suggestions?

  26. newyears1978
    November 16, 2009 at 11:19 pm

    We havn’t gotten to setting up the merchant yet =)

  27. Caladon
    November 17, 2009 at 12:40 am

    This Tutorial hasn’t but I’m sure Tryin! LoL no luck so far but I made my Merch a High Dragon just for Laughs

  28. Caladon
    November 17, 2009 at 12:41 am

    Looks Kewl Gaurding my Camp

  29. newyears1978
    November 17, 2009 at 1:33 am

    I just got the well seen getting 2 pnts on level up instead of one..the only changes I have made is this mod…somethings wrong somewhere..

    • newyears1978
      November 17, 2009 at 1:41 am

      Just to clarify in case someone doesn’t know what I mean.

      When you level up, and increase stat, it should go up +1 when you click arrow..but it’s going up +2

      It is caused from the merchant mod as when I disable it fixes problem…any idea how to correct?

      • Caladon
        November 17, 2009 at 1:48 am

        Author added this to tutorial after others had your issue it is in the first section on creating the module ( Also, in reference to this article, we want to remove our module’s “core script” to prevent problems. To do this, simply open the module properties and for the Script property, click the 3 dots to open the file chooser then select “(none)”. )

      • newyears1978
        November 17, 2009 at 9:03 am

        Yep, I had made that change but I didnt reexport all the files..once I did, it solved the issue. yay 🙂

  30. Caladon
    November 17, 2009 at 1:50 am

    I’m still trying to figger out how to tie in the merchant! JW’s taking too long! LoL

  31. zpeterson1
    November 17, 2009 at 8:03 am

    I am having a problem getting the excelprocessor.exe to compile my created “PRCSCR_” 2da file into a .gda file. I have tried both creating an excel spreadsheet from scratch and editing an existing 2da file that Bioware made. I am saving it in Excel 97-2003 .xls files and when I put the file over the Excelprocessor.exe it goes through the command line window so fast I can’t tell what its doing and it fails to produce any files. The one thing i didn’t try was installing openoffice and trying it with that; i will let you’ll know if that solves the problem. please help. Look forward to part 2 assuming i can get my pc to cooperate with this small step here.

    • Caladon
      November 17, 2009 at 9:23 am

      I had the same problem so I opened a commmand prompt at the folder where my .xls and the ExcelProcessor.exe was and typed “excelprocessor myfilename.xls” no quotes and hit enter and that worked

      • zpeterson1
        November 17, 2009 at 11:35 am

        thanks Caladon that solved it.

    • John Vanderbeck
      November 17, 2009 at 9:31 am

      I had this same problem but it was actually because I was using OpenOffice. When it flashes real quick, then exits that means it ran properly. It actually pauses on any errors. But when I had made the file in OpenOffice, the processor claimed it exported it successfully but no GDA file showed up. I tried it over and over with the same results. I then remade the file in Excel and it processed fine.

  32. Caladon
    November 17, 2009 at 11:40 am

    I was using Excel from the start and could only get the GDA file to show using the method I stated earlier. BTW John your Tutorial is teaching me loads of stuff my merchant mod now has 2 item filled chests standing next to my Dragom Merchant! tho the Merch still is not open for business lol

  33. Newyears1978
    November 17, 2009 at 11:47 am

    Yeah these tuts are great..I have followed many out there but these actually a) didn’t break my game b) worked c) taught me something

    Excited to go further. I’d like to add some placeables next to my merchant..but not sure how to do it (just some crates and such..no usable ones..just for looks)

    • Newyears1978
      November 17, 2009 at 12:08 pm

      Can someone tell me for instance how I could add to my Merchant script to add a crate, say “genip_crate_wd_large_stat” (placeable)..put next to my merchant?

      I tried adding in a createobject like the one for the merchant but using OBJECT_TYPE_PLACEABLE but it didn’t work ( I was only guessing..trying to learn)

  34. Caladon
    November 17, 2009 at 12:11 pm

    Ya i had a lot of issues figuring that out. here is my script

    /—-start script—–/

    #include “wrappers_h”
    void main()
    {
    object oPlayer = GetMainControlled();
    DisplayFloatyMessage(oPlayer, “cdon_addstorage1”, FLOATY_MESSAGE, 16777215, 20.0);
    object oStorage = UT_GetNearestObjectByTag(oPlayer, “cdon_storage_chest1”);
    if (!IsObjectValid(oStorage))
    {
    object oArea = GetObjectByTag(“cam100ar_camp_plains”);
    location lStorageLocation = Location(oArea, Vector(156.819031, 120.765495, -0.969640), 28.556318283);
    CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest1.utp”, lStorageLocation);
    }
    }

    /—–end script—-/

    • Caladon
      November 17, 2009 at 12:14 pm

      of course loc info you need to obtain just like when placing the merchant

      • Newyears1978
        November 17, 2009 at 12:44 pm

        The variables here: lStorageLocation

        Is this something that you make up..or are these set variables you have to learn? If so that would be my problem…I thought those were made up variables you can set to tell locations..?

        And can you not put this in the same script with the merchant? That is what I was trying to do..I have a very similar thing to what you have above except I was trying to make my own variable lCrateLocation..and I added it with the other createobjects..

        So confused =) So can you not just put it in one script?

      • John Vanderbeck
        November 17, 2009 at 12:50 pm

        He defines lStorageLocation here:

        location lStorageLocation = Location(oArea, Vector(156.819031, 120.765495, -0.969640), 28.556318283);

      • Newyears1978
        November 17, 2009 at 12:52 pm

        These are defined, made up variables yes? I tried this above I posted my script…

        I think maybe you can’t add multiple items at once like I am trying..or you can’t add core items this way maybe? (Being a newb and trying to learn is such fun)

      • Caladon
        November 17, 2009 at 1:00 pm

        each object (i.e. chest) you add needs it’s own additemscript and your GDA needs to call each of them

      • Newyears1978
        November 17, 2009 at 1:07 pm

        Okay, but what if I wanted to have like 500 crates behind him..as a storage room (not really..just for example sake)..

        I can’t put them all in one script called Mechant_Crates or something? I wouldn’t want to make 500 different scripts for that? 🙂

      • Caladon
        November 17, 2009 at 1:16 pm

        Silly posting I replied to your earlier post lol

      • John Vanderbeck
        November 17, 2009 at 1:16 pm

        Well you could programmaticly determine the locations from a base location. Once youhave a starting point, and if you need the rough size of the objects you could extrapolate using a loop. Way beyond the current level of tutorials though 🙂 Based on polls the majority of you aren’t really ready for that kind of programming.

      • Newyears1978
        November 17, 2009 at 1:18 pm

        Okay but take that down a notch..what if I just wanted to add one crate behind him..just for decoration..and use core item genip_crate_wd_large_stat..

        Can I not just add that into my existing merchant script..thats what Im trying to determine.

      • John Vanderbeck
        November 17, 2009 at 1:21 pm

        Yes you can do it in the same script, you just need to adjust the location for the new item. you can either define a new location for the new item, or adjust the old one.

      • Caladon
        November 17, 2009 at 1:30 pm

        Would I do it something like this?

        /—-start script—-/

        #include “wrappers_h”
        void main()
        {
        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addstorage1”, FLOATY_MESSAGE, 16777215, 20.0);
        object oStorage = UT_GetNearestObjectByTag(oPlayer, “cdon_storage_chest1”);
        if (!IsObjectValid(oStorage))
        object oStorage = UT_GetNearestObjectByTag(oPlayer, “cdon_storage_chest2”);
        if (!IsObjectValid(oStorage))

        {
        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.819031, 120.765495, -0.969640), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest1.utp”, lStorageLocation);

        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.422180, 111.762978, -1.356835), 140.356826782), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest2.utp”, lStorageLocation);
        }
        }

        /—-end script—-/

      • Newyears1978
        November 17, 2009 at 1:32 pm

        I tried like this..

        #include “wrappers_h”
        void main()
        {
        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “merchant”, FLOATY_MESSAGE, 16777215, 20.0);
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jlp_npc_hoarder”);
        if (!IsObjectValid(oMerchant))
        {
        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lMerchantLocation = Location(oArea, Vector(134.270264, 111.795937, -0.781055), -142.727050781);
        location lCrateLocation = Location(oArea, Vector(132.385178, 109.582336, -0.948085), -135.615631104);
        CreateObject(OBJECT_TYPE_CREATURE, R”jlp_npc_hoarder.utc”, lMerchantLocation);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”genip_crate_wd_large_stat.utc”, lCrateLocation);
        }
        }

        Which is wrong obviously… 🙂

      • Caladon
        November 17, 2009 at 1:50 pm

        try this replacing your own file names and locs of course

        /—–start script—–/

        #include “wrappers_h”
        void main()
        {

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addcampmerchant”, FLOATY_MESSAGE, 16777215, 20.0);
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, “cdon_campmerchant”);
        if (!IsObjectValid(oMerchant))

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addstorage1″, FLOATY_MESSAGE, 16777215, 20.0);
        object oStorage = UT_GetNearestObjectByTag(oPlayer,”cdon_storage_chest1”);
        if (!IsObjectValid(oStorage))

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addstorage2”, FLOATY_MESSAGE, 16777215, 20.0);
        object oStorage = UT_GetNearestObjectByTag(oPlayer, “cdon_storage_chest2”);
        if (!IsObjectValid(oStorage))

        {
        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lMerchantLocation = Location(oArea, Vector(160.198303, 116.840668, -1.349823), 86.397140503);
        CreateObject(OBJECT_TYPE_CREATURE, R”cdon_campmerchant.utc”, lMerchantLocation);

        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.819031, 120.765495, -0.969640), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest1.utp”, lStorageLocation);

        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.422180, 111.762978, -1.356835), 140.356826782), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest2.utp”, lStorageLocation);
        }
        }

        /—–end script—–/

      • Caladon
        November 17, 2009 at 1:58 pm

        sorry this was wrong it would be

        /——-start script—–/

        #include “wrappers_h”
        void main()
        {

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addcampmerchant”, FLOATY_MESSAGE, 16777215, 20.0);
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, “cdon_campmerchant”);
        if (!IsObjectValid(oMerchant))

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addcampmerchant”, FLOATY_MESSAGE, 16777215, 20.0);
        object oStorage = UT_GetNearestObjectByTag(oPlayer,”cdon_storage_chest1″);
        if (!IsObjectValid(oStorage))

        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “cdon_addcampmerchant”, FLOATY_MESSAGE, 16777215, 20.0);
        object oStorage = UT_GetNearestObjectByTag(oPlayer, “cdon_storage_chest2”);
        if (!IsObjectValid(oStorage))

        {
        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lMerchantLocation = Location(oArea, Vector(160.198303, 116.840668, -1.349823), 86.397140503);
        CreateObject(OBJECT_TYPE_CREATURE, R”cdon_campmerchant.utc”, lMerchantLocation);

        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.819031, 120.765495, -0.969640), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest1.utp”, lStorageLocation);

        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lStorageLocation = Location(oArea, Vector(156.422180, 111.762978, -1.356835), 140.356826782), 28.556318283);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”cdon_storage_chest2.utp”, lStorageLocation);
        }
        }

        /—–end script—–/

      • John Vanderbeck
        November 17, 2009 at 1:34 pm

        No i’m afraid that is a bit of a mess 😦 Your IF statements are not valid. It might compile but it won’t do what you expect. Best to break it out into separate IF chunks. Tell you guys what. I’m working on part 2 right now, and what i’ll do is since this question of multiple objects seems important to you all, i’ll talk about it briefly in part 2.

      • Newyears1978
        November 17, 2009 at 1:36 pm

        Thanks that would be apprecitaed. For now I will try a new script and see what happens.

        Still unsure on using core items..how you would check if it is already there..since there is a chance there could be several of them already there (if this makes sense)

      • John Vanderbeck
        November 17, 2009 at 1:45 pm

        Yes, you are correct. In our case we’re using a custom resource, so we know the only one that would exist is ours. If you were doing this with a generic item that is in the game, we would have to go about things differently. However, if you are trying to build a small “camp” around the custom merchant, then it makes things easier. You know if the merchant isn’t there, then the camp must not be either. If the merchant is there, then you can assume you also spawned his camp. Since the two go together.

      • Newyears1978
        November 17, 2009 at 1:59 pm

        That was my thinking so I made a new script like this:

        #include “wrappers_h”
        void main()
        {
        object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer, “crate”, FLOATY_MESSAGE, 16777215, 20.0);
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jlp_npc_hoarder”);
        if (!IsObjectValid(oMerchant))
        {
        object oArea = GetObjectByTag(“cam100ar_camp_plains”);
        location lCrateLocation = Location(oArea, Vector(132.385178, 109.582336, -0.948085), -135.615631104);
        CreateObject(OBJECT_TYPE_PLACEABLE, R”genip_crate_wd_large_stat.utc”, lCrateLocation);
        }
        }

        And changed my 2da file..the script calls..but there is still no crate..so obviously Im still missing something..

      • Newyears1978
        November 17, 2009 at 2:09 pm

        My above was referring to Johns post:

        Yes, you are correct. In our case we’re using a custom resource, so we know the only one that would exist is ours. If you were doing this with a generic item that is in the game, we would have to go about things differently. However, if you are trying to build a small “camp” around the custom merchant, then it makes things easier. You know if the merchant isn’t there, then the camp must not be either. If the merchant is there, then you can assume you also spawned his camp. Since the two go together

        (I better just wait..I think we are going to drive him nuts treating this like a forum instead of a comments section 🙂

      • Caladon
        November 17, 2009 at 2:15 pm

        Ya He needs to pay attention to Part2 lol!

      • Caladon
        November 17, 2009 at 2:17 pm

        IM me on Trillian as Caladonn

      • John Vanderbeck
        November 17, 2009 at 2:10 pm

        At a quick glance your problem is the name of your resource. Placeable filenames end in “.utp”

      • Newyears1978
        November 17, 2009 at 2:45 pm

        Good catch..still doesn’t appear as I have…oh well..come on part two.

      • Newyears1978
        November 17, 2009 at 3:31 pm

        I finally got the crate to show..but don’t know how to do a runonce thing with it..I tried having it check for the NPC but of course then if the NPC is there it doesn’t place the crates..

        Part 2 done YET? =)

      • Thynwar
        November 22, 2009 at 12:41 pm

        Hello guys, can anybody help me ?
        Wonder why this message appears above my Character, each time I enter the camp.
        Must be the name of my module which is “merchant_storage”

        Any one knows how to fix that ? Thanks 🙂

      • John Vanderbeck
        November 22, 2009 at 12:44 pm

        The scripts I post usually contain debug code to see what is working and what isn’t. These are displayed with the DisplayFloatyMessage() calls.

      • Thynwar
        November 22, 2009 at 12:50 pm

        Thx for the fast request 🙂 well i left it blank now like you said, but then when i try to export it says : .nss(7) Declaration does not mach parameters (Display Floaty Message) (while compiling var_constants_h.nss)

      • John Vanderbeck
        November 22, 2009 at 12:54 pm

        Yeah you can’t just leave it blank 🙂 Programming code is very strict. You can make it display an empty message “”, or remove the line completely. Though depending on the script you might have to re-arrange something. You can post your script here and i’ll look at it. Surround the script with code tags. [ code ] script [ /code ] — without the spaces.

      • Thynwar
        November 22, 2009 at 1:07 pm

        Well i tried it the last 10 min but it didn’t work… would be nice if you could help 🙂 i just use the base script… i markt the text which should be erased :

        #include "wrappers_h"
        void main()
        {
          // The first thing we want to do, before anything, is look around and see
        // if we have already spawned this merchant
          object oPlayer = GetMainControlled();
        DisplayFloatyMessage(oPlayer,"this messi must dissappear", FLOATY_MESSAGE, 16777215, 20.0);
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, "PLACE");
        if (!IsObjectValid(oMerchant))
        {
        // If we get to this code, it means the merchant has not been placed yet
        // So let’s do that
        // get an object pointer to the party camp area
        object oArea = GetObjectByTag("cam100ar_camp_plains");
        // create a location for where our merchant NPC will be placed
        location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
        // Spawn the NPC
        CreateObject(OBJECT_TYPE_CREATURE, R"PLACE.utc", lMerchantLocation);
        }
        }
        
      • John Vanderbeck
        November 22, 2009 at 1:08 pm

        In that script you can just delete that entire line without any problem.

      • NewYears1978
        November 29, 2009 at 12:35 am

        When I want to remove debugging code Ij ust comment it out, that way I can turn it back on it I need it..just put two slashes in front of it ” // ”

        Make sure you export everything back out and save or you wont see your changes…

      • John Vanderbeck
        November 17, 2009 at 1:46 pm

        Oh and we’ll actually be building a little camp for him in the last part, as a sort of polish on the whole thing.

      • Caladon
        November 17, 2009 at 1:51 pm

        Can’t wait John!

      • Newyears1978
        November 17, 2009 at 1:16 pm

        Also, what if it is a core object.. a generic crate “genip_crate_wd_large_stat”

        It seems like if I used the command at the beginning of the script which checks to see if that the item is already there..it would break other addons that used that crate.. does that make sense? Which leads me to believe I had to create my own new crate..? (Wow sorry if I am confusing..trying to learn)

      • John Vanderbeck
        November 17, 2009 at 1:17 pm

        They don’t need to be in separate scripts. You could do it all in one. Either works, its more a matter of personal choice and how you want to organize things.

      • Newyears1978
        November 17, 2009 at 1:20 pm

        How do you do it…per my example above, it didn’t work the way I tried it.

      • Caladon
        November 17, 2009 at 1:02 pm

        ya the iStorageLocation could just as easily been iChestLocation

      • Caladon
        November 17, 2009 at 1:06 pm

        but whatever you use needs to be consistant within that script

  35. Caladon
    November 17, 2009 at 12:13 pm

    I made 2 of them and they DO have stuff in them both core items and custom!

    • Newyears1978
      November 17, 2009 at 12:47 pm

      You had to make a whole new module..that’s what I was trying to avoid..

      I just want to have some crates behind my merchant..not usable..just for looks… I thought it would be simple to add core crates that are already there and just use a createobject in my merchant script..but i can’t figure out how… here is what I tried to do:

      #include “wrappers_h”
      void main()
      {
      object oPlayer = GetMainControlled();
      DisplayFloatyMessage(oPlayer, “merchant”, FLOATY_MESSAGE, 16777215, 20.0);
      object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jlp_npc_hoarder”);
      if (!IsObjectValid(oMerchant))
      {
      object oArea = GetObjectByTag(“cam100ar_camp_plains”);
      location lMerchantLocation = Location(oArea, Vector(134.270264, 111.795937, -0.781055), -142.727050781);
      location lCrateLocation = Location(oArea, Vector(131.104355, 109.663429, -0.898470), 97.838676453);
      CreateObject(OBJECT_TYPE_CREATURE, R”jlp_npc_hoarder.utc”, lMerchantLocation);
      CreateObject(OBJECT_TYPE_PLACEABLE, R”genip_crate_wd_large_stat.utc”, lCrateLocation);
      }
      }

      • Caladon
        November 17, 2009 at 12:56 pm

        I set up a separate additemscript for each object since I have 1 merchant and 2 chests this means I have 3 scripts (not including show loc) and my GDA file calls all 3 scripts

      • Newyears1978
        November 17, 2009 at 12:57 pm

        That would work, but is it not possible to create more than one object within a script? Especially if they are just static items like I am trying to do?

      • Newyears1978
        November 17, 2009 at 1:02 pm

        Maybe I can’t place a core item because my script is tied directly to my Module..? So I would have to have a different scrip tthat’s tied to the core instead?

      • Caladon
        November 17, 2009 at 1:05 pm

        by matching script to object you keep it clean especially when the game needs to determine Loc

  36. Newyears1978
    November 17, 2009 at 12:31 pm

    Another question – When you make changes to any of the files, say the script, or the creature…(also showlocation)

    Do you have to open each file and export it again? It seems like making changes to one file and exporting..breaks my whole mod.

    For instance I just made a change to the location in my merchant script, then showlocation stopped working.. (This has happened several times) So I have to go back in, open my creature, open my script, open showlocation script, export each, create manifest and module…then it works again.

    Seems ..not likely that you would have to do this for every change you make..am I doing something wrong?

  37. Caladon
    November 17, 2009 at 12:43 pm

    I always do export without dependencies to any file i change and then go to Tools – Export – Generate Module XML\Generate Manifest XML

    • Newyears1978
      November 17, 2009 at 12:45 pm

      So you only have to reexport a file you changed..wonder why I keep having issues then..hrm. Maybe user error.

      • John Vanderbeck
        November 17, 2009 at 12:49 pm

        Probably because when you export, you aren’t going in and cleaning up after it each time. Anytime you export a script, its going to export too much stuff that you don’t need as we’ve discussed before. So always go and clean up first to avoid any problems. Really hope they fix this at some point.

  38. Newyears1978
    November 17, 2009 at 12:50 pm

    Well my process has been Export<Empty directories, then I open my module and the file I need to change. Make changes, export it, create module and manifest, then delete the toolsexport directory.

    Seems sometimes it works sometimes something breaks..usually if I go back reexport all the files in there and manifest/module, cleanup, then it works again.

    What a pain, I hope they patch soon.

    • John Vanderbeck
      November 17, 2009 at 1:19 pm

      No, you don’t want to do Empty Export Directories each time. That will empty everything, including what you did want to export. Just do you export, then manually open up the core/override/toolsetexport directory and delete what shouldn’t be there. Of course, “What shouldn’t be there” depends entirely on what you are doing so I can’t say exactly what to delete. You should know what files you are trying to export though, so just delete the ones you were not exporting.

      • LazyDaisy
        July 26, 2011 at 8:48 pm

        Aha! I knew if I scrolled down far enough I would find the answer to the problem. I kept trying to export the script and getting nasty comments from the toolset so I finally retyped it and was still getting those nasty comments … BUT … cleaned up my directory a bit and Ta Da! It works. Thanks John.

  39. John Vanderbeck
    November 17, 2009 at 12:51 pm

    You guys are starting to get ahead lol.

    Please try to at least keep a clean copy so you can continue to follow along without problems. Part 2 will be posted today. Maybe parts 2 & 3 depending on how my time goes.

    • Newyears1978
      November 17, 2009 at 12:52 pm

      I havn’t really modified mine, except that I was trying to add decoration behind him, at least until you get part 2 out 🙂 Slow day at work!

  40. Caladon
    November 17, 2009 at 1:11 pm

    As each chest needs it’s own specific loc placement i don’t see any way to do it without a script for each object. It may be doable but I’m not savvy enough to know how,,, Yet! lol

    • Newyears1978
      November 17, 2009 at 1:19 pm

      Oh..why can’t you just have more than one location variable in a script and then createobject for each items…so confused..

      • John Vanderbeck
        November 17, 2009 at 1:24 pm

        You can 🙂

        // define locations for 3 merchants
        location lMerchantLocation1 = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
        location lMerchantLocation2 = Location(oArea, Vector(120.5, 50.77, -1.33), 10);
        location lMerchantLocation3 = Location(oArea, Vector(400.0, 200.0, -1.33), 85.4);
        // Spawn the merchants
        CreateObject(OBJECT_TYPE_CREATURE, R”jwv_t_creature1.utc”, lMerchantLocation1);
        CreateObject(OBJECT_TYPE_CREATURE, R”jwv_t_creature1.utc”, lMerchantLocation2);
        CreateObject(OBJECT_TYPE_CREATURE, R”jwv_t_creature1.utc”, lMerchantLocation3);

  41. Caladon
    November 17, 2009 at 1:14 pm

    darn it it, did a reply on your earlier post lol

  42. Newyears1978
    November 17, 2009 at 2:14 pm

    Damn you typos!

  43. Newyears1978
    November 17, 2009 at 3:04 pm

    Well I got my crate to show, finally. With a new script. The only thing I couldnt figure out is how to put a run once in there since it was a core item.

    I tried making it check for the NPC like the original script..but problem is..if the NPC is there it doesn’t place the crate the first time…so looking forward to part 2 to clear that issue up.

  44. John Vanderbeck
    November 17, 2009 at 4:11 pm

    Part 2 is now up!

  45. Miserere
    November 17, 2009 at 10:53 pm

    Does this PRCSCR method work for custom campaigns? I tried doing this for a custom campaign I am working on, as a way of not having to mess with the base area load scripts, and it did not execute. I can run the script from the console and it works and does what I wanted, but it doesn’t work when I try running it from a PRCSCR file.

    • John Vanderbeck
      November 17, 2009 at 10:55 pm

      I haven’t’ tested it but I would imagine it would work. However the placement of the PRCSCR file would be different. Are you putting it in that campaigns override folder?

      • Miserere
        November 18, 2009 at 11:45 am

        Yes, I am putting it in the same folder as my other 2DA overrides, which are working perfectly.

  46. Gralamin
    November 19, 2009 at 1:48 am

    Great tutorial, however I have a strange error.
    I go to camp, the debug prints print, however the Merchant is not created. The script is definitely working, the creature just isn’t spawning for some reason, though its name is correct. I am attempting to spawn it in the shadows right by Morrigan’s tent.
    In my case, the merchant’s tag is “gral_gear_merchant” and it’s file name is “”gral_gear_merchant.utc”

    Output:
    Checking for Merchant
    Merchant Not Found! Generating…
    ~~~~~~
    164.657211, 160.047455, 0.170835
    ~~~~~~
    Merchant was not spawned

    Code:
    #include “wrappers_h”

    void main()
    {
    //Check if we have spawned this merchant
    object oPlayer = GetMainControlled();
    DisplayFloatyMessage(oPlayer, “Checking for Merchant…”, FLOATY_MESSAGE, 16777215,
    20.0);
    object oMerchant = UT_GetNearestObjectByTag(oPlayer, “gral_gear_merchant”);
    if(!IsObjectValid(oMerchant))
    {
    DisplayFloatyMessage(oPlayer, “Merchant Not Found! Generating…”, FLOATY_MESSAGE, 16777215,
    20.0);
    //If we get here, it means merchant needs to be placed.
    //Get the party camp
    object oArea = GetObjectByTag(“cam100ar_camp_plains”);
    //Choose a location to spawn him at.
    //Floats that define Everything
    float fX = 164.657211f;
    float fY = 160.047455f;
    float fZ = 0.170835f;
    float fAngle = 26.258864267f;
    //Vector needed to spawn him
    vector vMerchantVector = Vector(fX, fY, fZ);
    DisplayFloatyMessage(oPlayer, “~~~~~~”, FLOATY_MESSAGE, 16777215, 20.0);
    DisplayFloatyMessage(oPlayer, VectorToString(vMerchantVector), FLOATY_MESSAGE, 16777215,
    20.0);

    location lMerchantLocation = Location(oArea, vMerchantVector, fAngle);
    //Spawn
    object oCreatedMerchant = CreateObject(OBJECT_TYPE_CREATURE, R”gral_gear_merchant.utc”, lMerchantLocation);
    DisplayFloatyMessage(oPlayer, “~~~~~~”, FLOATY_MESSAGE, 16777215, 20.0);
    if (IsObjectValid(oCreatedMerchant))
    DisplayFloatyMessage(oPlayer, “Merchant should be spawned”, FLOATY_MESSAGE, 16777215,
    20.0);
    else
    DisplayFloatyMessage(oPlayer, “Merchant was not spawned”, FLOATY_MESSAGE, 16777215, 20.0);
    }
    }

    • Gralamin
      November 19, 2009 at 2:35 am

      Oops. Apparently I forgot to export something. Have it working now.

  47. TildeAmpersand
    November 20, 2009 at 8:49 pm

    Ok, I have a completely different problem so far – and the main reason i sooo hate excel – I’ve made the little spreadsheet, just as your image shows, but when i attempt to compile it (saved as 97-2003 *.xls) i get the glorious, and ever-so-descriptive error, as follows:
    —————————————————-
    ExcelProcessor, Copyright (c) 2006 Bioware Corp.

    Processing: H:\Dragon Age\– scripts –\PRCSCR_amortec.xls – Target Output Type: PC

    Loading worksheet Sheet1…
    Exporting worksheet Sheet1…
    Loading worksheet Sheet2…
    ERROR: Worksheet Sheet2 has zero columns (0) or rows (0) (is cell A1 ‘ID’?)
    Press any key to terminate…
    —————————————————-
    Only thing i can think of is that I have yet to figure out how to get excel to trim down all the extra default columns… :sigh:

    • John Vanderbeck
      November 20, 2009 at 9:02 pm

      That error means you don’t have a properly formatted spreadsheet. The first two rows are VITAL. The first row gives the column names, starting with ID, and the secodn row defines the data types.

      • TildeAmpersand
        November 20, 2009 at 9:15 pm

        Yes, I took the _exact_ info from your image up there, except my script name, which is ’tilde_campmerchspawn’.

        I even tried it again, using the cute little fx box to input all of it, instead of typing directly into the boxes. Capitalization is the same, order is the same, etc. I have excel situated so I can see your example image at the same time.

        Not a complete dunce, just never had any luck with excel 😦

  48. Gunzz
    November 21, 2009 at 8:04 pm

    I’m somewhat confused. Im currently using the steam version of the game, and Im at the step of exporting and then going ingame and opening the console. I went into steam, right clicked the game, and put in -enabledeveloperconsole. I only did this because modifying the shortcut would do nothing for me. Now whenever I go ingame it seems to make it invisible like I was told, but when I try runscript showlocation, nothing shows or anything.Not even the keyboard people are complaining about pops up. I dont get any numbers or anything. I exported the scrip and the script ONLY to export without dependant resources. Have I done something wrong here?

    • SylvrWynd
      February 21, 2010 at 1:15 pm

      The default icon for DAO opens the DAOriginsLauncher.exe. You need to make sure it is activating the DAOrigin.exe in the bin_ship directory.

  49. Dragmahr
    November 22, 2009 at 11:54 am

    I always get the “.nss(1): After compund statement at end ” error, when i try to export my Data.. can’t figour out why 😦

    anybody help ?

    Here’s my code :

    Script name = jwv_script.nss
    NPC name = jwv_t_creature1.utc
    GDA filename = PRCSCR_merch.GDA ( in core/override folder )
    Module name = tut_merchant_spawn

    —————-

    #include “wrappers_h”
    void main()
    {
    // The first thing we want to do, before anything, is look around and see
    // if we have already spawned this merchant
    object oPlayer = GetMainControlled();
    DisplayFloatyMessage(oPlayer, “tut_merchant_spawn”, FLOATY_MESSAGE, 16777215, 20.0);
    object oMerchant = UT_GetNearestObjectByTag(oPlayer, “jwv_t_creature1″);
    if (!IsObjectValid(oMerchant))
    {
    // If we get to this code, it means the merchant has not been placed yet
    // So let’s do that
    // get an object pointer to the party camp area
    object oArea = GetObjectByTag(“cam100ar_camp_plains”);
    // create a location for where our merchant NPC will be placed
    location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);
    // Spawn the NPC
    CreateObject(OBJECT_TYPE_CREATURE, R”jwv_t_creature1.utc”, lMerchantLocation);
    }
    }

    ———————–

    • John Vanderbeck
      November 22, 2009 at 11:59 am

      Dragmahr, that error is usually caused by just copying and pasting the script from here, which messes with the quote marks. Go through your script and re-type the quote marks to use the standard ” mark.

      • Dragmahr
        November 22, 2009 at 12:14 pm

        thank you so much, that was the issue 🙂
        indeed… now my merchant is there.

        Thank you

  50. Dragmahr
    November 22, 2009 at 12:34 pm

    Have one question more 🙂 Now my merchant is in the camp,
    but everytime I enter the camp a message pops out over my hero which says
    ” Merchant ” which is infact the Name of my module.. how is it possible to make this disappear ?

    • SylvrWynd
      February 21, 2010 at 1:17 pm

      Comment (//) out the DisplayFloatyMessage line in the script.

  51. Thynwar
    November 22, 2009 at 1:11 pm

    woops.. your right, srry guess i tried it the wrong way before.
    thank you again 🙂 and soory

  52. Ren Man
    November 22, 2009 at 7:11 pm

    I don’t know what wrong with my script. When I enter the camp, I get the floaty message saying my merchant spawned, but he won’t appear. Please help, I can’t seem to figure it out:

    #include "wrappers_h"
    void main()
    {
        object oPlayer = GetMainControlled();
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, "bob");
        if (!IsObjectValid(oMerchant))
        {
            object oArea = GetObjectByTag("cam100ar_camp_plains");
            location lMerchantLocation = Location(oArea, Vector(145.777725, 148.513657, -1.005749,) 13.912362099);
            CreateObject(OBJECT_TYPE_CREATURE, R"bob.utc", lMerchantLocation);
            DisplayFloatyMessage(oPlayer, "bobspawn", FLOATY_MESSAGE, 16777215, 20.0);
        }
    }

    Thank you.

  53. John Vanderbeck
    November 22, 2009 at 7:27 pm

    Well the floaty message, as you have it, will display even if the create call fails. What you need to do is actually check to see if the create fails or not:

    #include "wrappers_h"
    void main()
    {
        object oPlayer = GetMainControlled();
        object oMerchant = UT_GetNearestObjectByTag(oPlayer, "bob");
        if (!IsObjectValid(oMerchant))
        {
            object oArea = GetObjectByTag("cam100ar_camp_plains");
            location lMerchantLocation = Location(oArea, Vector(145.777725, 148.513657, -1.005749,) 13.912362099);
            oMerchant = CreateObject(OBJECT_TYPE_CREATURE, R"bob.utc", lMerchantLocation);
            if (IsValidObject(oMerchant))
                 DisplayFloatyMessage(oPlayer, "Merchant created successfully.", FLOATY_MESSAGE, 16777215, 20.0);
            else
                 DisplayFloatyMessage(oPlayer, "Failed to create merchant!", FLOATY_MESSAGE, 16777215, 20.0);
                 
        }
    }

    That code should tell you if the Create call is failing or not. If it is failing, then double check your tags and resource names, double check that the creature is exported, and double check your location is a valid location.

    • Ren Man
      November 22, 2009 at 7:50 pm

      Awesome, thank you! This resolved my issue.

  54. Sven Boogie
    November 22, 2009 at 10:23 pm

    I’m getting that “after compound statement at end” compile failed error when trying to save/compile the script to spawn the NPC. All I did was copy and paste your script and replace your npc’s name with mine…

    • Newyears1978
      November 23, 2009 at 11:00 am

      Copy Pasting doesn’t work well with coding (at least when copying from websites and such)

      Try retyping all the quotation marks in your script and see if it corrects it.

  55. Sven Boogie
    November 22, 2009 at 10:29 pm

    Aaaaand… I don’t have excel on this PC. Crap.

  56. Mike
    November 27, 2009 at 5:37 pm

    Ok I’ve fixed all my bad quotes, but now I’m getting the error:
    E: 15:28:33 – int_campmerchplacement.nss – int_campmerchplacement.nss(22): Undefined identifier (R)

    which is referring to the create object line, CreateObject(OBJECT_TYPE_CREATURE, R”int_campmerchant1.utc”, lMerchantLocation);

    That R seems to be in everybodys code, so why is it causing problems with my compile? Where did it come from anyway?

    • Mike
      November 27, 2009 at 5:44 pm

      bad quotes again.

    • NewYears1978
      November 29, 2009 at 12:33 am

      Mike can you post the whole script so I can see it?

  57. SilverComet
    November 29, 2009 at 7:50 am

    Hi! I’ve got an issue, I’m at the exporting stage, and trying it.

    showlocation works fine. However going to camp nothing happens, if I use runscript I get a floaty saying the script name, but no merchant. I’ve replaced the quotation marks and such in the script, exported the item, script, module & manifest.

    nothing seems to work, I’ve gone over it from scratch a few times now =/

    (Not familiar with wordpress so not sure how to copy paste the code?)

  58. gocek
    November 29, 2009 at 5:10 pm

    Awesome stuff, thanks!
    I just managed to create my own Storage Chest mod, which is a bit based on the Storage Chest released by some Bioware guy. But the source code he released wasn’t really working as intended (especially the .2da file was a total mess!). So thanks to this guide I made my own AddIn, with better-looking chest and it’s name in Polish, just for the sake of creating something useful 😉

  59. November 30, 2009 at 3:02 am

    Hey John,

    I´m a “little bit” confused about something.
    I created the creature, the merchant and the script step by step following your tutorial. But…how do i tell the creature that it is also the merchant? (or the other way round)

    • November 30, 2009 at 4:09 am

      ok erm…forget it…my silly head combined 2 different tutorials…*turns red*

  60. gocek
    November 30, 2009 at 8:48 am

    Hi. There’s one thing that bothers me. Let’s say I have my module which adds a chest to the camp (or let’s take the Camp Storage Chest modules from Bioware developer) I run my saved game with that module enabled and save the game. Then I go to the main menu and I uncheck my module and make it disabled. And now I want to load my saved game. I get a warning that my module is disabled – ok, I want to continue. What might happen next is that I get no chest, but only a floating name of the chest, WITHOUT the chest itself. This is the actual behaviour of the Camp Storage Chest mod. Is there any way to prevent this? In a way: when the mod is not loaded, there’s no sign of the chest?

  61. Nitro9a
    December 8, 2009 at 5:34 pm

    Hi,
    First of all, thanks for the tutorial.

    While compiling the script I get this error:

    E: 17:22:01 – 2da_constants_h.nss – 2da_constants_h.nss(878): Parsing variable list (while compiling tut_merchant_spawn.nss)

    then

    while exporting I get a series of errors like this:
    E: 17:29:20 – 2da_constants_h.nss – 2da_constants_h.nss(878): Parsing variable list (while compiling sys_achievements_h.nss)
    E: 17:29:20 – 2da_constants_h.nss – 2da_constants_h.nss(878): Parsing variable list (while compiling sys_injury.nss)

    and the list goes on to describe an error relating to everything in the toolset export folder.

    I went in there and deleted everything, emptied the export directories, and deleted the single player folder. Tried again, same problem.

    Then, I decided to check another module that I know works properly and I received the same error messages. I deleted the merchant module and tried the old, working module again and still got the same error messages. Can anyone tell me what I broke?

    Thanks. I’ve searched around and this error code is nowhere to be found on the internet.

    • John Vanderbeck
      December 8, 2009 at 5:37 pm

      @Nitro9a
      You are getting this error because at some point you modified the “header” file, 2da_constants_h.nss which nearly every core file uses. On line 878 of that file you have bad code, and every file that uses that header is seeing that error when trying to compile. Nasty stuff. You need to take a look at line 878 or thereabouts and see what you did. None of my tutorials would have you modifying that file.

      • Nitro9a
        December 8, 2009 at 5:53 pm

        Thanks for the quick response and also sorry for accidentally replying in the middle of the forum.

        I thought I might have broken something while messing around with abilities. The only location I can find that .nss file in is Documents\BioWare\Dragon Age\packages\core\override\toolsetexport

        This is not a place where any core files go, correct? The file should be somewhere in SteamApps\common\dragon age origins, right? It’s not there or anywhere outside of my documents folder.

  62. John Vanderbeck
    December 8, 2009 at 5:57 pm

    Nitro9a :

    Thanks for the quick response and also sorry for accidentally replying in the middle of the forum.

    I thought I might have broken something while messing around with abilities. The only location I can find that .nss file in is Documents\BioWare\Dragon Age\packages\core\override\toolsetexport

    This is not a place where any core files go, correct? The file should be somewhere in SteamApps\common\dragon age origins, right? It’s not there or anywhere outside of my documents folder.

    No that is the correct location for an exported core file. EVERYTHING should always be in your documents area. No mod should ever be, or need to be, outside of My Documents.
    the problem isn’t with the exported file though its with the one in your database, the one in your toolset.

    • Nitro9a
      December 8, 2009 at 6:00 pm

      How do I locate that file? Will I need to reinstall the toolset to fix this?

  63. John Vanderbeck
    December 8, 2009 at 6:09 pm

    Nitro9a :

    How do I locate that file? Will I need to reinstall the toolset to fix this?

    You had to have located it once in order to have modified it :p

    It is listed in the toolset with all your other scripts. I don’t recall its exact location off the top of my head, but its up near the top. Look in _CORE or _CORE_INCLUDES or something.

    • Nitro9a
      December 8, 2009 at 6:14 pm

      Ha, yeah, you’re right. I found it. I definitely messed things up when I was messing around with abilities. Okay, baby steps, baby steps. Thanks very much for your help. 🙂

  64. Kimmie
    December 11, 2009 at 12:16 am

    Can I know what’s the Module and Owner Module for the ShowLocation script suppose to be?

    Thanks 🙂

    • John Vanderbeck
      December 11, 2009 at 10:31 am

      For the debug ShowLocation script they should just be your own module.

  65. Yako
    December 20, 2009 at 3:32 pm

    Not sure what I’m doing wrong. I followed this tutorial to create a character. If I runscript through the console, my npc spawns where I want him to. Unfortunately, I can’t get the script to trigger on its own, which leads me to think that the problem lies with my PRCSCR file. I made it in excel, saved it as .xsl, and when I run it through the excelprocessor, I encounter no errors. I even tried many different ID ints, all below 8300000, because I read the processor can only go so high.

    Here’s what a typical version of my PRCSCR looks like:
    ID AreaListName Script
    int string string
    8000000 cam100ar_camp_plains spawning_wilhem

    note that spawning_wilhem is the name of my script, and that the script itself is fine because it works when I type in runscript spawning_wilhem in the console. Any idea of what I’m doing wrong? I tried loading a save from a camp, loading a save outside of camp and going to camp, and nothing I do works. 😦

    • SylvrWynd
      February 21, 2010 at 1:28 pm

      I wouldn’t mind knowing the answer to this one as well. I am having the same problem. I am not placing my merchant in camp, but rather in Denerim Market (script works fine, but won’t auto start when the area loads). I am assuming it is my PRCSCR file as well.

  66. Ekrem
    January 15, 2010 at 10:23 am

    I had a very strange bug!
    When I first launched the game, Levi Dryden appeared on the camp, even though I had completed Soldier’s Peak. I exited to main menu, logged out and in to dragon age servers and reloaded camp save and it worked.

    I exited and reopened the game just now. My NPC is there and Levi didn’t show up.

    By the way, the floating message only showed up on the second try (after the relog but not with levi and after re-opening the game)

  67. Araxiel
    January 15, 2010 at 3:23 pm

    how do i find out what my ID is for my PRCSCR file?

  68. meg_anna
    February 8, 2010 at 2:58 pm

    Hey John,

    I’m having a problem i went through this whole thing and created a whole mod and everything and i couldnt get it to work so i went back and did it again but i still cant get the NPC to show up i got it to show up last time by placing the script name in for the module under the manage modules tab but i dont think we are suppose to do that please help! been at this since yesterday lol

  69. March 30, 2010 at 12:32 pm

    PRCSCR

    stands for player resource creation (PRC) SCRipt

    ++ Angel

  70. n2nw
    April 5, 2010 at 11:45 am

    Well, the last post I can see here is from 11/29/09, so I hope someone is still around… Anyway, newbie to DA modding (and a huge novice to any modding, really) here, so please be gentle. 😛

    My merchant does not show up in camp unless I use the runscript command and then ‘bing!’, there he is. I’m assuming that since I can get him to appear with runscript, that my script must be alright (though that may not be so). I would also assume, then, that the problem would be with my prcsrc file. I noticed that another user had that problem, but their question went unanswered. I used Corel’s Quattro Pro (in Excel mode) to create the file and “saved as” an xls (word 97/2000/2002/2003). It compiled into a gda, so I figured that I was good to go. I put the file in the specified addins/module/core/override directory, but no merchant. I receive no floaty message about the script, either. I tried placing the gda into other override directories, but still it didn’t work. The only way my merchant appears (or the floaty message) is with runscript. Here is my 2da file:

    ID AreaListName Script
    int string string
    1770071 cam100ar_camp_plains n2nw_mer_ciram

    Any ideas or comments would be appreciated.

    And btw, excellent site. Even though my merchant is being finicky about his comings and goings, I’m having fun. I’m going to continue on with parts 2 & 3 in the meantime as it’s all good practice. 🙂

  71. bard
    June 15, 2011 at 5:55 am

    Finally I managed to compile a script. Now I can move on to next stage. This helped me a lot. Thanks.

  72. Misty
    September 28, 2012 at 11:09 pm

    I am having trouble with your ShowLocation script. When I try to export it, an error shows in the log…
    “E: 00:06:51 – showlocation.nss – showlocation.nss(1): After compound statement at end”
    And of course, the runscript doesn’t work because of this. What is wrong? I did everything exactly as you said. And yes, I can see the console when I’m typing. I downloaded a mod for that so I know its right when I type it in.

    • Misty
      September 28, 2012 at 11:12 pm

      Nevermind.

  1. April 4, 2011 at 8:35 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: