jwvanderbeck Posted November 16, 2009 Share Posted November 16, 2009 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. http://dragonagemodding.wordpress.com/2009...rs-camp-part-1/ Link to comment Share on other sites More sharing options...
jwvanderbeck Posted November 17, 2009 Author Share Posted November 17, 2009 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. http://dragonagemodding.wordpress.com/2009...rs-camp-part-1/ I just wanted to note that part 2 is posted now. Its a whopper! Continuing on with our tutorial series to create a new NPC merchant for our player’s camp, we take a look at conversations and how to add them to our creature that we created last time. First we will look at conversations in general, then we will apply some basic conversation to our NPC. We will also look briefly at how to add a storage chest next to our creature to give the camp a little flavor. http://dragonagemodding.wordpress.com/2009...2%80%93-part-2/ Link to comment Share on other sites More sharing options...
JimboUK Posted November 17, 2009 Share Posted November 17, 2009 Thanks for posting all this info, I intend to have a go at modding once the toolset is patched. Link to comment Share on other sites More sharing options...
jwvanderbeck Posted November 18, 2009 Author Share Posted November 18, 2009 Part 3 is now available! In part 1 of this tutorial series, we looked at how we can use a “PRCSCR” file to get the game engine to run a custom script upon entering an area. This allowed us to then spawn an NPC character that we created inside the Single Player game’s Player Camp. In part 2 we looked at the conversation editor, and how to create conversations. We then gave a basic conversation to our NPC in preparation for turning them into a merchant. In this part we’re going to actually turn our NPC into a merchant that the player can interact with. Now unfortunately Bioware made what I feel is a bad decision, and made it so that you can not dynamically create a merchant resource. If you attempt to use CreateObject() with OBJECT_TYPE_STORE you will find that the call fails every time. This means we need to think outside the box and figure out how to get our merchant resource into the player’s camp. So let’s see how we can do that. Read the full tutorial Link to comment Share on other sites More sharing options...
sickman1968 Posted November 19, 2009 Share Posted November 19, 2009 Awesome work, your tutorials will help many people figure out the new way to mod which is so very different from the NWN1/2 toolsets yet so much the same. Your item tut helped me so much to get my feet wet with the tool set, so I thank you for it, these and I encourage (beg) you to keep it up so people like me can not be frustrated and not :wallbash: :thanks: Link to comment Share on other sites More sharing options...
XunAmarox Posted November 19, 2009 Share Posted November 19, 2009 Nothing I change works. T.T... It shows up in downloaded content as being there, but the item doesn't spawn in inventories and other changes to existing items I made didn't work either. I pretty much just took away the restrictions on Morrigan's two robes and made a new one with better stats. I made sure the module was set to run the script too... No clue why it doesn't work. // All module events #include "utility_h" #include "wrappers_h" #include "events_h" void main() { event ev = GetCurrentEvent(); int nEvent = GetEventType(ev); Log_Events("", ev); switch (nEvent) { //////////////////////////////////////////////////////////////////////// // Sent by: The engine // When: The module loads from a save game, or for the first time. This event can fire more than // once for a single module or game instance. //////////////////////////////////////////////////////////////////////// case EVENT_TYPE_MODULE_LOAD: { // this event can fire multiple times, and we only want to do this once // So we save a flag inside a number variable. We check it here and if its // set already then we know we've already done this before. The name of the // variable in quotes can be whatever you want. int iModuleLoaded = GetLocalInt(OBJECT_SELF, "000_wildsrobe"); if (iModuleLoaded == 1) break; // get the object which contains the player object oPlayer = GetHero(); // The flag we save won't persist beyond the game session, so its a good idea to actually // look to see if the player already has the item, unless you WANT them to get another one // The name in quotes is the TAG of the item. So what we do is see how many of the item // the player already has, and if its 0, we know we haven't given it to them yet (or they sold it :p) int iItemCount = CountItemsByTag(oPlayer, "000_wildsrobe"); // if its 0, then let's give them the item. Now this first parameter is a RESOURCE identifier. Note // how its formatted. R"resource_file_name" // The "R" part is important and identifies it as a resource. The filename is just the filename of the // resource. You can see this in the toolset on the tabs up top. // The number 1 means give 1 item. if (iItemCount == 0) UT_AddItemToInventory(R"000_wildsrobe.uti",1); // lastly we set that number variable we talked about earlier, to save the fact that we've // done this already. SetLocalInt(OBJECT_SELF, "000_wildsrobe", 1); break; } default: { break; } } } http://i49.tinypic.com/5uh1cn.jpg http://i46.tinypic.com/2i07pcg.jpg http://i47.tinypic.com/iz7xpv.jpg Any idea? Link to comment Share on other sites More sharing options...
XunAmarox Posted November 19, 2009 Share Posted November 19, 2009 Oh, whoops... nevermind. Apparently you have to load a new area before it takes affect I guess... my bad. Maybe you should add that. :P Hm, or maybe it's just not in The Fade, or has something to do with having to close the editor first... Link to comment Share on other sites More sharing options...
Recommended Posts